Skip to content

Commit

Permalink
fix(ci): Replace flake8 with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
last-partizan committed Oct 15, 2023
1 parent 7474599 commit 2061f6c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 68 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
- name: Install linters
run: |
python -m pip install --upgrade pip
pip install flake8 black
pip install ruff==0.0.292 black==23.9.1
- name: Run linters
run: |
flake8 modeltranslation
ruff check modeltranslation
black --check modeltranslation *.py
- name: Test package install
run: |
Expand Down
2 changes: 1 addition & 1 deletion modeltranslation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def autodiscover():
before_import_registry = copy.copy(translator._registry)
try:
import_module(module)
except:
except ImportError:
# Reset the model registry to the state before the last import as
# this import will have to reoccur on the next request and this
# could raise NotRegistered and AlreadyRegistered exceptions
Expand Down
15 changes: 6 additions & 9 deletions modeltranslation/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,9 @@ def test_verbose_name(self):

def test_descriptor_introspection(self):
# See Django #8248
try:
models.TestModel.title
models.TestModel.title.__doc__
assert True
except:
self.fail('Descriptor accessed on class should return itself.')
assert isinstance(
models.TestModel.title.__doc__, str
), 'Descriptor accessed on class should return itself.'

def test_fields_hashes(self):
opts = models.TestModel._meta
Expand Down Expand Up @@ -2212,9 +2209,9 @@ def test_abstract_inheritance(self):
assert 'titleb' in field_names_b
assert 'titleb_de' in field_names_b
assert 'titleb_en' in field_names_b
assert not ('titled' in field_names_b)
assert not ('titled_de' in field_names_b)
assert not ('titled_en' in field_names_b)
assert 'titled' not in field_names_b
assert 'titled_de' not in field_names_b
assert 'titled_en' not in field_names_b

def test_multitable_inheritance(self):
field_names_a = get_field_names(models.MultitableModelA)
Expand Down
77 changes: 27 additions & 50 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ packages = [
[tool.poetry.dependencies]
python = ">=3.8,<4"
django = ">=3.2"
ruff = "^0.0.292"

[tool.poetry.dev-dependencies]
pdbpp = "*"
flake8 = "*"
black = "*"
parameterized = "*"
pytest-cov = "*"
Expand All @@ -27,8 +27,9 @@ django-types = "*"
line-length = 100
skip-string-normalization = true

[tool.isort]
line_length = 100
multi_line_output = 3
skip_gitignore = true
include_trailing_comma = true
[tool.ruff]
line-length = 100
target-version = "py38"
ignore = [
"E501", # line length is handled by black
]

0 comments on commit 2061f6c

Please sign in to comment.