Skip to content

Commit

Permalink
Add a README link to each plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Nov 5, 2022
1 parent 2727e5f commit bb6c9ab
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 38 deletions.
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,17 @@ Read the [launch blog post](https://notes.crmarsh.com/python-tooling-could-be-mu
2. [Configuration](#configuration)
3. [Supported Rules](#supported-rules)
1. [Pyflakes](#pyflakes)
2. [pycodestyle (error)](#pycodestyle-error)
3. [pycodestyle (warning)](#pycodestyle-warning)
4. [pydocstyle](#pydocstyle)
5. [pyupgrade](#pyupgrade)
6. [pep8-naming](#pep8-naming)
7. [flake8-comprehensions](#flake8-comprehensions)
8. [flake8-bugbear](#flake8-bugbear)
9. [flake8-builtins](#flake8-builtins)
10. [flake8-print](#flake8-print)
11. [flake8-quotes](#flake8-quotes)
12. [Ruff-specific rules](#ruff-specific-rules)
13. [Meta rules](#meta-rules)
2. [pycodestyle)](#pycodestyle)
3. [pydocstyle](#pydocstyle)
4. [pyupgrade](#pyupgrade)
5. [pep8-naming](#pep8-naming)
6. [flake8-comprehensions](#flake8-comprehensions)
7. [flake8-bugbear](#flake8-bugbear)
8. [flake8-builtins](#flake8-builtins)
9. [flake8-print](#flake8-print)
10. [flake8-quotes](#flake8-quotes)
11. [Ruff-specific rules](#ruff-specific-rules)
12. [Meta rules](#meta-rules)
5. [Editor Integrations](#editor-integrations)
6. [FAQ](#faq)
7. [Development](#development)
Expand Down Expand Up @@ -295,6 +294,8 @@ add `noqa` directives to all failing lines, with the appropriate error codes.**
## Supported Rules
Regardless of the rule's origin, Ruff re-implements every rule in Rust as a first-party feature.

By default, Ruff enables all `E` and `F` error codes, which correspond to those built-in to Flake8.

The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` command-line option.
Expand Down Expand Up @@ -335,7 +336,9 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| F841 | UnusedVariable | Local variable `...` is assigned to but never used | |
| F901 | RaiseNotImplemented | `raise NotImplemented` should be `raise NotImplementedError` | 🛠 |

### pycodestyle (error)
For more, see [Pyflakes](https://pypi.org/project/pyflakes/2.5.0/) on PyPI.

### pycodestyle

| Coade | Name | Message | Fix |
| ---- | ---- | ------- | --- |
Expand All @@ -353,14 +356,11 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| E743 | AmbiguousFunctionName | Ambiguous function name: `...` | |
| E902 | IOError | IOError: `...` | |
| E999 | SyntaxError | SyntaxError: `...` | |
### pycodestyle (warning)
| Coade | Name | Message | Fix |
| ---- | ---- | ------- | --- |
| W292 | NoNewLineAtEndOfFile | No newline at end of file | |
| W605 | InvalidEscapeSequence | Invalid escape sequence: '\c' | |
For more, see [pycodestyle](https://pypi.org/project/pycodestyle/2.9.1/) on PyPI.
### pydocstyle
| Coade | Name | Message | Fix |
Expand Down Expand Up @@ -410,6 +410,8 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| D418 | SkipDocstring | Function decorated with `@overload` shouldn't contain a docstring | |
| D419 | NonEmpty | Docstring is empty | |
For more, see [pydocstyle](https://pypi.org/project/pydocstyle/6.1.1/) on PyPI.
### pyupgrade
| Coade | Name | Message | Fix |
Expand All @@ -423,6 +425,8 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| U007 | UsePEP604Annotation | Use `X \| Y` for type annotations | 🛠 |
| U008 | SuperCallWithParameters | Use `super()` instead of `super(__class__, self)` | 🛠 |
For more, see [pyupgrade](https://pypi.org/project/pyupgrade/3.2.0/) on PyPI.
### pep8-naming
| Coade | Name | Message | Fix |
Expand All @@ -443,6 +447,8 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| N817 | CamelcaseImportedAsAcronym | Camelcase `...` imported as acronym `...` | |
| N818 | ErrorSuffixOnExceptionName | Exception name `...` should be named with an Error suffix | |
For more, see [pep8-naming](https://pypi.org/project/pep8-naming/0.13.2/) on PyPI.
### flake8-comprehensions
| Coade | Name | Message | Fix |
Expand All @@ -464,6 +470,8 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| C416 | UnnecessaryComprehension | Unnecessary `(list\|set)` comprehension (rewrite using `(list\|set)()`) | 🛠 |
| C417 | UnnecessaryMap | Unnecessary `map` usage (rewrite using a `(list\|set\|dict)` comprehension) | |
For more, see [flake8-comprehensions](https://pypi.org/project/flake8-comprehensions/3.10.1/) on PyPI.
### flake8-bugbear
| Coade | Name | Message | Fix |
Expand All @@ -482,6 +490,8 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| B018 | UselessExpression | Found useless expression. Either assign it to a variable or remove it. | |
| B025 | DuplicateTryBlockException | try-except block with duplicate exception `Exception` | |
For more, see [flake8-bugbear](https://pypi.org/project/flake8-bugbear/22.10.27/) on PyPI.
### flake8-builtins
| Coade | Name | Message | Fix |
Expand All @@ -490,13 +500,17 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| A002 | BuiltinArgumentShadowing | Argument `...` is shadowing a python builtin | |
| A003 | BuiltinAttributeShadowing | Class attribute `...` is shadowing a python builtin | |
For more, see [flake8-builtins](https://pypi.org/project/flake8-builtins/2.0.1/) on PyPI.
### flake8-print
| Coade | Name | Message | Fix |
| ---- | ---- | ------- | --- |
| T201 | PrintFound | `print` found | 🛠 |
| T203 | PPrintFound | `pprint` found | 🛠 |
For more, see [flake8-print](https://pypi.org/project/flake8-print/5.0.0/) on PyPI.
### flake8-quotes
| Coade | Name | Message | Fix |
Expand All @@ -506,6 +520,8 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com
| Q002 | BadQuotesDocstring | Single quote docstring found but double quotes preferred | |
| Q003 | AvoidQuoteEscape | Change outer quotes to avoid escaping inner quotes | |
For more, see [flake8-quotes](https://pypi.org/project/flake8-quotes/3.3.1/) on PyPI.
### Ruff-specific rules
| Coade | Name | Message | Fix |
Expand Down
10 changes: 10 additions & 0 deletions ruff_dev/src/generate_rules_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ pub fn main(cli: &Cli) -> Result<()> {
}
}
output.push('\n');

if let Some(url) = check_category.url() {
output.push_str(&format!(
"For more, see [{}]({}) on PyPI.",
check_category.title(),
url
));
output.push('\n');
output.push('\n');
}
}

if cli.dry_run {
Expand Down
61 changes: 41 additions & 20 deletions src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ pub enum CheckCode {
#[derive(EnumIter, Debug, PartialEq, Eq)]
pub enum CheckCategory {
Pyflakes,
PycodestyleError,
PycodestyleWarning,
Pycodestyle,
Pydocstyle,
Pyupgrade,
PEP8Naming,
Expand All @@ -212,8 +211,7 @@ pub enum CheckCategory {
impl CheckCategory {
pub fn title(&self) -> &'static str {
match self {
CheckCategory::PycodestyleError => "pycodestyle (error)",
CheckCategory::PycodestyleWarning => "pycodestyle (warning)",
CheckCategory::Pycodestyle => "pycodestyle",
CheckCategory::Pyflakes => "Pyflakes",
CheckCategory::Flake8Builtins => "flake8-builtins",
CheckCategory::Flake8Bugbear => "flake8-bugbear",
Expand All @@ -227,6 +225,29 @@ impl CheckCategory {
CheckCategory::Meta => "Meta rules",
}
}

pub fn url(&self) -> Option<&'static str> {
match self {
CheckCategory::Pycodestyle => Some("https://pypi.org/project/pycodestyle/2.9.1/"),
CheckCategory::Pyflakes => Some("https://pypi.org/project/pyflakes/2.5.0/"),
CheckCategory::Flake8Builtins => {
Some("https://pypi.org/project/flake8-builtins/2.0.1/")
}
CheckCategory::Flake8Bugbear => {
Some("https://pypi.org/project/flake8-bugbear/22.10.27/")
}
CheckCategory::Flake8Comprehensions => {
Some("https://pypi.org/project/flake8-comprehensions/3.10.1/")
}
CheckCategory::Flake8Print => Some("https://pypi.org/project/flake8-print/5.0.0/"),
CheckCategory::Flake8Quotes => Some("https://pypi.org/project/flake8-quotes/3.3.1/"),
CheckCategory::Pyupgrade => Some("https://pypi.org/project/pyupgrade/3.2.0/"),
CheckCategory::Pydocstyle => Some("https://pypi.org/project/pydocstyle/6.1.1/"),
CheckCategory::PEP8Naming => Some("https://pypi.org/project/pep8-naming/0.13.2/"),
CheckCategory::Ruff => None,
CheckCategory::Meta => None,
}
}
}

#[allow(clippy::upper_case_acronyms)]
Expand Down Expand Up @@ -639,22 +660,22 @@ impl CheckCode {

pub fn category(&self) -> CheckCategory {
match self {
CheckCode::E402 => CheckCategory::PycodestyleError,
CheckCode::E501 => CheckCategory::PycodestyleError,
CheckCode::E711 => CheckCategory::PycodestyleError,
CheckCode::E712 => CheckCategory::PycodestyleError,
CheckCode::E713 => CheckCategory::PycodestyleError,
CheckCode::E714 => CheckCategory::PycodestyleError,
CheckCode::E721 => CheckCategory::PycodestyleError,
CheckCode::E722 => CheckCategory::PycodestyleError,
CheckCode::E731 => CheckCategory::PycodestyleError,
CheckCode::E741 => CheckCategory::PycodestyleError,
CheckCode::E742 => CheckCategory::PycodestyleError,
CheckCode::E743 => CheckCategory::PycodestyleError,
CheckCode::E902 => CheckCategory::PycodestyleError,
CheckCode::E999 => CheckCategory::PycodestyleError,
CheckCode::W292 => CheckCategory::PycodestyleWarning,
CheckCode::W605 => CheckCategory::PycodestyleWarning,
CheckCode::E402 => CheckCategory::Pycodestyle,
CheckCode::E501 => CheckCategory::Pycodestyle,
CheckCode::E711 => CheckCategory::Pycodestyle,
CheckCode::E712 => CheckCategory::Pycodestyle,
CheckCode::E713 => CheckCategory::Pycodestyle,
CheckCode::E714 => CheckCategory::Pycodestyle,
CheckCode::E721 => CheckCategory::Pycodestyle,
CheckCode::E722 => CheckCategory::Pycodestyle,
CheckCode::E731 => CheckCategory::Pycodestyle,
CheckCode::E741 => CheckCategory::Pycodestyle,
CheckCode::E742 => CheckCategory::Pycodestyle,
CheckCode::E743 => CheckCategory::Pycodestyle,
CheckCode::E902 => CheckCategory::Pycodestyle,
CheckCode::E999 => CheckCategory::Pycodestyle,
CheckCode::W292 => CheckCategory::Pycodestyle,
CheckCode::W605 => CheckCategory::Pycodestyle,
CheckCode::F401 => CheckCategory::Pyflakes,
CheckCode::F402 => CheckCategory::Pyflakes,
CheckCode::F403 => CheckCategory::Pyflakes,
Expand Down

0 comments on commit bb6c9ab

Please sign in to comment.