Showing 1,557 of 1,564 total issues
Specify string format arguments as logging function parameters Open
log.info('Site: %s; batch system: %s' % (self.site_name, self.machine_name))
- Read upRead up
- Exclude checks
Used when a logging statement has a call form of logging.<logging method>(format_string % (format_args...))
. Such calls should leave string interpolation to the logging method itself and be written logging.<logging method>(format_string, format_args...)
so that the program may avoid incurring the cost of the interpolation in those cases in which no message will be logged. For more, see http://www.python.org/dev/peps/pep-0282/.
Import from .parser import Parser
should be placed at the top of the module Open
from .parser import Parser
- Read upRead up
- Exclude checks
Used when code and imports are mixed
Variable name rc
doesn't conform to snake_case naming style Open
rc = {}
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Exactly one space required after comma Open
from .datetime_utils import valid_from,valid_until, parse_timestamp, parse_time, iso2seconds
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. from .datetimeutils import validfrom,validuntil, parsetimestamp, parse_time, iso2seconds ^
Missing function or method docstring Open
def set_up_logging(logfile, level, console):
- Read upRead up
- Exclude checks
Used when a function or method has no docstring.Some special methods like init do not require a docstring.
Variable name tb
doesn't conform to snake_case naming style Open
for tb in tbstack[1:]:
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Cyclic import (apel.db.records -> apel.db.records.group_attribute) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Cyclic import (apel.db.records -> apel.db.records.normalised_summary) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Cyclic import (apel.parsers -> apel.parsers.pbs) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Variable name d
doesn't conform to snake_case naming style Open
d = xml.dom.minidom.parseString(msg_text)
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Constant name log
doesn't conform to UPPER_CASE naming style Open
log = logging.getLogger(__name__)
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
Exactly one space required after comma Open
parts = [x.split('=',1) for x in [y for y in self.LINE_EXPR.split(line) if len(y) > 1]]
- Read upRead up
- Exclude checks
Used when a wrong number of spaces is used around an operator, bracket or block opener. parts = [x.split('=',1) for x in [y for y in self.LINE_EXPR.split(line) if len(y) > 1]] ^
standard import import logging
should be placed before from apel.common import parse_time
Open
import logging
- Read upRead up
- Exclude checks
Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)
Constant name logger
doesn't conform to UPPER_CASE naming style Open
logger = logging.getLogger(__name__)
- Read upRead up
- Exclude checks
Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).
standard import import logging
should be placed before from .datetime_utils import valid_from, valid_until, parse_timestamp, parse_time, iso2seconds
Open
import logging
- Read upRead up
- Exclude checks
Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)
Cyclic import (apel.db -> apel.db.apeldb) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Cyclic import (apel.db -> apel.db.apeldb -> apel.db.backends.mysql -> apel.db.records -> apel.db.records.blahd -> apel.db.records.record) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Cyclic import (apel.db.records -> apel.db.records.summary) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Cyclic import (apel.parsers -> apel.parsers.blah) Open
"""A setup script for APEL.
- Read upRead up
- Exclude checks
Used when a cyclic import between two or more modules is detected.
Either merge this branch with the identical one on line "90" or change one of the implementations. Open
rmem = node.firstChild.data
- Read upRead up
- Exclude checks
Having two branches in the same if
structure with the same implementation is at best duplicate code, and at worst a coding error. If
the same logic is truly needed for both instances, then they should be combined.
Noncompliant Code Example
if 0 <= a < 10: do_the_thing() elif 10 <= a < 20: do_the_other_thing() elif 20 <= a < 50: do_the_thing() # Noncompliant; duplicates first condition else: do_the_rest() b = 4 if a > 12 else 4
Compliant Solution
if (0 <= a < 10) or (20 <= a < 50): do_the_thing() elif 10 <= a < 20: do_the_other_thing() else: do_the_rest() b = 4
or
if 0 <= a < 10: do_the_thing() elif 10 <= a < 20: do_the_other_thing() elif 20 <= a < 50: do_the_third_thing() else: do_the_rest() b = 8 if a > 12 else 4