Skip to content

Conversation

@cclauss
Copy link
Collaborator

@cclauss cclauss commented Sep 10, 2023

Ruff supports over 600 lint rules and can be used to replace Flake8 (plus dozens of plugins), isort, pydocstyle, yesqa, eradicate, pyupgrade, and autoflake, all while executing (in Rust) tens or hundreds of times faster than any individual tool.

Manually fix these issues...
% ruff rule E402 # Module level import not at top of file

% ruff --select=E401,E722,E741,F524 .

docs/source/conf.py:13:1: E401 Multiple imports on one line
examples/sc2autosave.py:195:13: E722 Do not use bare `except`
sc2reader/engine/plugins/context.py:266:17: F524 `.format` call is missing argument(s) for placeholder(s): 2
sc2reader/resources.py:1494:13: E741 Ambiguous variable name: `l`
Found 4 errors.

Use ruff --fix to fix these issues...
% ruff --statistics .

4	E731	[*] Do not assign a `lambda` expression, use a `def`
3	F901	[*] `raise NotImplemented` should be `raise NotImplementedError`
2	F601	[*] Dictionary key literal `"file_time"` repeated

% ruff --fix .

Found 9 errors (9 fixed, 0 remaining).

Copy link
Collaborator

@StoicLoofah StoicLoofah left a comment

Choose a reason for hiding this comment

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

TIL ruff

There's one tweak to the contributing guide to make, but I'll do that by hand on top of this change.

Thanks!

@StoicLoofah StoicLoofah merged commit acddc63 into ggtracker:upstream Sep 23, 2023
@cclauss cclauss deleted the ruff branch September 23, 2023 20:56
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