Skip to content

Pre-commit: Add Python linter Ruff#778

Merged
cclauss merged 1 commit into
celery:mainfrom
cclauss:add-ruff-to-pre-commit
Aug 7, 2024
Merged

Pre-commit: Add Python linter Ruff#778
cclauss merged 1 commit into
celery:mainfrom
cclauss:add-ruff-to-pre-commit

Conversation

@cclauss

@cclauss cclauss commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

@cclauss cclauss force-pushed the add-ruff-to-pre-commit branch from e8c2e26 to 27b95b1 Compare July 30, 2024 15:52
_ = self._modules
tasks = list(sorted(name for name in self.celery_app.tasks
if not name.startswith('celery.')))
tasks = sorted(name for name in self.celery_app.tasks

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not fully sure about this change

@cclauss cclauss Jul 31, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unnecessary to use list() around sorted(), as the latter already returns a list.

Running the following on the commandline...

% pipx run ruff rule C413

unnecessary-call-around-sorted (C413)

Derived from the flake8-comprehensions linter.

Fix is always available.

What it does

Checks for unnecessary list or reversed calls around sorted
calls.

Why is this bad?

It is unnecessary to use list around sorted, as the latter already
returns a list.

[ ... ]

@cclauss cclauss requested a review from auvipy July 31, 2024 08:41
@cclauss cclauss requested review from Nusnus and thedrow August 2, 2024 11:33
@cclauss cclauss merged commit a87c9f6 into celery:main Aug 7, 2024
@cclauss cclauss deleted the add-ruff-to-pre-commit branch August 7, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants