[postgis-tickets] r17556 - [travis] Lint Python code for syntax errors
Darafei
komzpa at gmail.com
Sat Jun 22 01:05:00 PDT 2019
Author: komzpa
Date: 2019-06-22 13:05:00 -0700 (Sat, 22 Jun 2019)
New Revision: 17556
Modified:
trunk/.travis.yml
trunk/raster/scripts/python/raster2pgsql.py
trunk/raster/scripts/python/rtreader.py
Log:
[travis] Lint Python code for syntax errors
Patch by Christian Clauss
Closes #411
Modified: trunk/.travis.yml
===================================================================
--- trunk/.travis.yml 2019-06-21 13:45:04 UTC (rev 17555)
+++ trunk/.travis.yml 2019-06-22 20:05:00 UTC (rev 17556)
@@ -1,7 +1,6 @@
services:
- docker
-sudo: true
language: c
env:
@@ -20,6 +19,12 @@
matrix:
allow_failures:
- env: tag=latest mode=tests
+ include:
+ - name: "Lint: python3 -m flake8 . --select=E9,F63,F72,F82"
+ language: python
+ script:
+ - pip install flake8 # lint Python code for syntax errors
+ - flake8 . --count --select=E9,F63,F72,F82 --show-source --statistics
script:
- echo "/tmp/logbt-coredumps/core.%p.%E" | sudo tee /proc/sys/kernel/core_pattern
Modified: trunk/raster/scripts/python/raster2pgsql.py
===================================================================
--- trunk/raster/scripts/python/raster2pgsql.py 2019-06-21 13:45:04 UTC (rev 17555)
+++ trunk/raster/scripts/python/raster2pgsql.py 2019-06-22 20:05:00 UTC (rev 17556)
@@ -670,7 +670,7 @@
"""Writes WKT Raster header based on given GDAL into HEX-encoded WKB."""
assert ds is not None, "Error: Missing GDAL dataset"
assert level >= 1
- assert len(ulp) == 2 is not None, "Error: invalid upper-left corner"
+ assert len(ulp) == 2, "Error: invalid upper-left corner"
if xsize is None or ysize is None:
assert xsize is None and ysize is None
Modified: trunk/raster/scripts/python/rtreader.py
===================================================================
--- trunk/raster/scripts/python/rtreader.py 2019-06-21 13:45:04 UTC (rev 17555)
+++ trunk/raster/scripts/python/rtreader.py 2019-06-22 20:05:00 UTC (rev 17556)
@@ -175,7 +175,7 @@
self._sizes = self._query_single_row(sql)
if self._sizes is None:
- raise RasterError("Falied to query %dx%d of band %d is none" %(x, y, band))
+ raise RasterError("Falied to query raster size of dim {} with force {}".format(dim, force))
return self._sizes[dim]
def _query_pixel_types(self):
More information about the postgis-tickets
mailing list