Browse Source

don't allow else statemnt on new line

gero3 10 years ago
parent
commit
e136001051

+ 4 - 8
examples/js/Ocean.js

@@ -315,15 +315,13 @@ THREE.Ocean.prototype.renderSpectrumFFT = function() {
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.renderer.render( this.scene, this.oceanCamera, this.pingTransformFramebuffer );
 			this.renderer.render( this.scene, this.oceanCamera, this.pingTransformFramebuffer );
 
 
-		} 
-		else if ( i % 2 === 1 ) {
+		} else if ( i % 2 === 1 ) {
 
 
 			this.materialOceanHorizontal.uniforms.u_input.value = this.pingTransformFramebuffer;
 			this.materialOceanHorizontal.uniforms.u_input.value = this.pingTransformFramebuffer;
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.renderer.render( this.scene, this.oceanCamera, this.pongTransformFramebuffer );
 			this.renderer.render( this.scene, this.oceanCamera, this.pongTransformFramebuffer );
 
 
-		}
-		else {
+		} else {
 
 
 			this.materialOceanHorizontal.uniforms.u_input.value = this.pongTransformFramebuffer;
 			this.materialOceanHorizontal.uniforms.u_input.value = this.pongTransformFramebuffer;
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.materialOceanHorizontal.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
@@ -341,15 +339,13 @@ THREE.Ocean.prototype.renderSpectrumFFT = function() {
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.renderer.render( this.scene, this.oceanCamera, this.displacementMapFramebuffer );
 			this.renderer.render( this.scene, this.oceanCamera, this.displacementMapFramebuffer );
 
 
-		}
-		else if ( i % 2 === 1 ) {
+		} else if ( i % 2 === 1 ) {
 
 
 			this.materialOceanVertical.uniforms.u_input.value = this.pingTransformFramebuffer;
 			this.materialOceanVertical.uniforms.u_input.value = this.pingTransformFramebuffer;
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.renderer.render( this.scene, this.oceanCamera, this.pongTransformFramebuffer );
 			this.renderer.render( this.scene, this.oceanCamera, this.pongTransformFramebuffer );
 
 
-		}
-		else {
+		} else {
 
 
 			this.materialOceanVertical.uniforms.u_input.value = this.pongTransformFramebuffer;
 			this.materialOceanVertical.uniforms.u_input.value = this.pongTransformFramebuffer;
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );
 			this.materialOceanVertical.uniforms.u_subtransformSize.value = Math.pow( 2, ( i % ( iterations ) ) + 1 );

+ 2 - 4
examples/js/Sparks.js

@@ -389,8 +389,7 @@ SPARKS.Age.prototype.update = function ( emitter, particle, time ) {
 		particle.energy = 0;
 		particle.energy = 0;
 		particle.isDead = true;
 		particle.isDead = true;
 
 
-	}
-	else {
+	} else {
 
 
 		var t = this._easing( particle.age / particle.lifetime );
 		var t = this._easing( particle.age / particle.lifetime );
 		particle.energy = - 1 * t + 1;
 		particle.energy = - 1 * t + 1;
@@ -970,8 +969,7 @@ SPARKS.Utils = {
 
 
 			return new THREE.Vector3D( 1, 0, 0 );
 			return new THREE.Vector3D( 1, 0, 0 );
 
 
-		}
-		else {
+		} else {
 
 
 			var temp = new THREE.Vector3( v.y, - v.x, 0 );
 			var temp = new THREE.Vector3( v.y, - v.x, 0 );
 			return temp.normalize();
 			return temp.normalize();

+ 1 - 2
examples/js/crossfade/scenes.js

@@ -45,8 +45,7 @@ function generateGeometry( objectType, numObjects ) {
 			scale.z = Math.random() * 200 + 100;
 			scale.z = Math.random() * 200 + 100;
 			color.setRGB( 0, 0, Math.random() + 0.1 );
 			color.setRGB( 0, 0, Math.random() + 0.1 );
 
 
-		}
-		else if ( objectType == "sphere" ) {
+		} else if ( objectType == "sphere" ) {
 
 
 			geom = new THREE.IcosahedronGeometry( 1, 1 );
 			geom = new THREE.IcosahedronGeometry( 1, 1 );
 			scale.y = scale.z = scale.x;
 			scale.y = scale.z = scale.x;

+ 1 - 2
examples/js/crossfade/transition.js

@@ -136,8 +136,7 @@ function Transition ( sceneA, sceneB ) {
 
 
 				}
 				}
 
 
-			}	
-			else
+			} else
 				this.needChange = true;
 				this.needChange = true;
 				
 				
 		}
 		}

+ 3 - 6
examples/js/loaders/AWDLoader.js

@@ -334,8 +334,7 @@
 
 
 				}
 				}
 
 
-			}
-			else {
+			} else {
 
 
 				mesh = new THREE.Mesh( geometries[ 0 ] );
 				mesh = new THREE.Mesh( geometries[ 0 ] );
 				meshes.push( mesh );
 				meshes.push( mesh );
@@ -417,8 +416,7 @@
 				// Color material
 				// Color material
 				mat.color.setHex( props.get( 1, 0xcccccc ) );
 				mat.color.setHex( props.get( 1, 0xcccccc ) );
 
 
-			}
-			else if ( type === 2 ) {
+			} else if ( type === 2 ) {
 
 
 				// Bitmap material
 				// Bitmap material
 				var tex_addr = props.get( 2, 0 );
 				var tex_addr = props.get( 2, 0 );
@@ -1133,8 +1131,7 @@
 
 
 				return list;
 				return list;
 
 
-			}
-			else {
+			} else {
 
 
 				return read_func.call( this );
 				return read_func.call( this );
 
 

+ 9 - 18
examples/js/loaders/AssimpJSONLoader.js

@@ -279,18 +279,15 @@ THREE.AssimpJSONLoader.prototype = {
 
 
 							keyname = 'map';
 							keyname = 'map';
 
 
-						}
-						else if ( semantic === 5 ) {
+						} else if ( semantic === 5 ) {
 
 
 							keyname = 'bumpMap';
 							keyname = 'bumpMap';
 
 
-						}
-						else if ( semantic === 6 ) {
+						} else if ( semantic === 6 ) {
 
 
 							keyname = 'normalMap';
 							keyname = 'normalMap';
 
 
-						}
-						else if ( semantic === 2 ) {
+						} else if ( semantic === 2 ) {
 
 
 							keyname = 'specularMap';
 							keyname = 'specularMap';
 
 
@@ -320,28 +317,23 @@ THREE.AssimpJSONLoader.prototype = {
 
 
 				}
 				}
 
 
-			}
-			else if ( prop.key === '?mat.name' ) {
+			} else if ( prop.key === '?mat.name' ) {
 
 
 				init_props.name = prop.value;
 				init_props.name = prop.value;
 
 
-			}
-			else if ( prop.key === '$clr.diffuse' ) {
+			} else if ( prop.key === '$clr.diffuse' ) {
 
 
 				init_props.color = toColor( prop.value );
 				init_props.color = toColor( prop.value );
 
 
-			}
-			else if ( prop.key === '$clr.specular' ) {
+			} else if ( prop.key === '$clr.specular' ) {
 
 
 				init_props.specular = toColor( prop.value );
 				init_props.specular = toColor( prop.value );
 
 
-			}
-			else if ( prop.key === '$clr.emissive' ) {
+			} else if ( prop.key === '$clr.emissive' ) {
 
 
 				init_props.emissive = toColor( prop.value );
 				init_props.emissive = toColor( prop.value );
 
 
-			}
-			else if ( prop.key === '$mat.shadingm' ) {
+			} else if ( prop.key === '$mat.shadingm' ) {
 
 
 				// aiShadingMode_Flat
 				// aiShadingMode_Flat
 				if ( prop.value === 1 ) {
 				if ( prop.value === 1 ) {
@@ -350,8 +342,7 @@ THREE.AssimpJSONLoader.prototype = {
 
 
 				}
 				}
 
 
-			}
-			else if ( prop.key === '$mat.shininess' ) {
+			} else if ( prop.key === '$mat.shininess' ) {
 
 
 				init_props.shininess = prop.value;
 				init_props.shininess = prop.value;
 
 

+ 2 - 4
examples/js/loaders/PVRLoader.js

@@ -134,14 +134,12 @@ THREE.PVRLoader._parseV2 = function ( pvrDatas ) {
 		format = _hasAlpha ? THREE.RGBA_PVRTC_4BPPV1_Format : THREE.RGB_PVRTC_4BPPV1_Format;
 		format = _hasAlpha ? THREE.RGBA_PVRTC_4BPPV1_Format : THREE.RGB_PVRTC_4BPPV1_Format;
 		bpp = 4;
 		bpp = 4;
 
 
-	}
-	else if ( formatFlags === PVRTC_2 ) {
+	} else if ( formatFlags === PVRTC_2 ) {
 
 
 		format = _hasAlpha ? THREE.RGBA_PVRTC_2BPPV1_Format : THREE.RGB_PVRTC_2BPPV1_Format;
 		format = _hasAlpha ? THREE.RGBA_PVRTC_2BPPV1_Format : THREE.RGB_PVRTC_2BPPV1_Format;
 		bpp = 2;
 		bpp = 2;
 
 
-	}
-	else
+	} else
 		throw new Error( "pvrtc - unknown format " + formatFlags );
 		throw new Error( "pvrtc - unknown format " + formatFlags );
 	
 	
 
 

+ 4 - 12
examples/js/math/Lut.js

@@ -376,17 +376,13 @@ THREE.Lut.prototype = {
 
 
 					value = callback ( value );
 					value = callback ( value );
 
 
-				}
-
-				else {
+				} else {
 
 
 					if ( this.legend.labels.notation == 'scientific' ) {
 					if ( this.legend.labels.notation == 'scientific' ) {
 
 
 						value = value.toExponential( this.legend.labels.decimal );
 						value = value.toExponential( this.legend.labels.decimal );
 
 
-					}
-
-					else {
+					} else {
 
 
 						value = value.toFixed( this.legend.labels.decimal );
 						value = value.toFixed( this.legend.labels.decimal );
 
 
@@ -440,17 +436,13 @@ THREE.Lut.prototype = {
 
 
 							var offset = 1.7;
 							var offset = 1.7;
 
 
-						}
-
-						else {
+						} else {
 
 
 							var offset = 2.1;
 							var offset = 2.1;
 
 
 						}
 						}
 
 
-					}
-
-					else {
+					} else {
 
 
 						var offset = 1.7;
 						var offset = 1.7;
 
 

+ 1 - 2
examples/js/postprocessing/AdaptiveToneMappingPass.js

@@ -221,8 +221,7 @@ THREE.AdaptiveToneMappingPass.prototype = {
 			this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ] = "";
 			this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ] = "";
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT;
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT;
 
 
-		}
-		else {
+		} else {
 
 
 			this.adaptive = false;
 			this.adaptive = false;
 			delete this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ];
 			delete this.materialToneMap.defines[ "ADAPTED_LUMINANCE" ];

+ 3 - 6
examples/js/postprocessing/GlitchPass.js

@@ -59,8 +59,7 @@ THREE.GlitchPass.prototype = {
 			this.curF = 0;
 			this.curF = 0;
 			this.generateTrigger();
 			this.generateTrigger();
 
 
-		}
-		else if ( this.curF % this.randX < this.randX / 5 ) {
+		} else if ( this.curF % this.randX < this.randX / 5 ) {
 
 
 			this.uniforms[ 'amount' ].value = Math.random() / 90;
 			this.uniforms[ 'amount' ].value = Math.random() / 90;
 			this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
 			this.uniforms[ 'angle' ].value = THREE.Math.randFloat( - Math.PI, Math.PI );
@@ -69,8 +68,7 @@ THREE.GlitchPass.prototype = {
 			this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
 			this.uniforms[ 'seed_x' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
 			this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
 			this.uniforms[ 'seed_y' ].value = THREE.Math.randFloat( - 0.3, 0.3 );
 
 
-		}
-		else if ( this.goWild == false ) {
+		} else if ( this.goWild == false ) {
 
 
 			this.uniforms[ 'byp' ].value = 1;
 			this.uniforms[ 'byp' ].value = 1;
 
 
@@ -82,8 +80,7 @@ THREE.GlitchPass.prototype = {
 
 
 			renderer.render( this.scene, this.camera );
 			renderer.render( this.scene, this.camera );
 
 
-		} 
-		else {
+		} else {
 
 
 			renderer.render( this.scene, this.camera, writeBuffer, false );
 			renderer.render( this.scene, this.camera, writeBuffer, false );
 
 

+ 1 - 2
examples/js/renderers/SoftwareRenderer.js

@@ -375,8 +375,7 @@ THREE.SoftwareRenderer = function ( parameters ) {
 			buffer[ colorOffset + 3 ] = material.opacity * 255;
 			buffer[ colorOffset + 3 ] = material.opacity * 255;
 			depthBuf[ offset ] = depth;
 			depthBuf[ offset ] = depth;
 
 
-		}
-		else {
+		} else {
 
 
 			var opaci = tdata[ tIndex + 3 ] * material.opacity;
 			var opaci = tdata[ tIndex + 3 ] * material.opacity;
 			var texel = ( tdata[ tIndex ] << 16 ) + ( tdata[ tIndex + 1 ] << 8 ) + tdata[ tIndex + 2 ];
 			var texel = ( tdata[ tIndex ] << 16 ) + ( tdata[ tIndex + 1 ] << 8 ) + tdata[ tIndex + 2 ];

+ 1 - 0
utils/codestyle/config.json

@@ -2,6 +2,7 @@
     "preset": "mdcs",
     "preset": "mdcs",
     "disallowNewlineBeforeBlockStatements": true,
     "disallowNewlineBeforeBlockStatements": true,
     "requireSpaceAfterBinaryOperators": [","],
     "requireSpaceAfterBinaryOperators": [","],
+    "disallowKeywordsOnNewLine": ["else"],
     "excludeFiles": [ 
     "excludeFiles": [ 
         "../../.c9/", 
         "../../.c9/", 
         "../../.c9version/", 
         "../../.c9version/",