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

View File

@@ -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]
@@ -341,7 +345,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 +513,36 @@ def build_check_requires_timestamp(t):
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)

View File

@@ -60,4 +60,3 @@ xhr.onload = function() {
}
};
xhr.send();

View File

@@ -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.<number>|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.<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
* 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.
*/
*/

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol
*/
*/

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol.animation
*/
*/

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol.control
*/
*/

View File

@@ -1,3 +1,2 @@
@exportClass ol.control.Attribution ol.control.AttributionOptions
@exportProperty ol.control.Attribution.prototype.setMap

View File

@@ -1,3 +1,2 @@
@exportClass ol.control.MousePosition ol.control.MousePositionOptions
@exportProperty ol.control.MousePosition.prototype.setMap

View File

@@ -1 +1 @@
@exportClass ol.control.ZoomSlider ol.control.ZoomSliderOptions
@exportClass ol.control.ZoomSlider ol.control.ZoomSliderOptions

View File

@@ -117,4 +117,3 @@ ol.dom.Input.prototype.handleCheckedChanged_ = function() {
ol.dom.Input.prototype.handleValueChanged_ = function() {
this.target_.value = this.getValue();
};

View File

@@ -39,4 +39,3 @@ ol.filter.Geometry.prototype.applies = function(feature) {
ol.filter.Geometry.prototype.getType = function() {
return this.type_;
};

View File

@@ -160,4 +160,3 @@ ol.geom.SharedVertices.prototype.getStart = function(id) {
ol.geom.SharedVertices.prototype.getStarts = function() {
return this.starts_;
};

View File

@@ -1,3 +1,2 @@
@exportSymbol ol.interaction.Keyboard
@exportProperty ol.interaction.Keyboard.prototype.addCallback

View File

@@ -8,5 +8,3 @@ goog.provide('ol.IView3D');
*/
ol.IView3D = function() {
};

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol.layer
*/
*/

View File

@@ -1,2 +1 @@
@exportProperty ol.MapBrowserEvent.prototype.getCoordinate

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -439,4 +439,3 @@ ol.renderer.canvas.VectorRenderer.handleIconLoad_ =
opt_callback();
}
};

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol.source
*/
*/

View File

@@ -1,4 +1,3 @@
@exportSymbol ol.source.OpenStreetMap
@exportProperty ol.source.OpenStreetMap.DATA_ATTRIBUTION
@exportProperty ol.source.OpenStreetMap.TILE_ATTRIBUTION

View File

@@ -210,4 +210,3 @@ ol.structs.RTree.MAX_SUB_DIVISIONS = 6;
* @type {number}
*/
ol.structs.RTree.MAX_OBJECTS = 6;

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol.style
*/
*/

View File

@@ -43,4 +43,3 @@ ol.style.Rule.prototype.applies = function(feature) {
ol.style.Rule.prototype.getSymbolizers = function() {
return this.symbolizers_;
};

View File

@@ -1,3 +1,3 @@
/**
* @namespace ol.tilegrid
*/
*/