New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR for #551: fix minor flake8 complaints #552
Merged
Merged
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
20f10bb
Fix the first (simplest) batch of minor flake8 complaints
edreamleo ac6bce0
Merge branch 'master' into ekr-flake8
edreamleo bd36aef
Fix a potential crasher apparently not caught by a unit test
edreamleo 6d35a19
Removed an unnecessary '# noqa'
edreamleo 95ea866
Merge branch 'master' into ekr-flake8
edreamleo db75d42
Add .pylintrc. Suppress pylint complaint in project.py
edreamleo b0e3ef0
Improve opening comments
edreamleo 7298879
Still better opening comments
edreamleo af2a2ff
Merge branch 'master' into ekr-flake8
edreamleo 8468270
Fix B007: Loop control variable 'whatever' not used within the loop body
edreamleo 975c2f4
Fix B009: Do not call getattr with a constant attribute value, it is …
edreamleo 86503e4
Fix B011
edreamleo 23188bc
blacken
edreamleo 12c781a
Merge branch 'master' into ekr-flake8
edreamleo d1b078b
Add suppressions to suppress all flake8 messages
edreamleo 4739b79
Change _MoveTools.occurs_in_module per lieryan's suggestion. All test…
edreamleo ad9c23e
Use lieryan's second suggestion
edreamleo e560a08
Restore setup.cfg from master
edreamleo c364775
Fix 'ambiguous name' complaint
edreamleo 12e52e0
Merge branch 'master' into ekr-flake8
edreamleo 20b331e
Restore assert statements, using an f-string for one of them
edreamleo b0f2062
Suppress flake8 B007 test and remove recently added underscores for l…
edreamleo ddbb957
Suppress flake8 B011 warning
edreamleo File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,211 @@ | ||
# A settings file for running pylint on Rope. | ||
|
||
# Run pylint from the top-level Rope directory: `python -m pylint rope` | ||
|
||
# This file tested on pylint 2.14.4, Python 3.10.5, as reported by `python -m pylint --version`. | ||
|
||
[MASTER] | ||
|
||
# Add <file or directory> to the black list. A base name, not a path. | ||
ignore= | ||
.git | ||
|
||
# Files or directories matching regex, in Windows or Posix format. | ||
ignore-paths= | ||
|
||
# Pickle collected data for later comparisons. | ||
persistent=yes | ||
|
||
[MESSAGES CONTROL] | ||
|
||
# Enable the message, report, category or checker with the given id(s). | ||
# enable= | ||
|
||
# Disable the message, report, category or checker with the given id(s). | ||
disable= | ||
|
||
# Catagories to disable: expensive or make-work | ||
# typecheck | ||
|
||
basic, # Check on names. Unimportant. | ||
classes, # Unimportant. | ||
design, # Make work. | ||
format, # Use black | ||
imports, # Creates import graph. Expensive? | ||
similarities, # Expensive. | ||
typecheck, # Unimportant | ||
variables, # Unimportant. | ||
|
||
# Black. Suppress checks that conflict with Black's conventions. | ||
|
||
line-too-long, | ||
|
||
# Rope: Suppress checks that conflict with Rope's conventions. | ||
|
||
bad-classmethod-argument, | ||
eval-used, | ||
function-redefined, | ||
inconsistent-return-statements, | ||
invalid-name, | ||
no-else-return, | ||
no-self-argument, | ||
signature-differs, # Maybe. | ||
not-callable, # Maybe. | ||
unexpected-special-method-signature, | ||
|
||
# Rope: potentially serious warnings. | ||
|
||
arguments-differ, | ||
dangerous-default-value, | ||
modified-iterating-list, | ||
used-before-assignment, | ||
unsubscriptable-object, | ||
unpacking-non-sequence, | ||
|
||
# Rope: to be removed. | ||
|
||
duplicate-string-formatting-argument, | ||
no-else-raise, # Unnecessary "else" after "raise", remove the "else" and de-indent the code inside it. | ||
reimported, | ||
superfluous-parens, | ||
unused-import, | ||
unused-wildcard-import, | ||
useless-super-delegation, | ||
|
||
useless-else-on-loop, #Else clause on loop without a break statement, remove the else and de-indent all the code inside it. | ||
unidiomatic-typecheck, | ||
wildcard-import, | ||
wrong-import-order, | ||
|
||
# Rope: Additional (temporary?) suppressions. | ||
|
||
abstract-method, | ||
arguments-differ, | ||
consider-merging-isinstance, | ||
consider-using-enumerate, | ||
deprecated-method, | ||
implicit-str-concat, | ||
logging-fstring-interpolation, | ||
no-member, | ||
no-staticmethod-decorator, # Consider using a decorator instead of calling staticmethod. | ||
non-parent-init-called, | ||
raise-missing-from, | ||
super-init-not-called, | ||
unnecessary-lambda, | ||
unsupported-assignment-operation, | ||
|
||
# Leo: Standard suppressions. | ||
|
||
arguments-renamed, # cursesGui2.py | ||
assignment-from-no-return, # Causes problems when base class return None. | ||
assignment-from-none, # Causes problems when base class return None. | ||
attribute-defined-outside-init, | ||
broad-except, # except Exception is justified if followed by g.es_exception. | ||
c-extension-no-member, # Too many errors re pyQt6. | ||
condition-evals-to-constant, | ||
consider-iterating-dictionary, | ||
consider-using-from-import, | ||
consider-using-f-string, # complains about regex's! | ||
consider-using-in, | ||
consider-using-dict-comprehension, | ||
consider-using-dict-items, | ||
consider-using-generator, | ||
consider-using-max-builtin, | ||
consider-using-set-comprehension, | ||
consider-using-ternary, | ||
consider-using-with, | ||
cyclic-import, | ||
deprecated-module, | ||
exec-used, | ||
f-string-without-interpolation, # Useful for concatenated f-strings. | ||
global-statement, # Assume we know what we are doing. | ||
global-variable-not-assigned, # not helpful. | ||
import-error, # Ignore imports of optional packages. | ||
import-outside-toplevel, # Requires substantial code changes. | ||
keyword-arg-before-vararg, # See https://github.com/PyCQA/pylint/issues/2027 | ||
missing-docstring, # Instead, use Leo's find-missing-docstrings command. | ||
no-else-break, # **Possible pylint bug** | ||
protected-access, | ||
redeclared-assigned-name, | ||
redefined-argument-from-local, # I do this all the time. | ||
redefined-builtin, # all, next, etc. so what? | ||
redefined-outer-name, | ||
too-few-public-methods, | ||
trailing-whitespace, # Too picky. No need to constantly do clean-all-lines. | ||
unnecessary-comprehension, | ||
unnecessary-dunder-call, # pylint for python 3.10 only. | ||
unnecessary-lambda-assignment, | ||
unnecessary-pass, # Can be pedantic in some situations. | ||
unspecified-encoding, # Huh? | ||
unused-argument, | ||
unused-private-member, # too many false positives. | ||
unused-variable, # way too many false positives, esp. tuple unpacking. | ||
use-dict-literal, | ||
use-list-literal, | ||
use-maxsplit-arg, # What is this?? | ||
using-constant-test, | ||
|
||
# Good warnings. Don't suppress these. | ||
|
||
# bad-option-value, # obsolete pylint option. | ||
# unrecognized-option, # newer python. | ||
|
||
# bad-builtin, | ||
# bad-continuation, | ||
# bad-option-value, # obsolete pylint option. | ||
# chained-comparison, | ||
# len-as-condition, | ||
# import-error, # Warns when an import fails: useful now that we are only using python 3. | ||
# literal-comparison, | ||
# locally-disabled, | ||
# multiple-statements, | ||
# no-else-raise, | ||
# no-init, | ||
# no-value-for-parameter, | ||
# not-an-iterable, | ||
# old-style-class, # Probably not an issue. | ||
# simplifiable-if-statement, | ||
# singleton-comparison, | ||
# superfluous-parens, | ||
# trailing-comma-tuple, | ||
# unsupported-assignment-operation, | ||
# unsupported-delete-operation, | ||
# unsubscriptable-object, | ||
# useless-object-inheritance, # class x(object): | ||
# useless-return, | ||
|
||
[REPORTS] | ||
|
||
# Set the output format. Multiple values are allowed. | ||
output-format=text # colorized, text, parseable, msvs (visual studio) | ||
|
||
reports=no # Display only messages. | ||
|
||
score=no # Deactivate the evaluation score. | ||
|
||
[MISCELLANEOUS] | ||
|
||
# List of note tags to take in consideration, separated by a comma. | ||
# notes=FIXME,XXX,TODO | ||
notes= | ||
|
||
# The following sections are all suppressed above. | ||
|
||
[BASIC] | ||
|
||
[CLASSES] | ||
|
||
[DESIGN] | ||
|
||
# Maximum number of nested blocks for function / method body | ||
max-nested-blocks=10 # Apparently, this can't be suppressed! | ||
|
||
[FORMAT] | ||
|
||
[IMPORTS] | ||
|
||
[SIMILARITIES] | ||
|
||
[TYPECHECK] | ||
|
||
[VARIABLES] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import bisect | ||
import difflib | ||
import sys | ||
import warnings | ||
|
||
import rope.base.libutils | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a convention where unused variable have to be prefixed with underscore (e.g.
_varname
) isn't going to be enforceable unless we run a linter scanning for this as pre-commit or as a Github Actions; it's too easy to miss that during manual code review. I'd rather we either disable this warning in local linter or add at least a Github Actions to enforce this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 was the source of the complaints. Is it hard to check commits with flake8?
Similarly, it might be good to add a GitHub action that checks that reindent does nothing on all files, including those in the ropetest directory.
Otoh,
B007
is a "bugbear" for good reason. I would be happy to disable it in setup.cfg.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
B007
is is now disabled. We can revisit this question at our leisure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have Black running on GitHub Actions for formatting checks. I think that should be sufficient, adding more than one formatter would be undesirable, IMO, as it creates the possibility of conflicting advices from the tools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know.