Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Tweaks
  • Loading branch information
charliermarsh committed May 16, 2024
commit ccd873340f5badf6ed8c9f4cf4512ae531d55c83
14 changes: 7 additions & 7 deletions crates/ruff_linter/src/rules/pylint/rules/too_many_branches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use ruff_macros::{derive_message_formats, violation};
use ruff_python_ast::identifier::Identifier;

/// ## What it does
/// Checks for functions or methods with too many branches,
/// including (nested) `if`, `elif`, `else`, `for` loops,
/// `try`/`except` clauses and `match`/`case` statements.
/// Checks for functions or methods with too many branches, including (nested)
/// `if`, `elif`, and `else` branches, `for` loops, `try`-`except` clauses, and
/// `match` and `case` statements.
///
/// By default, this rule allows up to 12 branches. This can be configured
/// using the [`lint.pylint.max-branches`] option.
Expand All @@ -17,7 +17,7 @@ use ruff_python_ast::identifier::Identifier;
/// and maintain than functions or methods with fewer branches.
///
/// ## Example
/// Instead of:
/// Given:
/// ```python
/// def capital(country):
Comment thread
jaap3 marked this conversation as resolved.
/// if country == "Australia":
Expand Down Expand Up @@ -48,7 +48,7 @@ use ruff_python_ast::identifier::Identifier;
/// return "Unknown" # 13th branch
/// ```
///
/// Use:
/// Use instead:
/// ```python
/// def capital(country):
/// capitals = {
Expand All @@ -69,7 +69,7 @@ use ruff_python_ast::identifier::Identifier;
/// return city
/// ```
///
/// Instead of:
/// Given:
/// ```python
/// def grades_to_average_number(grades):
/// numbers = []
Expand Down Expand Up @@ -109,7 +109,7 @@ use ruff_python_ast::identifier::Identifier;
/// return 0
/// ```
///
/// Use:
/// Use instead:
/// ```python
/// def grades_to_average_number(grades):
/// grade_values = {"F": 0.0, "E": 0.0, "D": 1.0, "C": 2.0, "B": 3.0, "A": 4.0}
Expand Down