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

qa: fix additional LGTM alerts #1754

Merged
merged 11 commits into from
Nov 18, 2019
Merged

qa: fix additional LGTM alerts #1754

merged 11 commits into from
Nov 18, 2019

Conversation

dgw
Copy link
Member

@dgw dgw commented Nov 17, 2019

Since it seems running LGTM locally isn't a thing, I have to open this PR and hope that it does everything I think it should. I think this fixes 18 alerts. If the actual results don't match, I'll figure it out Soon™ (but probably not within the next 24 hours).

Edit: Looks like easy fixes (only the exception-comment changes failed, and it seems to be an inconsistency in LGTM's documentation about whether a space is allowed).

@dgw dgw added the Tweak label Nov 17, 2019
@dgw dgw added this to the 7.0.0 milestone Nov 17, 2019
@dgw dgw requested a review from a team November 17, 2019 08:46
@lgtm-com

This comment has been minimized.

@lgtm-com

This comment has been minimized.

@dgw
Copy link
Member Author

dgw commented Nov 17, 2019

So, exclusion comments don't work, either with or without a space between lgtm and the [specific/rule] to ignore for that line/block. Great.

I'll come back to this another day.

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.

I don't have the same opinion as LGTM, sometimes.

@dgw dgw requested a review from Exirel November 18, 2019 04:24
@dgw
Copy link
Member Author

dgw commented Nov 18, 2019

@Exirel Assuming the exclusion comments can be made to work, you're OK with this as amended?

@lgtm-com

This comment has been minimized.

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.

Let's go. 🐛

@dgw
Copy link
Member Author

dgw commented Nov 18, 2019

I'm not waiting 15 minutes for LGTM to re-analyze this with the suppression-comment changes dropped (I moved them to another branch; no reason to keep them unless they work). Presumably it'll pass the analysis with (still) 14 alerts fixed, and I'll merge it tomorrow afternoon-ish (currently 02:35 😅).

dgw added 11 commits November 18, 2019 12:34
LGTM pointed out that `requests` was imported with `from` as well.

As long as I was in the file, I fixed the command docstrings.
LGTM pointed out that config.types.FilenameAttribute overrides two
methods of ~.BaseValidated with different signatures, and complained
that the overriden method's signature doesn't match places where it's
called. Fair point.

In a perfect world, we might make BaseValidated an abstract class. So
doing is kind of a pain until we drop Python 2 support due to the THREE
different syntaxes between py2.7, py3.3, and py3.4+... This appproach
ought to hold us over until then.
The best constant to use was added only in Python 3.6, which makes
addressing these warnings for Sopel 7.0 impractical.

My lengthy comment should provide clear guidance for when we start going
through the code looking for things to refactor after we actually drop
old versions of Python, in (per current plans) Sopel 8.
It's kind of a bogus warning, since we aren't actually "sanitizing"
anything here, but it certainly doesn't hurt to make sure we're looking
at the *beginning* of the clbin result.

If LGTM still flags this, I'll be mildly cross because `re.match()` only
matches at the beginning of the given string.

Technically, LGTM only flagged `post_to_clbin`, but since that and
`post_to_0x0` are almost identical, I chose to hedge against them fixing
whatever bug in their analysis engine caused it to catch only one.
LGTM says an object that defines `__eq__()` should also define both
`__ne__()` and `__hash__()` for itself. That's easy, and it means we're
now explicit about TimeReminder objects not being hashable.
Should silence LGTM's [py/procedure-return-value-used] warnings.
@dgw
Copy link
Member Author

dgw commented Nov 18, 2019

Right, so LGTM apparently doesn't apply suppression comments in PRs on purpose. I put them back, and will merge this Very Soon™. Gonna find something else to do while the analysis runs. 😁

@dgw dgw merged commit b885c41 into master Nov 18, 2019
@dgw dgw deleted the lgtm-tweaks branch November 18, 2019 19:00
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