Skip to content

Commit

Permalink
Fix linter config parsing errors (#1010)
Browse files Browse the repository at this point in the history
* switch to pyproject.toml

* run tests on master as well this will fix coverage reporting issues
  • Loading branch information
sainak authored Sep 9, 2022
1 parent 527f585 commit 1c2b1ac
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 102 deletions.
20 changes: 0 additions & 20 deletions .coveragerc

This file was deleted.

13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
max-line-length = 88
extend-ignore = E203,E501,E231
exclude =
.git,
.gitignore,
*.pot,
*.py[co],
__pycache__,
.venv,
*/migrations/*,
*/static/CACHE/*,
docs
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:
CONTAINER_NAME_CRON: 'care-celery-beat'
jobs:
test:
if: github.ref == 'refs/heads/production'
if: github.ref == 'refs/heads/production' || github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/care
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
VALIDATE_PYTHON_FLAKE8: true
VALIDATE_PYTHON_ISORT: true
LINTER_RULES_PATH: /
PYTHON_BLACK_CONFIG_FILE: "setup.cfg"
PYTHON_FLAKE8_CONFIG_FILE: "setup.cfg"
PYTHON_ISORT_CONFIG_FILE: "setup.cfg"
# PYTHON_BLACK_CONFIG_FILE: "pyproject.toml"
PYTHON_FLAKE8_CONFIG_FILE: ".flake8"
PYTHON_ISORT_CONFIG_FILE: "pyproject.toml"
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
exclude: "docs|node_modules|migrations|.git|.tox"
default_stages: [commit]
fail_fast: true

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -16,18 +15,19 @@ repos:
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black"]
additional_dependencies: ["isort[pyproject]"]

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ["--config=pyproject.toml"]

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: ["--config=setup.cfg"]
args: ["--config=pyproject.toml"]
additional_dependencies: [flake8-isort]

ci:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ python manage.py migrate

echo "All migrations have been made successfully"

if ["${DJANGO_DEBUG,,}" == "true"]; then
if [[ "${DJANGO_DEBUG,,}" == "true" ]]; then
python -m debugpy --wait-for-client --listen 0.0.0.0:9876 manage.py runserver_plus 0.0.0.0:9000
else
python manage.py runserver 0.0.0.0:9000
Expand Down
62 changes: 62 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[tool.coverage.run]
branch = true
source = ["care", "config"]
parallel = true
concurrency = ["multiprocessing"]


[tool.coverage.report]
omit = [
"*/tests/*",
"*/migrations/*",
"*/asgi.py",
"*/wsgi.py",
"manage.py",
".venv/*"
]
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError"
]
ignore_errors = true


[tool.isort]
profile = "black"
known_third_party = [
"allauth",
"boto3",
"celery",
"crispy_forms",
"dateparser",
"dateutil",
"django",
"django_filters",
"django_rest_passwordreset",
"djangoql",
"djqscsv",
"drf_extra_fields",
"drf_yasg",
"dry_rest_permissions",
"environ",
"fernet_fields",
"freezegun",
"hardcopy",
"healthy_django",
"jsonschema",
"jwt",
"location_field",
"multiselectfield",
"partial_index",
"phonenumber_field",
"phonenumbers",
"pytz",
"pywebpush",
"ratelimit",
"requests",
"rest_framework",
"rest_framework_nested",
"rest_framework_simplejwt",
"sentry_sdk",
"simple_history"
]
2 changes: 1 addition & 1 deletion requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ django-extensions==2.2.8 # https://github.com/django-extensions/django-extensio
# -------------------------------
factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy
freezegun==0.3.15 # https://github.com/spulec/freezegun
coverage==6.4.1 # https://github.com/nedbat/coveragepy
coverage[toml]==6.4.1 # https://github.com/nedbat/coveragepy
django-coverage-plugin==2.0.3
tblib==1.7.0 # https://github.com/ionelmc/python-tblib
# WatchDog
Expand Down
73 changes: 0 additions & 73 deletions setup.cfg

This file was deleted.

0 comments on commit 1c2b1ac

Please sign in to comment.