Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 20, 2023
1 parent cdcd6b0 commit f87b227
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ use crate::checkers::logical_lines::LogicalLinesContext;
use crate::rules::pycodestyle::rules::logical_lines::{LogicalLine, LogicalLineToken};

/// ## What it does
/// Checks for unexpected spaces around keyword / parameter equals.
/// Checks for unexpected spaces around the equals sign in a keyword argument.
///
/// ## Why is this bad?
/// Unexpected spaces around keyword / parameter equals makes the code harder to read.
/// According to [PEP 8], there should be no spaces around the equals sign in a
/// keyword argument:
///
/// > Don’t use spaces around the = sign when used to indicate a keyword
/// > argument, or when used to indicate a default value for an unannotated
/// > function parameter.
///
/// ## Example
/// ```python
Expand All @@ -30,6 +35,8 @@ use crate::rules::pycodestyle::rules::logical_lines::{LogicalLine, LogicalLineTo
///
/// foo(bar=1)
/// ```
///
/// [PEP 8]: https://peps.python.org/pep-0008/#whitespace-in-expressions-and-statements
#[violation]
pub struct UnexpectedSpacesAroundKeywordParameterEquals;

Expand All @@ -44,7 +51,12 @@ impl Violation for UnexpectedSpacesAroundKeywordParameterEquals {
/// Checks for missing whitespace around parameter equals.
///
/// ## Why is this bad?
/// Missing whitespace around parameter equals makes the code harder to read.
/// According to [PEP 8], there should be no spaces around the equals sign in a
/// keyword argument:
///
/// > Don’t use spaces around the = sign when used to indicate a keyword
/// > argument, or when used to indicate a default value for an unannotated
/// > function parameter.
///
/// ## Example
/// ```python
Expand Down

0 comments on commit f87b227

Please sign in to comment.