Commit Graph

11656 Commits

Author SHA1 Message Date
Martin Fischer 53e3dd8548 Add ignore-overlong-task-comments setting
Imagine a .py file containing the following comment:

    # TODO: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
    # do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Since `git grep` only matches individual lines `git grep TODO` would
only output the first line of the comment, cutting off potentially
important information. (git grep currently doesn't support multiline
grepping). Projects using such a workflow therefore probably format
the comment in a single line instead:

    # TODO: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

This commit introduces a setting to accomdate this workflow by making
the line-length checks (`E501`) optionally ignore overlong lines
if they start with a recognized task tag.

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2023-01-04 23:54:50 -05:00
Martin Fischer 78c9056173 Add pycodestyle::settings
This step is split up into a separate commit so
that the following commit has a cleaner diff.
2023-01-04 23:54:50 -05:00
Martin Fischer 8d56e412ef Add task-tags setting
Programmers often leave comments to themselves and others such as:

    # TODO: Use a faster algorithm?

The keywords used to prefix such comments are just a convention and vary
from project to project. Other common keywords include FIXME and HACK.

The keywords in use for the codebase are of interest to ruff because
ruff does also lint comments. For example the ERA lint detects
commented-out code but ignores comments starting with such a keyword.
Previously the ERA lint simply hardcoded the regular expression
TODO|FIXME|XXX to achieve that. This commit introduces a new `task-tags`
setting to make this configurable (and to allow other comment lints to
recognize the same set of keywords).

The term "task tags" has probably been popularized by the Eclipse
IDE.[1] For Python there has been the proposal PEP 350[2], which
referred to such keywords as "codetags". That proposal however has been
rejected. We are choosing the term "task tags" over "code tags" because
the former is more descriptive: a task tag describes a task.

While according to the PEP 350 such keywords are also sometimes used for
non-tasks e.g. NOBUG to describe a well-known problem that will never be
addressed due to design problems or domain limitations, such keywords
are so rare that we are neglecting them here in favor of more
descriptive terminology. The vast majority of such keywords does
describe tasks, so naming the setting "task-tags" is apt.

[1]: https://www.eclipse.org/pdt/help/html/task_tags.htm
[2]: https://peps.python.org/pep-0350/

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2023-01-04 23:54:50 -05:00
Charlie Marsh 3400be18a6 Revert "Add task-tags & ignore-overlong-task-comments settings (#1550)"
This reverts commit ca48492137.
2023-01-04 23:54:50 -05:00
Charlie Marsh 7b59cd2d32 Bump version to 0.0.211 2023-01-04 23:13:04 -05:00
Charlie Marsh b8ed4d402a
Implement `SIM110` and `SIM111` (conversion to `any` and `all`) (#1653) 2023-01-04 23:08:12 -05:00
messense 46dcf3c4c0
Implement flake8-simplify SIM107 (#1650) 2023-01-04 23:02:25 -05:00
Charlie Marsh ef7777703b Run generation steps 2023-01-04 22:05:04 -05:00
messense 6a1edeb694
Cancel outdated in-progress workflow automatically (#1652) 2023-01-04 22:03:26 -05:00
Charlie Marsh fb8024a6ac
Implement nested with detection (SIM117) (#1651) 2023-01-04 21:22:25 -05:00
Edgar R. M 2f71bdfbfc
Implement flake8-bandit rule `S108` (#1644) 2023-01-04 21:11:13 -05:00
Charlie Marsh 30d6688c26
Implement nested-if detection (#1649) 2023-01-04 20:55:01 -05:00
Charlie Marsh 9041423b92
Move external licenses to separate directory (#1648) 2023-01-04 20:07:51 -05:00
Charlie Marsh c91c435dc9 Fix URL in pyproject.toml 2023-01-04 19:23:40 -05:00
Charlie Marsh 5cb162bd7b Add missing McCabe comment 2023-01-04 19:16:36 -05:00
Charlie Marsh 7339d7eccf
Implement builtin import removal (#1645) 2023-01-04 19:10:16 -05:00
Charlie Marsh 2ff816f108
DRY up unused import removal code (#1643) 2023-01-04 19:03:52 -05:00
Charlie Marsh 980d10b952
Add Ruff badge to README (#1642) 2023-01-04 17:27:01 -05:00
Charlie Marsh 6c5db1008d
Add badge JSON (#1641) 2023-01-04 17:24:27 -05:00
Martin Fischer ca48492137
Add task-tags & ignore-overlong-task-comments settings (#1550) 2023-01-04 17:10:21 -05:00
Charlie Marsh 7c23701b62
Note a few more incompatibilities (#1639) 2023-01-04 16:05:15 -05:00
Charlie Marsh 8da2c4815a
Tweak Yoda condition message (#1638) 2023-01-04 15:58:01 -05:00
Charlie Marsh 34fec8cbd0
Rename flake8-bandit rules from plugins to checks (#1637) 2023-01-04 15:49:05 -05:00
Edgar R. M 1817f8752b
Implement flake8-bandit rule `S103` (#1636) 2023-01-04 15:47:38 -05:00
Colin Delahunty 8b8e6e44ea
Adding my company to the "used in" category of the Readme. (#1631) 2023-01-04 12:31:18 -05:00
Harutaka Kawamura 12166584c4
Minor fixes for `SIM105` (#1633) 2023-01-04 11:01:06 -05:00
Charlie Marsh 9ede902328 Run generate-all 2023-01-04 10:46:24 -05:00
messense 0df28bdd4e
Implement flake8-simplify SIM105 rule (#1621) 2023-01-04 08:10:59 -05:00
Charlie Marsh 8b07f9517a
Implement `SIM220` and `SIM221` (#1630) 2023-01-04 08:07:00 -05:00
Harutaka Kawamura 0a0e1926f2
Check `SIM118` in comprehension (#1627) 2023-01-04 07:05:13 -05:00
Charlie Marsh 4473c7e905 Update stale references in CONTRIBUTING.md 2023-01-03 23:44:10 -05:00
Charlie Marsh 20930b3675
Add some more users to the README (#1623) 2023-01-03 23:06:08 -05:00
Colin Delahunty fb1a638a96
Implement `yield`-to-`yield from` conversion (#1544) 2023-01-03 22:56:52 -05:00
Edgar R. M 16964409a8
Implement missing fixes for `PT006` (#1622) 2023-01-03 22:52:51 -05:00
Charlie Marsh aacfc9ee0b Bump version to 0.0.210 2023-01-03 21:46:08 -05:00
Charlie Marsh bd14f92898
Avoid byte-string conversions (#1618) 2023-01-03 21:45:14 -05:00
Charlie Marsh cc116b0192
Treat convention as setting ignore, rather than select (#1611) 2023-01-03 21:27:53 -05:00
Charlie Marsh 0d27c0be27
Treat .pyi files as __future__ annotations-enabled (#1616) 2023-01-03 21:27:26 -05:00
Edgar R. M 60359c6adf
Fix leftover whitespace when removing `pass` for `PIE790` (#1612) 2023-01-03 20:44:59 -05:00
Charlie Marsh 77692e4b5f
Associate inline comments with parenthesized `ImportFrom` statements (#1609) 2023-01-03 20:02:12 -05:00
Charlie Marsh 731f3a74a9
Fix *arg and **kwarg handling for Google docstrings (#1608) 2023-01-03 18:17:42 -05:00
Matt Oberle 03275c9c98
Add isort.order-by-type boolean setting (#1607) 2023-01-03 18:07:44 -05:00
Harutaka Kawamura 8d99e317b8
Implement autofix for `PT022` (#1604) 2023-01-03 13:36:28 -05:00
Maksudul Haque d4d67e3014
Do not Change Quotation Style for `PT006` Autofix (#1600) 2023-01-03 10:16:49 -05:00
Charlie Marsh e9a236f740 Bump version to 0.0.209 2023-01-03 08:27:28 -05:00
Ran Benita ebb31dc29b
Fix PT006 autofix of parametrize name strings like `' first, , second '` (#1591) 2023-01-03 08:12:09 -05:00
Charlie Marsh b9e92affb1
Avoid silently dropping code generator errors (#1598) 2023-01-03 08:11:18 -05:00
Charlie Marsh 68fbd0f029
Preserve style when generating flake8-simplify messages (#1599) 2023-01-03 08:05:55 -05:00
Charlie Marsh 8d01efb571
Avoid hard unwrap in PT checks (#1597) 2023-01-03 07:39:52 -05:00
Pedram Navid da5a25b421
Add autofix for SIM300 (#1588) 2023-01-03 07:19:04 -05:00