Skip to content

Commit

Permalink
style(pre-commit): obey rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehr-akbarzadeh committed Dec 5, 2024
1 parent d540e16 commit 3315ab1
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
env:
DJANGO_SETTINGS_MODULE: tests.testapp.settings.settings
PYTHONPATH: ${{ github.workspace }}

strategy:
matrix:
python-version:
Expand All @@ -19,7 +19,7 @@ jobs:
- '3.10'
- '3.11'
- '3.12'

steps:
- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
- id: ruff
args: ["--config=pyproject.toml"]
exclude: (migrations/|tests/|docs/|static/|media/|apps.py).*

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
Expand Down Expand Up @@ -98,4 +98,4 @@ repos:
types: [ python ]
stages: [ commit ]
pass_filenames: false
always_run: true
always_run: true
12 changes: 9 additions & 3 deletions iranian_cities/mixins/dynamic_permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@

class IranianCitiesAdminReadOnlyEnabled:
def has_add_permission(self, request):
return not sage_iranian_cities_settings.IRANIAN_CITIES_ADMIN_ADD_READONLY_ENABLED
return (
not sage_iranian_cities_settings.IRANIAN_CITIES_ADMIN_ADD_READONLY_ENABLED
)

def has_delete_permission(self, request, obj=None):
return not sage_iranian_cities_settings.IRANIAN_CITIES_ADMIN_DELETE_READONLY_ENABLED
return (
not sage_iranian_cities_settings.IRANIAN_CITIES_ADMIN_DELETE_READONLY_ENABLED
)

def has_change_permission(self, request, obj=None):
return not sage_iranian_cities_settings.IRANIAN_CITIES_ADMIN_CHANGE_READONLY_ENABLED
return (
not sage_iranian_cities_settings.IRANIAN_CITIES_ADMIN_CHANGE_READONLY_ENABLED
)


class DynamicInlineAdmin:
Expand Down
40 changes: 20 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,11 @@ pylint = "^3.2.6"
pylint-django = "^2.5.5"
docformatter = "^1.7.5"
commitizen = "^3.28.0"
bandit = {extras = ["toml"], version = "^1.7.9"}
bandit = { extras = [ "toml" ], version = "^1.7.9" }
poetry-plugin-export = "^1.8.0"
django-debug-toolbar = "^4.4.6"
django-migration-linter = "^5.1.0"

[tool.bandit]
targets = ["./iranian_cities"]
exclude_dirs = [
"tests",
"migrations",
]
severity = "medium"
confidence = "medium"
max_lines = 500
progress = true
reports = true
output_format = "screen"
output_file = "bandit_report.txt"
include = ["B101", "B102"]
exclude_tests = ["B301", "B302"]

[tool.bandit.plugins]
B104 = { check_typed_list = true }

[tool.black]
line-length = 88
exclude = '''
Expand Down Expand Up @@ -249,6 +230,25 @@ exclude = '''
^kernel/
'''

[tool.bandit]
targets = [ "./iranian_cities" ]
exclude_dirs = [
"tests",
"migrations",
]
severity = "medium"
confidence = "medium"
max_lines = 500
progress = true
reports = true
output_format = "screen"
output_file = "bandit_report.txt"
include = [ "B101", "B102" ]
exclude_tests = [ "B301", "B302" ]

[tool.bandit.plugins]
B104 = { check_typed_list = true }

[tool.commitizen]
name = "cz_conventional_commits"
version = "0.1.0"
Expand Down

0 comments on commit 3315ab1

Please sign in to comment.