Merge pull request #496 from twpayne/check-whitespace

Check whitespace
This commit is contained in:
Tom Payne
2013-04-08 06:06:15 -07:00
26 changed files with 62 additions and 44 deletions
+36 -1
View File
@@ -126,6 +126,10 @@ GLSL_SRC = [path
for path in ifind('src') for path in ifind('src')
if path.endswith('.glsl')] if path.endswith('.glsl')]
JSDOC_SRC = [path
for path in ifind('src')
if path.endswith('.jsdoc')]
SHADER_SRC = [path.replace('.glsl', 'shader.js') SHADER_SRC = [path.replace('.glsl', 'shader.js')
for path in GLSL_SRC] for path in GLSL_SRC]
@@ -341,7 +345,8 @@ def serve_precommit(t):
'buildcfg/ol-all.json', 'buildcfg/test.json') 'buildcfg/ol-all.json', 'buildcfg/test.json')
virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp') virtual('lint', 'build/lint-timestamp', 'build/check-requires-timestamp',
'build/check-whitespace-timestamp')
@target('build/lint-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC, @target('build/lint-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, EXAMPLES_SRC,
@@ -508,6 +513,36 @@ def build_check_requires_timestamp(t):
t.touch() t.touch()
@target('build/check-whitespace-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC,
EXAMPLES_SRC, SPEC, EXPORTS, JSDOC_SRC,
precious=True)
def build_check_whitespace_timestamp(t):
CR_RE = re.compile(r'\r')
TRAILING_WHITESPACE_RE = re.compile(r'\s+\n\Z')
NO_NEWLINE_RE = re.compile(r'[^\n]\Z')
ALL_WHITESPACE_RE = re.compile(r'\s+\Z')
errors = 0
for filename in sorted(t.newer(t.dependencies)):
whitespace = False
for lineno, line in enumerate(open(filename)):
if CR_RE.search(line):
t.info('%s:%d: carriage return character in line', filename, lineno + 1)
errors += 1
if TRAILING_WHITESPACE_RE.search(line):
t.info('%s:%d: trailing whitespace', filename, lineno + 1)
errors += 1
if NO_NEWLINE_RE.search(line):
t.info('%s:%d: no newline at end of file', filename, lineno + 1)
errors += 1
whitespace = ALL_WHITESPACE_RE.match(line)
if whitespace:
t.info('%s: trailing whitespace at end of file', filename)
errors += 1
if errors:
t.error('%d whitespace errors' % (errors,))
t.touch()
virtual('plovr', PLOVR_JAR) virtual('plovr', PLOVR_JAR)
-1
View File
@@ -60,4 +60,3 @@ xhr.onload = function() {
} }
}; };
xhr.send(); xhr.send();
@@ -1,3 +1,2 @@
@exportClass ol.control.Attribution ol.control.AttributionOptions @exportClass ol.control.Attribution ol.control.AttributionOptions
@exportProperty ol.control.Attribution.prototype.setMap @exportProperty ol.control.Attribution.prototype.setMap
@@ -1,3 +1,2 @@
@exportClass ol.control.MousePosition ol.control.MousePositionOptions @exportClass ol.control.MousePosition ol.control.MousePositionOptions
@exportProperty ol.control.MousePosition.prototype.setMap @exportProperty ol.control.MousePosition.prototype.setMap
-1
View File
@@ -117,4 +117,3 @@ ol.dom.Input.prototype.handleCheckedChanged_ = function() {
ol.dom.Input.prototype.handleValueChanged_ = function() { ol.dom.Input.prototype.handleValueChanged_ = function() {
this.target_.value = this.getValue(); this.target_.value = this.getValue();
}; };
-1
View File
@@ -39,4 +39,3 @@ ol.filter.Geometry.prototype.applies = function(feature) {
ol.filter.Geometry.prototype.getType = function() { ol.filter.Geometry.prototype.getType = function() {
return this.type_; return this.type_;
}; };
-1
View File
@@ -160,4 +160,3 @@ ol.geom.SharedVertices.prototype.getStart = function(id) {
ol.geom.SharedVertices.prototype.getStarts = function() { ol.geom.SharedVertices.prototype.getStarts = function() {
return this.starts_; return this.starts_;
}; };
@@ -1,3 +1,2 @@
@exportSymbol ol.interaction.Keyboard @exportSymbol ol.interaction.Keyboard
@exportProperty ol.interaction.Keyboard.prototype.addCallback @exportProperty ol.interaction.Keyboard.prototype.addCallback
-2
View File
@@ -8,5 +8,3 @@ goog.provide('ol.IView3D');
*/ */
ol.IView3D = function() { ol.IView3D = function() {
}; };
-1
View File
@@ -1,2 +1 @@
@exportProperty ol.MapBrowserEvent.prototype.getCoordinate @exportProperty ol.MapBrowserEvent.prototype.getCoordinate
@@ -61,4 +61,3 @@ ol.parser.ogc.WMSCapabilities_v1_0_0 = function() {
}; };
goog.inherits(ol.parser.ogc.WMSCapabilities_v1_0_0, goog.inherits(ol.parser.ogc.WMSCapabilities_v1_0_0,
ol.parser.ogc.WMSCapabilities_v1_1_0); ol.parser.ogc.WMSCapabilities_v1_1_0);
@@ -24,4 +24,3 @@ ol.parser.ogc.WMSCapabilities_v1_1_0 = function() {
}; };
goog.inherits(ol.parser.ogc.WMSCapabilities_v1_1_0, goog.inherits(ol.parser.ogc.WMSCapabilities_v1_1_0,
ol.parser.ogc.WMSCapabilities_v1_1); ol.parser.ogc.WMSCapabilities_v1_1);
@@ -20,4 +20,3 @@ ol.parser.ogc.WMSCapabilities_v1_1_1 = function() {
}; };
goog.inherits(ol.parser.ogc.WMSCapabilities_v1_1_1, goog.inherits(ol.parser.ogc.WMSCapabilities_v1_1_1,
ol.parser.ogc.WMSCapabilities_v1_1); ol.parser.ogc.WMSCapabilities_v1_1);
@@ -439,4 +439,3 @@ ol.renderer.canvas.VectorRenderer.handleIconLoad_ =
opt_callback(); opt_callback();
} }
}; };
@@ -1,4 +1,3 @@
@exportSymbol ol.source.OpenStreetMap @exportSymbol ol.source.OpenStreetMap
@exportProperty ol.source.OpenStreetMap.DATA_ATTRIBUTION @exportProperty ol.source.OpenStreetMap.DATA_ATTRIBUTION
@exportProperty ol.source.OpenStreetMap.TILE_ATTRIBUTION @exportProperty ol.source.OpenStreetMap.TILE_ATTRIBUTION
-1
View File
@@ -210,4 +210,3 @@ ol.structs.RTree.MAX_SUB_DIVISIONS = 6;
* @type {number} * @type {number}
*/ */
ol.structs.RTree.MAX_OBJECTS = 6; ol.structs.RTree.MAX_OBJECTS = 6;
-1
View File
@@ -43,4 +43,3 @@ ol.style.Rule.prototype.applies = function(feature) {
ol.style.Rule.prototype.getSymbolizers = function() { ol.style.Rule.prototype.getSymbolizers = function() {
return this.symbolizers_; return this.symbolizers_;
}; };