]> Nutra Git (v1) - gamesguru/getmyancestors.git/commitdiff
add lint stuff
authorShane <30691680+gamesguru@users.noreply.github.com>
Tue, 9 Sep 2025 16:10:28 +0000 (12:10 -0400)
committerShane <30691680+gamesguru@users.noreply.github.com>
Tue, 9 Sep 2025 16:25:30 +0000 (12:25 -0400)
lint configs

.github/workflows/test.yml [new file with mode: 0644]
.gitignore
.pylintrc [new file with mode: 0644]
.requirements-lint.txt [new file with mode: 0644]
Makefile [new file with mode: 0644]
setup.cfg [new file with mode: 0644]

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644 (file)
index 0000000..830059a
--- /dev/null
@@ -0,0 +1,43 @@
+---
+name: lint
+
+"on":
+  push: {}
+
+permissions:
+  contents: read
+
+jobs:
+  lint:
+    runs-on: [ubuntu-latest]
+
+    env:
+      SKIP_VENV: 1
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+        with:
+          submodules: recursive
+
+      - name: Fetch master (for incremental diff, lint filter mask)
+        run: git fetch origin master
+
+      - name: Reload Cache / pip
+        uses: actions/setup-python@v5
+        with:
+          python-version: 3
+          cache: "pip" # caching pip dependencies
+          cache-dependency-path: "**/*requirements*.txt"
+          update-environment: false
+
+      - name: Install requirements
+        run: |
+          pip install -r requirements.txt
+          pip install -r .requirements-lint.txt
+
+          # NOTE: pytest is needed to lint the folder: "tests/"
+          # pip install -r requirements-test.txt
+
+      - name: Lint
+        run: make lint
index 0679b9655a568f62d6d897725d9d112e737d4219..900678e1f6a400cb1765a841d5e165e6f6d4e199 100644 (file)
@@ -134,7 +134,7 @@ dmypy.json
 dump.rdb
 
 # Dotfiles
-.*
+/.idea
 !.gitignore
 !.readthedocs.yml
 
@@ -144,4 +144,4 @@ dump.rdb
 # getmyancestors stuff
 *.log
 *.settings
-*.ged
\ No newline at end of file
+*.ged
diff --git a/.pylintrc b/.pylintrc
new file mode 100644 (file)
index 0000000..1990f74
--- /dev/null
+++ b/.pylintrc
@@ -0,0 +1,17 @@
+[MASTER]
+
+fail-under=9.5
+
+
+[MESSAGES CONTROL]
+
+disable=
+    fixme,
+    consider-using-f-string,
+    missing-module-docstring,
+    missing-function-docstring,
+    too-many-arguments,
+    too-many-positional-arguments,
+    too-many-instance-attributes,
+    too-many-branches,
+    too-many-statements,
diff --git a/.requirements-lint.txt b/.requirements-lint.txt
new file mode 100644 (file)
index 0000000..47fc2b7
--- /dev/null
@@ -0,0 +1,5 @@
+flake8==7.3.0
+isort==6.0.1
+mypy==1.171
+pylint==3.3.8
+black==25.1.0
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..d167625
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,7 @@
+LINT_LOCS ?= getmyancestors/
+
+.PHONY: lint
+lint:
+       black $(LINT_LOCS)
+       isort $(LINT_LOCS)
+       flake8 $(LINT_LOCS)
diff --git a/setup.cfg b/setup.cfg
new file mode 100644 (file)
index 0000000..2556747
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,78 @@
+[tool:pytest]
+# See: https://docs.pytest.org/en/7.1.x/reference/customize.html
+testpaths =
+    tests
+
+[coverage:run]
+# See: https://coverage.readthedocs.io/en/7.2.2/config.html#run
+command_line = -m pytest
+source = ntclient
+
+[coverage:report]
+fail_under = 90.00
+precision = 2
+
+show_missing = True
+skip_empty = True
+skip_covered = True
+
+omit =
+    # Unlike the server & db, the CLI doesn't call the sql module.
+    # It directly imports the `build_ntsqlite()` function.
+    ntclient/ntsqlite/sql/__main__.py,
+
+exclude_lines =
+    pragma: no cover
+
+
+
+[pycodestyle]
+max-line-length = 88
+
+
+
+[flake8]
+per-file-ignores =
+    # Allow unused imports in __init__.py files
+    ; __init__.py:F401,
+
+max-line-length = 88
+
+ignore =
+    # line break before binary operator
+    W503,
+
+
+
+[isort]
+line_length = 88
+known_first_party = ntclient
+
+# See: https://copdips.com/2020/04/making-isort-compatible-with-black.html
+multi_line_output = 3
+include_trailing_comma = True
+
+
+
+[mypy]
+show_error_codes = True
+;show_error_context = True
+;pretty = True
+
+disallow_incomplete_defs = True
+disallow_untyped_defs = True
+disallow_untyped_calls = True
+disallow_untyped_decorators = True
+
+;strict_optional = True
+no_implicit_optional = True
+
+warn_return_any = True
+warn_redundant_casts = True
+warn_unreachable = True
+
+warn_unused_ignores = True
+warn_unused_configs = True
+warn_incomplete_stub = True
+
+# Our tests, they don't return a value typically