Skip to content

Commit

Permalink
Merge pull request #32 from biocommons/4-add-pyright-support-to-cicd
Browse files Browse the repository at this point in the history
Add pyright checking, use pre-commit for code reformatting
  • Loading branch information
reece authored Sep 26, 2023
2 parents d555abe + 143d277 commit d22ce00
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ repos:
entry: flake8
language: system
types: [python]
- id: pyright
name: pyright
entry: pyright
language: system
types: [python]
- id: isort
name: isort
entry: isort
Expand Down
27 changes: 12 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ build: %:
#= TESTING
# see test configuration in setup.cfg

#=> cqa: execute code quality tests
cqa:
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
isort --profile black --check src
black --check src
bandit -ll -r src

#=> test: execute tests
#=> test-code: test code (including embedded doctests)
#=> test-docs: test example code in docs
Expand All @@ -86,17 +79,21 @@ test-%:
tox:
tox

#=> cqa: execute code quality tests
cqa:
flake8 src --show-source --statistics
pyright
isort --check src --profile black
black --check src
bandit -ll -r src

############################################################################
#= UTILITY TARGETS

#=> reformat: reformat code with yapf and commit
#=> reformat: reformat code
.PHONY: reformat
reformat:
@if ! git diff --cached --exit-code >/dev/null; then echo "Repository not clean" 1>&2; exit 1; fi
black src tests
isort src tests
git commit -a -m "reformatted with black and isort"
pre-commit

############################################################################
#= UTILITY TARGETS

#=> rename: rename files and substitute content for new repo name
.PHONY: rename
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ dev = [
"flake8 ~= 4.0",
"ipython ~= 8.4",
"isort ~= 5.10",
"mypy",
"mypy-extensions ~= 1.0",
"pre-commit ~= 3.4",
"pylint ~= 2.14",
"pytest-cov ~= 4.1",
"pytest-optional-tests",
"pytest ~= 7.1",
"pyright~=1.1",
"tox ~= 3.25",
"vcrpy",
]
Expand Down Expand Up @@ -127,7 +128,11 @@ line-length = 100

[tool.isort]
profile = "black"
src_paths = ["src"]
src_paths = ["src", "tests"]


[tool.pyright]
include = ["src", "tests"]


[tool.pylint.'MESSAGES CONTROL']
Expand Down
2 changes: 1 addition & 1 deletion src/biocommons/example/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import importlib
import importlib.resources

import pytest
import yaml
Expand Down

0 comments on commit d22ce00

Please sign in to comment.