Skip to content

Commit

Permalink
1.2.5 (#147)
Browse files Browse the repository at this point in the history
* Update tips and disable some inspections

* 1.2.4 -> 1.2.5
  • Loading branch information
nbirillo authored Jan 11, 2022
1 parent 4cb028b commit 44cb827
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.4
1.2.5
1 change: 1 addition & 0 deletions hyperstyle/src/python/review/inspectors/flake8/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ ignore=W291, # trailing whitespaces
WPS414, # Forbid tuple unpacking with side-effects. (controversial)
WPS420, # Forbid some python keywords.
WPS421, # Forbid calling some built-in functions.(e.g., print)
WPS427, # Found unreachable code. TODO: Collision with "W0101"
WPS429, # Forbid multiple assignments on the same line.
WPS430, # Forbid nested functions.
WPS431, # Forbid nested classes.
Expand Down
6 changes: 5 additions & 1 deletion hyperstyle/src/python/review/inspectors/flake8/flake8.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
LineLenIssue,
)
from hyperstyle.src.python.review.inspectors.tips import (
get_cohesion_tip, get_cyclomatic_complexity_tip, get_line_len_tip, get_magic_number_tip,
get_augmented_assign_pattern_tip, get_cohesion_tip, get_cyclomatic_complexity_tip, get_line_len_tip,
get_magic_number_tip,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -103,6 +104,9 @@ def parse(cls, output: str) -> List[BaseIssue]:
# Magic number
if origin_class == 'WPS432':
issue_data[IssueData.DESCRIPTION.value] = get_magic_number_tip(description)
# Bad assign pattern
elif origin_class == 'WPS350':
issue_data[IssueData.DESCRIPTION.value] = get_augmented_assign_pattern_tip()
else:
issue_data[IssueData.DESCRIPTION.value] = description
issues.append(CodeIssue(**issue_data))
Expand Down
2 changes: 1 addition & 1 deletion hyperstyle/src/python/review/inspectors/pmd/issue_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
'MethodWithSameNameAsEnclosingClass': IssueType.BEST_PRACTICES,
'MisplacedNullCheck': IssueType.ERROR_PRONE,
'MissingBreakInSwitch': IssueType.ERROR_PRONE,
'MissingSerialVersionUID': IssueType.ERROR_PRONE,
# 'MissingSerialVersionUID': IssueType.ERROR_PRONE,
'MissingStaticMethodInNonInstantiatableClass': IssueType.ERROR_PRONE,
'NonCaseLabelInSwitchStatement': IssueType.BEST_PRACTICES,
'OverrideBothEqualsAndHashcode': IssueType.ERROR_PRONE,
Expand Down
9 changes: 9 additions & 0 deletions hyperstyle/src/python/review/inspectors/tips.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def get_weighted_method_tip() -> str:
)


def get_augmented_assign_pattern_tip() -> str:
return (
'Found usable augmented assign pattern. '
'You can use shorthand notation if the left and right parts of '
'the expression have the same variable, '
'e.g. x = x + 2 is the same with x += 2.'
)


def get_class_coupling_tip() -> str:
return (
'The class seems to depend on too many other classes. '
Expand Down

0 comments on commit 44cb827

Please sign in to comment.