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();
+18 -18
View File
@@ -14,11 +14,11 @@
/** /**
* Object literal with config options for the overlay. * Object literal with config options for the overlay.
* @typedef {Object} ol.OverlayOptions * @typedef {Object} ol.OverlayOptions
* @property {Element|undefined} element The overlay element. * @property {Element|undefined} element The overlay element.
* @property {ol.Map|undefined} map The map to overlay onto. * @property {ol.Map|undefined} map The map to overlay onto.
* @property {ol.Coordinate|undefined} position The overlay position in map * @property {ol.Coordinate|undefined} position The overlay position in map
* projection. * projection.
* @property {ol.OverlayPositioning|undefined} positioning Positioning. * @property {ol.OverlayPositioning|undefined} positioning Positioning.
*/ */
/** /**
@@ -50,24 +50,24 @@
* units per pixel. * units per pixel.
* @property {number|undefined} numZoomLevels The number of zoom levels for this * @property {number|undefined} numZoomLevels The number of zoom levels for this
* view. Zoom level 0 uses the `maxResolution`; subsequent zoom levels are * view. Zoom level 0 uses the `maxResolution`; subsequent zoom levels are
* calculated by dividing the previous resolution by `zoomFactor`. * calculated by dividing the previous resolution by `zoomFactor`.
* @property {ol.ProjectionLike} projection The map projection. * @property {ol.ProjectionLike} projection The map projection.
* @property {number|undefined} resolution The initial resolution for the view. * @property {number|undefined} resolution The initial resolution for the view.
* @property {Array.<number>|undefined} resolutions The resolutions for this * @property {Array.<number>|undefined} resolutions The resolutions for this
* view. If configured, this is equivalent to specifying `maxResolution` and * view. If configured, this is equivalent to specifying `maxResolution` and
* `numZoomLevels`. * `numZoomLevels`.
* @property {number|undefined} rotation Initial rotation of the view. * @property {number|undefined} rotation Initial rotation of the view.
* @property {number|undefined} zoom Initial zoom level of the view. * @property {number|undefined} zoom Initial zoom level of the view.
* @property {number|undefined} zoomFactor Factor to calculate resolutions for * @property {number|undefined} zoomFactor Factor to calculate resolutions for
* zoom levels. Default is 2. * zoom levels. Default is 2.
*/ */
/** /**
* @typedef {Object} ol.animation.BounceOptions * @typedef {Object} ol.animation.BounceOptions
* @property {number} resolution Resolution. * @property {number} resolution Resolution.
* @property {number|undefined} start Start. * @property {number|undefined} start Start.
* @property {number|undefined} duration Duration. * @property {number|undefined} duration Duration.
* @property {function(number):number|undefined} easing Easing function. * @property {function(number):number|undefined} easing Easing function.
*/ */
/** /**
@@ -96,7 +96,7 @@
/** /**
* @typedef {Object} ol.control.AttributionOptions * @typedef {Object} ol.control.AttributionOptions
* @property {ol.Map|undefined} map Map. * @property {ol.Map|undefined} map Map.
* @property {Element|undefined} target Target. * @property {Element|undefined} target Target.
*/ */
@@ -194,7 +194,7 @@
* @property {number|undefined} contrast Contrast. * @property {number|undefined} contrast Contrast.
* @property {number|undefined} hue Hue. * @property {number|undefined} hue Hue.
* @property {number|undefined} opacity Opacity. 0-1. Default is 1. * @property {number|undefined} opacity Opacity. 0-1. Default is 1.
* @property {number|undefined} preload Preload. * @property {number|undefined} preload Preload.
* @property {number|undefined} saturation Saturation. * @property {number|undefined} saturation Saturation.
* @property {ol.source.Source} source Source for this layer. * @property {ol.source.Source} source Source for this layer.
* @property {boolean|undefined} visible Visibility. Default is true (visible). * @property {boolean|undefined} visible Visibility. Default is true (visible).
@@ -204,7 +204,7 @@
* @typedef {Object} ol.layer.VectorLayerOptions * @typedef {Object} ol.layer.VectorLayerOptions
* @property {number|undefined} opacity Opacity. 0-1. Default is 1. * @property {number|undefined} opacity Opacity. 0-1. Default is 1.
* @property {ol.source.Source} source Source for this layer. * @property {ol.source.Source} source Source for this layer.
* @property {ol.style.Style|undefined} style Style. * @property {ol.style.Style|undefined} style Style.
* @property {boolean|undefined} visible Visibility. Default is true (visible). * @property {boolean|undefined} visible Visibility. Default is true (visible).
*/ */
@@ -301,7 +301,7 @@
* @property {ol.ProjectionLike} projection Projection. * @property {ol.ProjectionLike} projection Projection.
* @property {string|undefined} url WMS service url. * @property {string|undefined} url WMS service url.
* @property {Array.<string>|undefined} urls WMS service urls. Use this instead * @property {Array.<string>|undefined} urls WMS service urls. Use this instead
* of `url` when the WMS supports multiple urls for GetMap requests. * of `url` when the WMS supports multiple urls for GetMap requests.
*/ */
/** /**
@@ -350,9 +350,9 @@
* @property {string|ol.Expression|undefined} fillColor Fill color as hex color * @property {string|ol.Expression|undefined} fillColor Fill color as hex color
* code. * code.
* @property {string|ol.Expression|undefined} strokeColor Stroke color as hex * @property {string|ol.Expression|undefined} strokeColor Stroke color as hex
* color code. * color code.
* @property {number|ol.Expression|undefined} strokeWidth Stroke width in * @property {number|ol.Expression|undefined} strokeWidth Stroke width in
* pixels. * pixels.
* @property {number|ol.Expression|undefined} opacity Opacity (0-1). * @property {number|ol.Expression|undefined} opacity Opacity (0-1).
*/ */
@@ -402,4 +402,4 @@
/** /**
* @typedef {Object} ol.tilegrid.XYZOptions * @typedef {Object} ol.tilegrid.XYZOptions
* @property {number} maxZoom Maximum zoom. * @property {number} maxZoom Maximum zoom.
*/ */
+1 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol * @namespace ol
*/ */
+1 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol.animation * @namespace ol.animation
*/ */
+1 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol.control * @namespace ol.control
*/ */
@@ -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 -1
View File
@@ -1 +1 @@
@exportClass ol.control.ZoomSlider ol.control.ZoomSliderOptions @exportClass ol.control.ZoomSlider ol.control.ZoomSliderOptions
-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 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol.layer * @namespace ol.layer
*/ */
-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 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol.source * @namespace ol.source
*/ */
@@ -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 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol.style * @namespace ol.style
*/ */
-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_;
}; };
+1 -1
View File
@@ -1,3 +1,3 @@
/** /**
* @namespace ol.tilegrid * @namespace ol.tilegrid
*/ */