Skip to content

Commit

Permalink
Remove the deprecated E999 rule code
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Nov 18, 2024
1 parent 7a94216 commit c239464
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 64 deletions.
21 changes: 0 additions & 21 deletions crates/ruff/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,27 +859,6 @@ fn parse_error_not_included() {
");
}

#[test]
fn deprecated_parse_error_selection() {
let mut cmd = RuffCheck::default().args(["--select=E999"]).build();
assert_cmd_snapshot!(cmd
.pass_stdin("foo =\n"), @r"
success: false
exit_code: 1
----- stdout -----
-:1:6: SyntaxError: Expected an expression
|
1 | foo =
| ^
|
Found 1 error.
----- stderr -----
warning: Rule `E999` is deprecated and will be removed in a future release. Syntax errors will always be shown regardless of whether this rule is selected or not.
");
}

#[test]
fn full_output_preview() {
let mut cmd = RuffCheck::default().args(["--preview"]).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ linter.rules.enabled = [
ambiguous-class-name (E742),
ambiguous-function-name (E743),
io-error (E902),
syntax-error (E999),
unused-import (F401),
import-shadowed-by-loop-var (F402),
undefined-local-with-import-star (F403),
Expand Down Expand Up @@ -150,7 +149,6 @@ linter.rules.should_fix = [
ambiguous-class-name (E742),
ambiguous-function-name (E743),
io-error (E902),
syntax-error (E999),
unused-import (F401),
import-shadowed-by-loop-var (F402),
undefined-local-with-import-star (F403),
Expand Down
1 change: 0 additions & 1 deletion crates/ruff_linter/src/codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
(Pycodestyle, "E742") => (RuleGroup::Stable, rules::pycodestyle::rules::AmbiguousClassName),
(Pycodestyle, "E743") => (RuleGroup::Stable, rules::pycodestyle::rules::AmbiguousFunctionName),
(Pycodestyle, "E902") => (RuleGroup::Stable, rules::pycodestyle::rules::IOError),
(Pycodestyle, "E999") => (RuleGroup::Deprecated, rules::pycodestyle::rules::SyntaxError),

// pycodestyle warnings
(Pycodestyle, "W191") => (RuleGroup::Stable, rules::pycodestyle::rules::TabIndentation),
Expand Down
36 changes: 0 additions & 36 deletions crates/ruff_linter/src/rules/pycodestyle/rules/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,3 @@ impl Violation for IOError {
format!("{message}")
}
}

/// ## Deprecated
/// This rule has been deprecated and will be removed in a future release. Syntax errors will
/// always be shown regardless of whether this rule is selected or not.
///
/// ## What it does
/// Checks for code that contains syntax errors.
///
/// ## Why is this bad?
/// Code with syntax errors cannot be executed. Such errors are likely a
/// mistake.
///
/// ## Example
/// ```python
/// x =
/// ```
///
/// Use instead:
/// ```python
/// x = 1
/// ```
///
/// ## References
/// - [Python documentation: Syntax Errors](https://docs.python.org/3/tutorial/errors.html#syntax-errors)
#[violation]
pub struct SyntaxError {
pub message: String,
}

impl Violation for SyntaxError {
#[derive_message_formats]
fn message(&self) -> String {
let SyntaxError { message } = self;
format!("SyntaxError: {message}")
}
}
1 change: 0 additions & 1 deletion crates/ruff_linter/src/rules/pycodestyle/rules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub(crate) use blank_lines::*;
pub(crate) use compound_statements::*;
pub(crate) use doc_line_too_long::*;
pub use errors::IOError;
pub(crate) use errors::*;
pub(crate) use invalid_escape_sequence::*;
pub(crate) use lambda_assignment::*;
pub(crate) use line_too_long::*;
Expand Down
1 change: 0 additions & 1 deletion crates/ruff_workspace/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1613,7 +1613,6 @@ mod tests {
Rule::AmbiguousClassName,
Rule::AmbiguousFunctionName,
Rule::IOError,
Rule::SyntaxError,
Rule::TabIndentation,
Rule::TrailingWhitespace,
Rule::MissingNewlineAtEndOfFile,
Expand Down
2 changes: 0 additions & 2 deletions ruff.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c239464

Please sign in to comment.