Skip to content
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

Unignore more style checks #1561

Merged
merged 6 commits into from
Apr 16, 2019
Merged

Unignore more style checks #1561

merged 6 commits into from
Apr 16, 2019

Conversation

dgw
Copy link
Member

@dgw dgw commented Apr 16, 2019

Somehow, being sick motivated me to work on a tedious patch that I would usually skip in favor of writing something more interesting. But this seems to have been productive!

dgw added 6 commits April 16, 2019 02:25
There were surprisingly few places where this check failed. All have
been corrected in the same commit as the ignore list update to avoid
introducing a commit with known CI failures.
This is a straight readability enhancement, with a very small effect on
existing code (three changed instances in two modules). Enforcing this
is mostly to help future contributors who are new to Python learn the
convention (and hopefully see why `thing not in dictvar` is preferable
to `not thing in dictvar`). Existing contributors already use this style
instinctively; the few violations of this rule were in very old code.
Of this commit, half the changes are dealing with the exact same pattern
across several modules that all need either `quote()` or `unquote()` out
of urllib but have to make it Unicode-safe first for use in Python 2
environments. Depending on your point of view, this is a compelling
argument either for keeping/extending Sopel's `web` tools, or for
dropping Python 2 support ASAP.
One single real mistake aside, this change caught exclusively code that
had been commented-out.

Commit 5479ed4 should have removed those lines instead of commenting
them out. (Had I been maintainer at the time, #1065 would have been
rebased before merging, to get rid of the comments entirely.)

As for 822727d, I can only theorize that those two lines were committed
accidentally. They were never present in uncommented form (except maybe
before that commit was, um, committed), and seem to serve no purpose.
These style rules enforce indentation as a multiple of four spaces
(E111) and validate that no unexpected indentation is present (E113).
Sopel's codebase is fully compliant with these checks already and no
fixes are needed—surprisingly. Don't know why we still ignored them.
Some ignored error codes in the flake8 configuration clearly indicated
that Sopel's `__future__` imports were meant to be enforced by
`checkstyle.sh`, but the package wasn't required anywhere.

Requiring `flake8-future-import` in `dev-requirements.txt` and
overhauling the ignored error codes in `setup.cfg` led to a very small
set of fixes (two files). Our use of future imports is now verified to
be consistent (and in line with what the `CONTRIBUTING.md` file says).
@dgw dgw added the Tests label Apr 16, 2019
@dgw dgw added this to the 7.0.0 milestone Apr 16, 2019
@dgw dgw requested a review from Exirel April 16, 2019 07:29
Copy link
Contributor

@Exirel Exirel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, 🚢

sopel/cli/run.py Show resolved Hide resolved
dev-requirements.txt Show resolved Hide resolved
@dgw dgw merged commit e40720f into master Apr 16, 2019
@dgw dgw deleted the unignore-more-style-checks branch April 16, 2019 07:44
@dgw
Copy link
Member Author

dgw commented Apr 16, 2019

Merging this means I can get back to the other PR I'm working on (#1402) with confidence that I won't duplicate anything done here. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants