-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
[POC] all: fix deepsource checks #2016
Changes from all commits
fbd2135
b40a653
7daa247
86bda22
1dde5b0
b1dfb42
e19ac02
b18acf0
8bc0f24
f2dcfda
c6477f3
4fca0be
c54b50d
31ec426
e02bb6b
9fd3c00
2f01eb3
c49921c
3da901d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version = 1 | ||
|
||
test_patterns = ["test/**"] | ||
|
||
[[analyzers]] | ||
name = "python" | ||
enabled = true | ||
|
||
[analyzers.meta] | ||
runtime_version = "3.x.x" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ def __init__(self, config, daemon=False): | |
For servers that do not support IRCv3, this will be an empty set. | ||
""" | ||
|
||
self.privileges = dict() | ||
self.privileges = {} | ||
"""A dictionary of channels to their users and privilege levels. | ||
|
||
The value associated with each channel is a dictionary of | ||
|
@@ -684,7 +684,7 @@ def call_rule(self, rule, sopel, trigger): | |
|
||
if '*' in disabled_plugins: | ||
return | ||
elif rule.get_plugin_name() in disabled_plugins: | ||
if rule.get_plugin_name() in disabled_plugins: | ||
return | ||
Comment on lines
685
to
688
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This, on the other hand, is silly. If the tool isn't smart enough to recommend merging the two conditions into one (as below), it shouldn't flag anything. Just using if (
'*' in disabled_plugins
or rule.get_plugin_name() in disabled_plugins
):
return |
||
|
||
# disable chosen methods from plugins | ||
|
@@ -714,11 +714,11 @@ def call(self, func, sopel, trigger): | |
nick = trigger.nick | ||
current_time = time.time() | ||
if nick not in self._times: | ||
self._times[nick] = dict() | ||
self._times[nick] = {} | ||
if self.nick not in self._times: | ||
self._times[self.nick] = dict() | ||
self._times[self.nick] = {} | ||
if not trigger.is_privmsg and trigger.sender not in self._times: | ||
self._times[trigger.sender] = dict() | ||
self._times[trigger.sender] = {} | ||
|
||
if not trigger.admin and not func.unblockable: | ||
if func in self._times[nick]: | ||
|
@@ -1280,8 +1280,7 @@ def kick(self, nick, channel=None, message=None): | |
if channel is None: | ||
if self._trigger.is_privmsg: | ||
raise RuntimeError('Error: KICK requires a channel.') | ||
else: | ||
channel = self._trigger.sender | ||
channel = self._trigger.sender | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kind of thing is good. |
||
if nick is None: | ||
raise RuntimeError('Error: KICK requires a nick.') | ||
self._bot.kick(nick, channel, message) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,8 +156,7 @@ def homedir(self): | |
configured = self.parser.get('core', 'homedir') | ||
if configured: | ||
return configured | ||
else: | ||
return os.path.dirname(self.filename) | ||
return os.path.dirname(self.filename) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this kind of thing is also good. |
||
|
||
def get_defined_sections(self): | ||
"""Retrieve all defined static sections of this configuration. | ||
|
@@ -276,7 +275,7 @@ def define_section(self, name, cls_, validate=True): | |
current_name = str(current.__class__) | ||
new_name = str(cls_) | ||
if (current is not None and not isinstance(current, self.ConfigSection) and | ||
not current_name == new_name): | ||
current_name != new_name): | ||
Comment on lines
-279
to
+278
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is good, too. |
||
raise ValueError( | ||
"Can not re-define class for section from {} to {}.".format( | ||
current_name, new_name) | ||
|
@@ -345,9 +344,8 @@ def __getattr__(self, name): | |
section = self.ConfigSection(name, items, self) # Return a section | ||
setattr(self, name, section) | ||
return section | ||
else: | ||
raise AttributeError("%r object has no attribute %r" | ||
% (type(self).__name__, name)) | ||
raise AttributeError("%r object has no attribute %r" | ||
% (type(self).__name__, name)) | ||
|
||
def __getitem__(self, name): | ||
return self.__getattr__(name) | ||
|
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.
I don't mind enforcing this kind of style.