GitHub
08/06/2024, 2:21 PMflakeheaven, pyupgrade, and isort with ruff
Issue created by WillDaSilva
@Edgar Ramírez (Arch.dev) has proven Ruff's value and suitability across several repositories within the Meltano GitHub org.
We should be able to use it to replace flakeheaven, pyupgrade, and isort within the Meltano repository. This should significantly reduce the amount of time it takes for our linters to run. Additionally this will increase the number of lint issues which can be auto-fixed, and will significantly reduce the number of dev dependencies we have.
Some of the Flake8/Flakeheaven lint plugins we use are not yet supported by Ruff:
• flake8-broken-line, but Black handles this.
• flake8-rst-docstrings, but we use Markdown docstrings.
• flake8-string-format, but we primarily use f-strings instead of str.format. We use str.format in 4 places, and all of those should be switched to use f-strings instead (because they aren't using an str.format-exclusive features like unpacking an argument list into the format string).
• flake8-typing-as-t. We may want to open an issue https://github.com/charliermarsh/ruff requesting support for this flake8 plugin. flake8-import-conventions is supported, but it doesn't affect from ... import ... style import statements, only import module as bad_alias.
• wemake-python-styleguide. Personally I'm okay with losing the WPS lint rules. I find that they're just as likely to be detrimental to the quality of the code as they are to improve it. We have 452 noqa comments within this repository, and 344 of them are for WPS rules. Of the 136 disabled lint rules within pyproject.toml, 98 of them are WPS rules. There are definitely plenty of good rules we'd be losing, but the most important/impactful rules tend to find their way into other flake8 plugins and related tools.
We'll lose the Flakeheaven baseline (see astral-sh/ruff#1149), but Ruff can add noqa comments using the --add-noqa, so once we've switched over and addressed every new lint issue uncovered that we want to address, we can easily add a noqa comment to the remaining ones. This adds some visual noise compared to a baseline file, but has the benefit of being explicit about what rules are being ignored and where.
Ruff can also automatically remove unused noqa comments, which will make this transition easier since it saves us from having to go through 452 existing noqa comments to see which ones are no longer necessary 😅
Ruff rule classes to enable:
The content you are editing has changed. Please copy your edits and refresh the page.
Title of tasklist
Cancel Save
Tasks
Edit tasklist title
Beta Give feedback Tasklist Tasks, more options
• Rename
• Copy markdown
• Delete tasklist
Delete tasklist
Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
Cancel Delete
1. `"A", # flake8-builtins`: https://github.com/meltano/meltano/pull/8605
`"A", # flake8-builtins`: https://github.com/meltano/meltano/pull/8605
`"A", # flake8-builtins`: #8605
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
2. `"ANN", # flake8-annotations`: https://github.com/meltano/meltano/pull/8678
`"ANN", # flake8-annotations`: https://github.com/meltano/meltano/pull/8678
`"ANN", # flake8-annotations`: #8678
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
3. `"ARG", # flake8-unused-arguments`: https://github.com/meltano/meltano/pull/8047
`"ARG", # flake8-unused-arguments`: https://github.com/meltano/meltano/pull/8047
`"ARG", # flake8-unused-arguments`: #8047
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
4. `"B", # flake8-bugbear`: https://github.com/meltano/meltano/pull/7445
`"B", # flake8-bugbear`: https://github.com/meltano/meltano/pull/7445
`"B", # flake8-bugbear`: #7445
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
5. `"C4", # flake8-comprehensions`: https://github.com/meltano/meltano/pull/7444
`"C4", # flake8-comprehensions`: https://github.com/meltano/meltano/pull/7444
`"C4", # flake8-comprehensions`: #7444
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
6. `"COM", # flake8-commas`: https://github.com/meltano/meltano/pull/7435
`"COM", # flake8-commas`: https://github.com/meltano/meltano/pull/7435
`"COM", # flake8-commas`: #7435
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
7. `"D", # pydocstyle/flake8-docstrings`: https://github.com/meltano/meltano/pull/8679
`"D", # pydocstyle/flake8-docstrings`: https://github.com/meltano/meltano/pull/8679
`"D", # pydocstyle/flake8-docstrings`: #8679
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
8. `"DTZ", # flake8-datetime`: https://github.com/meltano/meltano/pull/8265
`"DTZ", # flake8-datetime`: https://github.com/meltano/meltano/pull/8265
`"DTZ", # flake8-datetime`: #8265
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
9. `"E", # pycodestyle (error)`: https://github.com/meltano/meltano/pull/7401/
`"E", # pycodestyle (error)`: https://github.com/meltano/meltano/pull/7401/
`"E", # pycodestyle (error)`: #7401
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
10. `"EM", # flake8-errmsg`: https://github.com/meltano/meltano/pull/8445
`"EM", # flake8-errmsg`: https://github.com/meltano/meltano/pull/8445
`"EM", # flake8-errmsg`: #8445
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
11. `"F", # pyflakes`: https://github.com/meltano/meltano/pull/7401/
`"F", # pyflakes`: https://github.com/meltano/meltano/pull/7401/
`"F", # pyflakes`: #7401
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully updated the issue's project
There was an error updating the issue's project
12. `"FBT", # flake8-boolean-trap`: https://github.com/meltano/meltano/pull/8677
`"FBT", # flake8-boolean-trap`: https://github.com/meltano/meltano/pull/8677
`"FBT", # flake8-boolean-trap`: #8677
Options
• Convert to issue
• Toggle completion
• Rename
• Remove
Successfully upd…
meltano/meltanoGitHub
08/06/2024, 2:21 PMflakeheaven, pyupgrade, and isort with ruff
Issue closed as completed by WillDaSilva
meltano/meltano