Fixed: Style and lint violations for ten more of the worst violating files #1265
No reviewers
Labels
No Label
bug
build
dependencies
developers
documentation
duplicate
enhancement
formatting
invalid
legal
mobile
obsolete
packaging
performance
protocol
question
refactoring
regression
security
test
translation
usability
wontfix
No Milestone
No project
No Assignees
1 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Bitmessage/PyBitmessage-2024-12-21#1265
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "codeq31-05"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Continuing the code style and linting work. Some docstrings have been deferred until I can provide quick and accurate descriptions.
There's actually 13 files. I was probably looking at only part of git's output when I wrote that. I'll update it.
Travis isn't working. One of these files must take us into a cascading import failure. Currently chasing it down.
Most of this change are destructive I think. Did you tested anything?
@ -11,3 +15,4 @@
import hashlib
import json
from struct import pack
import time
Why?
Any function without
return
statement returnsNone
by defaultIt seems you've changed the logic here.
@ -12,3 +15,2 @@
import os
import sys
The software version variable is now held in shared.py
Why are you moving copyrights to docstring?
@ -30,0 +24,4 @@
import os
import signal
import socket
import sys
This will probably break script execution.
@ -26,2 +35,3 @@
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig, encoding = QtCore.QCoreApplication.CodecForTr, n = None):
def _translate(context, text, disambig, encoding=QtCore.QCoreApplication.CodecForTr, n=None):
This changes break portable usage.
@ -1,12 +1,26 @@
#!/usr/bin/env python2.7
This is unused module
@ -1,15 +1,23 @@
# -*- coding: utf-8 -*-
It's pointless to edit auto-generated module.
Docstring imitation.
@ -148,4 +161,4 @@
elemCount = len(filtered)
if elemCount > maxAddrCount / 2:
elemCount = int(maxAddrCount / 2)
addrs[stream * 2 + 1] = helper_random.randomsample(filtered.items(), elemCount)
Oh my eyes
You've done the opposite in other hunk.
I've vomited
If result is not used, do not assign anything.
Sorry @g1itch, @PeterSurda, this PR isn't ready yet, I should have closed it for now. I accept pretty much all your comments there and will address them as soon as I resume work on this branch.
I was trying to see how far travis got without the sys path munging. This led to re-factoring imports in other files and eventually started to touch the files affected by open PRs so I was looking to get all the other PRs in before going any further with this one.
I force-pushed and now don't have the permissions to re-open this PR. I opened PR#1271 to track outstanding comments and this can stay closed.
@ -26,2 +35,3 @@
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig, encoding = QtCore.QCoreApplication.CodecForTr, n = None):
def _translate(context, text, disambig, encoding=QtCore.QCoreApplication.CodecForTr, n=None):
Continued in PR#1271
@ -1,12 +1,26 @@
#!/usr/bin/env python2.7
Removed in PR#1271
@ -1,15 +1,23 @@
# -*- coding: utf-8 -*-
Continued in PR#1271
Continued in PR#1271
@ -148,4 +161,4 @@
elemCount = len(filtered)
if elemCount > maxAddrCount / 2:
elemCount = int(maxAddrCount / 2)
addrs[stream * 2 + 1] = helper_random.randomsample(filtered.items(), elemCount)
Fixed in PR#1271
Continued in PR#1271
@ -11,3 +15,4 @@
import hashlib
import json
from struct import pack
import time
In the wrong order: Continued in PR#1271
I know this. Pylint want it explicit here.
Fixed in PR#1271
@ -12,3 +15,2 @@
import os
import sys
The software version variable is now held in shared.py
Multi-line comments are better done with a triple quoted string. In particular, Sphinx (or rather effective rST comments) requires triple quoted strings. However a triple-quoted string is flagged by linters as 'string statement has no effect'. Perhaps a Sphinx section on copyright would be the best place to put these notices? Being part of a module docstring made more sense to me than loose in the top level in module, though I don't feel a Python file is the right place anyway. So continued in PR#1270.
LHS removed - fixed in PR#1271.
I'm lost, sorry, could you be more specific please? There's one other hunk like that in that file:
But maybe you mean why did I ignore the violation elsewhere, as in
# pylint: disable=redefined-outer-name
. The answer is because this would change the api of a function. Due to the large number of changes we're making to remove violations we're working on one (or a few) file(s) at a time. There will be some refactorings that will necessarily affect multiple files (e.g. fixing the badly named variables, functions and classes). If you're not referring to either of these, please comment in PR#1271, otherwise, fixed in PR#1271.