wemake-python-styleguide
wemake-python-styleguide copied to clipboard
Feature: find extra parentheses that can be removed
Rule request
Thesis
There are cases when parentheses can be removed. Like: x = ('string')
.
There are also examples when it can not be removed: x = (1 + 3) * 2
There are also cases when they should not be removed (since I prefer to use tuple
with explicit parentheses): x = (1, 2)
.
Reasoning
This will increase consistency.
Format
This should be a separate plugin. Because I am sure that this will be impossible to achieve without logical_line
param.
Related: https://rules.sonarsource.com/python/RSPEC-1110
Related:
- https://gist.github.com/snoack/e78963516d93e55add32fc1f8237b0e4
- https://stackoverflow.com/questions/56956892/how-to-check-for-redundant-parentheses-with-flake8
Easy case: print((a))
Or return ((a, b, c))