Skip to content

Commit 2d3b70d

Browse files
committed
Prefer ruff over black, flake8, and isort
1 parent 5082d89 commit 2d3b70d

13 files changed

Lines changed: 46 additions & 218 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
repos:
2-
- repo: https://github.com/python/black
3-
rev: 25.1.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.11.9
45
hooks:
5-
- id: black
6-
- repo: https://github.com/PyCQA/isort
7-
rev: 6.0.1
8-
hooks:
9-
- id: isort
10-
- repo: https://github.com/pycqa/flake8
11-
rev: 7.2.0
12-
hooks:
13-
- id: flake8
6+
# Run the linter.
7+
- id: ruff
8+
args: [ --fix ]
9+
# Run the formatter.
10+
- id: ruff-format
1411
- repo: https://github.com/jackdewinter/pymarkdown
1512
rev: v0.9.29
1613
hooks:

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,15 @@ exclude = [
6060
"**/*.py[co]"
6161
]
6262

63+
[dependency-groups]
64+
dev = [
65+
"ruff>=0.11.9",
66+
]
67+
6368
[project.optional-dependencies]
6469
testing = [
6570
"responses==0.25.7",
6671
]
6772
dev = [
68-
"black==25.1.0",
69-
"flake8==7.2.0",
70-
"isort==6.0.1",
7173
"pre-commit>=4.2.0",
7274
]

src/wagtail_wordpress_import/importers/wordpress.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def run(self, *args, **kwargs):
111111
item.get("wp:post_type") in kwargs["page_types"]
112112
and item.get("wp:status") in kwargs["page_statuses"]
113113
):
114-
115114
wordpress_item = WordpressItem(item, self.logger)
116115

117116
try:
@@ -257,7 +256,6 @@ def analyze_html(self, html_analyzer, *, page_types, page_statuses):
257256
item.get("wp:post_type") in page_types
258257
and item.get("wp:status") in page_statuses
259258
):
260-
261259
html_analyzer.analyze(
262260
filter_linebreaks_wp(item.get("content:encoded"))
263261
)

src/wagtail_wordpress_import/management/commands/analyze_xml_content.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class Command(BaseCommand):
10-
1110
help = """Utils to output xml structure to a json file."""
1211

1312
# def __init__(self, *args, **kwargs):

src/wagtail_wordpress_import/management/commands/delete_imported_pages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ def add_arguments(self, parser):
3434
)
3535

3636
def handle(self, *args, **options):
37-
3837
parent = None
3938
pages_to_delete = None
4039

src/wagtail_wordpress_import/management/commands/reduce_xml.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def generate_stats_file(file_path, type_stats):
2020

2121

2222
class Command(BaseCommand):
23-
2423
help = """Utils to reduce xml file size by removing unwanted tags."""
2524

2625
"""
@@ -31,7 +30,6 @@ def add_arguments(self, parser):
3130
parser.add_argument("xml_file", type=str, help="The full path to your xml file")
3231

3332
def get_xml_file(self, xml_file):
34-
3533
if os.path.exists(xml_file):
3634
return xml_file
3735

src/wagtail_wordpress_import/prefilters/handle_shortcodes.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def _wrapper(cls):
2525

2626

2727
class BlockShortcodeHandler:
28-
2928
shortcode_name: str
3029

3130
is_top_level_html_tag = True

src/wagtail_wordpress_import/test/migrations/0001_initial.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class Migration(migrations.Migration):
10-
1110
initial = True
1211

1312
dependencies = [

src/wagtail_wordpress_import/test/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Meta:
2424

2525

2626
class TestPage(WPImportedPageMixin, Page):
27-
2827
body = StreamField(WPImportStreamBlocks, use_json_field=True)
2928

3029
categories = ParentalManyToManyField(Category, blank=True)

src/wagtail_wordpress_import/test/tests/test_commands.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def test_run_with_xml_and_parent_id(self):
7373
WAGTAIL_WORDPRESS_IMPORTER_SOURCE_DOMAIN="http://www.example.com",
7474
)
7575
class TestImportXmlCommandCompletes(TestCase):
76-
7776
fixtures = [
7877
f"{FIXTURES_PATH}/dump.json",
7978
]

0 commit comments

Comments
 (0)