From 81712a28a312f7f57438aef45032e8610f501186 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 7 Apr 2013 13:14:09 +0200 Subject: [PATCH 1/6] Fix whitespace errors in examples --- examples/vector-layer.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 586bdb2c92..1f23f67028 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -60,4 +60,3 @@ xhr.onload = function() { } }; xhr.send(); - From a4763e0b69a2ec534687f5b94fd45e546e60595d Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 7 Apr 2013 13:14:52 +0200 Subject: [PATCH 2/6] Fix whitespace errors in exports --- src/ol/control/attributioncontrol.exports | 1 - src/ol/control/mousepositioncontrol.exports | 1 - src/ol/control/zoomslidercontrol.exports | 2 +- src/ol/interaction/keyboardinteraction.exports | 1 - src/ol/mapbrowserevent.exports | 1 - src/ol/source/openstreetmapsource.exports | 1 - 6 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ol/control/attributioncontrol.exports b/src/ol/control/attributioncontrol.exports index 57e5bdb9d8..b5e1d2983d 100644 --- a/src/ol/control/attributioncontrol.exports +++ b/src/ol/control/attributioncontrol.exports @@ -1,3 +1,2 @@ @exportClass ol.control.Attribution ol.control.AttributionOptions @exportProperty ol.control.Attribution.prototype.setMap - diff --git a/src/ol/control/mousepositioncontrol.exports b/src/ol/control/mousepositioncontrol.exports index e29f9caa13..925d6c0720 100644 --- a/src/ol/control/mousepositioncontrol.exports +++ b/src/ol/control/mousepositioncontrol.exports @@ -1,3 +1,2 @@ @exportClass ol.control.MousePosition ol.control.MousePositionOptions @exportProperty ol.control.MousePosition.prototype.setMap - diff --git a/src/ol/control/zoomslidercontrol.exports b/src/ol/control/zoomslidercontrol.exports index cbc760930a..9b07355c21 100644 --- a/src/ol/control/zoomslidercontrol.exports +++ b/src/ol/control/zoomslidercontrol.exports @@ -1 +1 @@ -@exportClass ol.control.ZoomSlider ol.control.ZoomSliderOptions \ No newline at end of file +@exportClass ol.control.ZoomSlider ol.control.ZoomSliderOptions diff --git a/src/ol/interaction/keyboardinteraction.exports b/src/ol/interaction/keyboardinteraction.exports index 45ab209343..4d894cf684 100644 --- a/src/ol/interaction/keyboardinteraction.exports +++ b/src/ol/interaction/keyboardinteraction.exports @@ -1,3 +1,2 @@ @exportSymbol ol.interaction.Keyboard @exportProperty ol.interaction.Keyboard.prototype.addCallback - diff --git a/src/ol/mapbrowserevent.exports b/src/ol/mapbrowserevent.exports index 38eafbb2a1..dd3e1cabb7 100644 --- a/src/ol/mapbrowserevent.exports +++ b/src/ol/mapbrowserevent.exports @@ -1,2 +1 @@ @exportProperty ol.MapBrowserEvent.prototype.getCoordinate - diff --git a/src/ol/source/openstreetmapsource.exports b/src/ol/source/openstreetmapsource.exports index e64a17bb31..5933aa3596 100644 --- a/src/ol/source/openstreetmapsource.exports +++ b/src/ol/source/openstreetmapsource.exports @@ -1,4 +1,3 @@ @exportSymbol ol.source.OpenStreetMap @exportProperty ol.source.OpenStreetMap.DATA_ATTRIBUTION @exportProperty ol.source.OpenStreetMap.TILE_ATTRIBUTION - From f1cc5b87dab05925f3e3e7c758c2bc66571a9f7b Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 7 Apr 2013 13:15:17 +0200 Subject: [PATCH 3/6] Fix whitespace errors in JavaScript source --- src/ol/dom/input.js | 1 - src/ol/filter/geometryfilter.js | 1 - src/ol/geom/sharedvertices.js | 1 - src/ol/iview3d.js | 2 -- src/ol/parser/ogc/wmscapabilities_v1_0_0.js | 1 - src/ol/parser/ogc/wmscapabilities_v1_1_0.js | 1 - src/ol/parser/ogc/wmscapabilities_v1_1_1.js | 1 - src/ol/renderer/canvas/canvasvectorrenderer.js | 1 - src/ol/structs/rtree.js | 1 - src/ol/style/rule.js | 1 - 10 files changed, 11 deletions(-) diff --git a/src/ol/dom/input.js b/src/ol/dom/input.js index ceeb393ca7..5a3d293952 100644 --- a/src/ol/dom/input.js +++ b/src/ol/dom/input.js @@ -117,4 +117,3 @@ ol.dom.Input.prototype.handleCheckedChanged_ = function() { ol.dom.Input.prototype.handleValueChanged_ = function() { this.target_.value = this.getValue(); }; - diff --git a/src/ol/filter/geometryfilter.js b/src/ol/filter/geometryfilter.js index f48a67b14b..979ae37741 100644 --- a/src/ol/filter/geometryfilter.js +++ b/src/ol/filter/geometryfilter.js @@ -39,4 +39,3 @@ ol.filter.Geometry.prototype.applies = function(feature) { ol.filter.Geometry.prototype.getType = function() { return this.type_; }; - diff --git a/src/ol/geom/sharedvertices.js b/src/ol/geom/sharedvertices.js index 3941b8f0e7..fcb3295c5a 100644 --- a/src/ol/geom/sharedvertices.js +++ b/src/ol/geom/sharedvertices.js @@ -160,4 +160,3 @@ ol.geom.SharedVertices.prototype.getStart = function(id) { ol.geom.SharedVertices.prototype.getStarts = function() { return this.starts_; }; - diff --git a/src/ol/iview3d.js b/src/ol/iview3d.js index 90153214b5..c74f9acf6b 100644 --- a/src/ol/iview3d.js +++ b/src/ol/iview3d.js @@ -8,5 +8,3 @@ goog.provide('ol.IView3D'); */ ol.IView3D = function() { }; - - diff --git a/src/ol/parser/ogc/wmscapabilities_v1_0_0.js b/src/ol/parser/ogc/wmscapabilities_v1_0_0.js index fea4adfc95..6edebde553 100644 --- a/src/ol/parser/ogc/wmscapabilities_v1_0_0.js +++ b/src/ol/parser/ogc/wmscapabilities_v1_0_0.js @@ -61,4 +61,3 @@ ol.parser.ogc.WMSCapabilities_v1_0_0 = function() { }; goog.inherits(ol.parser.ogc.WMSCapabilities_v1_0_0, ol.parser.ogc.WMSCapabilities_v1_1_0); - diff --git a/src/ol/parser/ogc/wmscapabilities_v1_1_0.js b/src/ol/parser/ogc/wmscapabilities_v1_1_0.js index ff79ce99f7..1f8c54f5bb 100644 --- a/src/ol/parser/ogc/wmscapabilities_v1_1_0.js +++ b/src/ol/parser/ogc/wmscapabilities_v1_1_0.js @@ -24,4 +24,3 @@ ol.parser.ogc.WMSCapabilities_v1_1_0 = function() { }; goog.inherits(ol.parser.ogc.WMSCapabilities_v1_1_0, ol.parser.ogc.WMSCapabilities_v1_1); - diff --git a/src/ol/parser/ogc/wmscapabilities_v1_1_1.js b/src/ol/parser/ogc/wmscapabilities_v1_1_1.js index 65402d09da..bb569e3241 100644 --- a/src/ol/parser/ogc/wmscapabilities_v1_1_1.js +++ b/src/ol/parser/ogc/wmscapabilities_v1_1_1.js @@ -20,4 +20,3 @@ ol.parser.ogc.WMSCapabilities_v1_1_1 = function() { }; goog.inherits(ol.parser.ogc.WMSCapabilities_v1_1_1, ol.parser.ogc.WMSCapabilities_v1_1); - diff --git a/src/ol/renderer/canvas/canvasvectorrenderer.js b/src/ol/renderer/canvas/canvasvectorrenderer.js index 3019eeedea..4e4696d221 100644 --- a/src/ol/renderer/canvas/canvasvectorrenderer.js +++ b/src/ol/renderer/canvas/canvasvectorrenderer.js @@ -439,4 +439,3 @@ ol.renderer.canvas.VectorRenderer.handleIconLoad_ = opt_callback(); } }; - diff --git a/src/ol/structs/rtree.js b/src/ol/structs/rtree.js index e323cb1ef1..248ddf0b77 100644 --- a/src/ol/structs/rtree.js +++ b/src/ol/structs/rtree.js @@ -210,4 +210,3 @@ ol.structs.RTree.MAX_SUB_DIVISIONS = 6; * @type {number} */ ol.structs.RTree.MAX_OBJECTS = 6; - diff --git a/src/ol/style/rule.js b/src/ol/style/rule.js index b6f1284fea..0234fd9540 100644 --- a/src/ol/style/rule.js +++ b/src/ol/style/rule.js @@ -43,4 +43,3 @@ ol.style.Rule.prototype.applies = function(feature) { ol.style.Rule.prototype.getSymbolizers = function() { return this.symbolizers_; }; - From 7b2c2369ae7f34811cc69e90b77a534142736e5b Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Sun, 7 Apr 2013 13:15:33 +0200 Subject: [PATCH 4/6] Check for whitespace errors in lint --- build.py | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index ec71b6182a..47f65b9ec1 100755 --- a/build.py +++ b/build.py @@ -341,7 +341,8 @@ def serve_precommit(t): '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, @@ -508,6 +509,36 @@ def build_check_requires_timestamp(t): t.touch() +@target('build/check-whitespace-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, + EXAMPLES_SRC, SPEC, EXPORTS, 'src/objectliterals.exports', + 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) From a103b5acd738b984c154a3d31e654694b5a8a088 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 8 Apr 2013 12:24:19 +0200 Subject: [PATCH 5/6] Fix whitespace errors in jsdoc --- src/objectliterals.jsdoc | 36 ++++++++++++++++++------------------ src/ol.jsdoc | 2 +- src/ol/animation.jsdoc | 2 +- src/ol/control.jsdoc | 2 +- src/ol/layer.jsdoc | 2 +- src/ol/source.jsdoc | 2 +- src/ol/style.jsdoc | 2 +- src/ol/tilegrid.jsdoc | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 0d6db86d24..61bdecede8 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -14,11 +14,11 @@ /** * Object literal with config options for the overlay. * @typedef {Object} ol.OverlayOptions - * @property {Element|undefined} element The overlay element. - * @property {ol.Map|undefined} map The map to overlay onto. + * @property {Element|undefined} element The overlay element. + * @property {ol.Map|undefined} map The map to overlay onto. * @property {ol.Coordinate|undefined} position The overlay position in map * projection. - * @property {ol.OverlayPositioning|undefined} positioning Positioning. + * @property {ol.OverlayPositioning|undefined} positioning Positioning. */ /** @@ -50,24 +50,24 @@ * units per pixel. * @property {number|undefined} numZoomLevels The number of zoom levels for this * 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 {number|undefined} resolution The initial resolution for the view. + * @property {number|undefined} resolution The initial resolution for the view. * @property {Array.|undefined} resolutions The resolutions for this * view. If configured, this is equivalent to specifying `maxResolution` and * `numZoomLevels`. - * @property {number|undefined} rotation Initial rotation of the view. - * @property {number|undefined} zoom Initial zoom level 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} zoomFactor Factor to calculate resolutions for * zoom levels. Default is 2. */ /** * @typedef {Object} ol.animation.BounceOptions - * @property {number} resolution Resolution. - * @property {number|undefined} start Start. - * @property {number|undefined} duration Duration. - * @property {function(number):number|undefined} easing Easing function. + * @property {number} resolution Resolution. + * @property {number|undefined} start Start. + * @property {number|undefined} duration Duration. + * @property {function(number):number|undefined} easing Easing function. */ /** @@ -96,7 +96,7 @@ /** * @typedef {Object} ol.control.AttributionOptions - * @property {ol.Map|undefined} map Map. + * @property {ol.Map|undefined} map Map. * @property {Element|undefined} target Target. */ @@ -194,7 +194,7 @@ * @property {number|undefined} contrast Contrast. * @property {number|undefined} hue Hue. * @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 {ol.source.Source} source Source for this layer. * @property {boolean|undefined} visible Visibility. Default is true (visible). @@ -204,7 +204,7 @@ * @typedef {Object} ol.layer.VectorLayerOptions * @property {number|undefined} opacity Opacity. 0-1. Default is 1. * @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). */ @@ -301,7 +301,7 @@ * @property {ol.ProjectionLike} projection Projection. * @property {string|undefined} url WMS service url. * @property {Array.|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 * code. * @property {string|ol.Expression|undefined} strokeColor Stroke color as hex - * color code. + * color code. * @property {number|ol.Expression|undefined} strokeWidth Stroke width in - * pixels. + * pixels. * @property {number|ol.Expression|undefined} opacity Opacity (0-1). */ @@ -402,4 +402,4 @@ /** * @typedef {Object} ol.tilegrid.XYZOptions * @property {number} maxZoom Maximum zoom. - */ \ No newline at end of file + */ diff --git a/src/ol.jsdoc b/src/ol.jsdoc index 2f2adb8a64..47c6db565c 100644 --- a/src/ol.jsdoc +++ b/src/ol.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol - */ \ No newline at end of file + */ diff --git a/src/ol/animation.jsdoc b/src/ol/animation.jsdoc index 1e659969cf..5ee3f363a0 100644 --- a/src/ol/animation.jsdoc +++ b/src/ol/animation.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol.animation - */ \ No newline at end of file + */ diff --git a/src/ol/control.jsdoc b/src/ol/control.jsdoc index 6c5dd9f581..bd09e4c9b2 100644 --- a/src/ol/control.jsdoc +++ b/src/ol/control.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol.control - */ \ No newline at end of file + */ diff --git a/src/ol/layer.jsdoc b/src/ol/layer.jsdoc index a8bc4e6add..29e9851de5 100644 --- a/src/ol/layer.jsdoc +++ b/src/ol/layer.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol.layer - */ \ No newline at end of file + */ diff --git a/src/ol/source.jsdoc b/src/ol/source.jsdoc index 637fb44216..7c86502e0e 100644 --- a/src/ol/source.jsdoc +++ b/src/ol/source.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol.source - */ \ No newline at end of file + */ diff --git a/src/ol/style.jsdoc b/src/ol/style.jsdoc index d95f551e7f..ed02b4dbdf 100644 --- a/src/ol/style.jsdoc +++ b/src/ol/style.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol.style - */ \ No newline at end of file + */ diff --git a/src/ol/tilegrid.jsdoc b/src/ol/tilegrid.jsdoc index 55f249fbbd..5f6ed64aaa 100644 --- a/src/ol/tilegrid.jsdoc +++ b/src/ol/tilegrid.jsdoc @@ -1,3 +1,3 @@ /** * @namespace ol.tilegrid - */ \ No newline at end of file + */ From 9d38b21831abc8951be906ba5f9030aa5b1abe03 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Mon, 8 Apr 2013 12:25:00 +0200 Subject: [PATCH 6/6] Check for whitespace errors in jsdoc files --- build.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index 47f65b9ec1..26e436baa4 100755 --- a/build.py +++ b/build.py @@ -126,6 +126,10 @@ GLSL_SRC = [path for path in ifind('src') if path.endswith('.glsl')] +JSDOC_SRC = [path + for path in ifind('src') + if path.endswith('.jsdoc')] + SHADER_SRC = [path.replace('.glsl', 'shader.js') for path in GLSL_SRC] @@ -510,7 +514,7 @@ def build_check_requires_timestamp(t): @target('build/check-whitespace-timestamp', SRC, INTERNAL_SRC, EXTERNAL_SRC, - EXAMPLES_SRC, SPEC, EXPORTS, 'src/objectliterals.exports', + EXAMPLES_SRC, SPEC, EXPORTS, JSDOC_SRC, precious=True) def build_check_whitespace_timestamp(t): CR_RE = re.compile(r'\r')