commit 2943173c477390d02bd9154144aabc349de5dadf
parent 3daac066d1d8411d4d2173a64249d886c56ed824
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Sat, 16 May 2026 09:56:49 +0200
ci: add flake8 verification
Diffstat:
5 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
@@ -7,8 +7,11 @@ default:
test:
stage: test
+ before_script:
+ - python -m pip install --upgrade pip
+ - python -m pip install flake8
script:
- - make test
+ - make verify
package:
stage: package
diff --git a/Makefile b/Makefile
@@ -1,13 +1,20 @@
PLUGIN_NAME = tem_loader
ZIPFILE = $(PLUGIN_NAME).zip
PYTHON ?= python3
+FLAKE8 ?= flake8
TEST_DIR = test
+LINT_TARGETS = $(PLUGIN_NAME) $(TEST_DIR)
-.PHONY: package clean test
+.PHONY: package clean lint test verify
+
+lint:
+ $(FLAKE8) $(LINT_TARGETS)
test:
$(PYTHON) -m unittest discover -s $(TEST_DIR) -p 'test_*.py'
+verify: lint test
+
package:
rm -f $(ZIPFILE)
zip -r $(ZIPFILE) $(PLUGIN_NAME)/ -x '*/__pycache__/*' '*/__pycache__/' '*/.DS_Store'
diff --git a/README.md b/README.md
@@ -64,7 +64,9 @@ Legacy TEMImage files with an extra leading index or project column are handled
## Development
```sh
+make lint # run flake8
make test # run the unittest suite
+make verify # run lint and tests
make package # build tem_loader.zip for installation
make clean # remove the zip
```
diff --git a/setup.cfg b/setup.cfg
@@ -0,0 +1,8 @@
+[flake8]
+max-line-length = 99
+exclude =
+ .artifacts,
+ .git,
+ __pycache__,
+ build,
+ dist
diff --git a/tem_loader/core.py b/tem_loader/core.py
@@ -70,6 +70,7 @@ def layer_opacity(
return ABOVE_DOI_OPACITY
return ABOVE_DOI_OPACITY if depth_mid <= doi else below_doi_opacity
+
# Resistivity ranges mirror the graduated symbology in styles/layers.qml.
# Each entry is (upper_exclusive, '#RRGGBB'); the final entry is the catch-all.
RESISTIVITY_COLOR_RAMP = (