Showing 9,525 of 13,510 total issues
OrderedDict
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class OrderedDict(dict):
'Dictionary that remembers insertion order'
# An inherited dict maps keys to values.
# The inherited dict provides __getitem__, __len__, __contains__, and get.
# The remaining methods are order-aware.
Consider simplifying this complex logical expression. Open
Open
if not hasattr(entry[0], '__call__') or \
not hasattr(entry[1], '__call__') or \
(entry[2] is not None and not hasattr(entry[2], '__call__')) or \
(entry[3] is not None and not hasattr(entry[3], '__call__')) or \
(len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \
SymbolVisitor
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class SymbolVisitor:
def __init__(self):
self.scopes = {}
self.klass = None
HelpFormatter
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class HelpFormatter(object):
"""Formatter for generating usage messages and argument help strings.
Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
GzipFile
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class GzipFile(io.BufferedIOBase):
"""The GzipFile class simulates most of the methods of a file object with
the exception of the readinto() and truncate() methods.
"""
Maildir
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Maildir(Mailbox):
"""A qmail-style Maildir mailbox."""
colon = ':'
HTMLParser
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class HTMLParser(markupbase.ParserBase):
"""Find tags and other markup and call handler functions.
Usage:
p = HTMLParser()
IOBase
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class IOBase:
__metaclass__ = abc.ABCMeta
"""The abstract base class for all I/O classes, acting on streams of
bytes. There is no public constructor.
OrderedDict
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class OrderedDict(dict):
'Dictionary that remembers insertion order'
# An inherited dict maps keys to values.
# The inherited dict provides __getitem__, __len__, __contains__, and get.
# The remaining methods are order-aware.
Consider simplifying this complex logical expression. Open
Open
if not hasattr(entry[0], '__call__') or \
not hasattr(entry[1], '__call__') or \
(entry[2] is not None and not hasattr(entry[2], '__call__')) or \
(entry[3] is not None and not hasattr(entry[3], '__call__')) or \
(len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \
SymbolVisitor
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class SymbolVisitor:
def __init__(self):
self.scopes = {}
self.klass = None
HelpFormatter
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class HelpFormatter(object):
"""Formatter for generating usage messages and argument help strings.
Only the name of this class is considered a public API. All the methods
provided by the class are considered an implementation detail.
File timeit.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#! /usr/bin/env python
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
File xmlreader.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. """
import handler
File timeit.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#! /usr/bin/env python
"""Tool for measuring execution time of small code snippets.
This module avoids a number of common traps for measuring execution
File xmlreader.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers
should be based on this code. """
import handler
File pyclbr.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Parse a Python module and describe its classes and methods.
Parse enough of a Python file to recognize imports and class and
method definitions, and to find out the superclasses of a class.
File pyclbr.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"""Parse a Python module and describe its classes and methods.
Parse enough of a Python file to recognize imports and class and
method definitions, and to find out the superclasses of a class.
Function _PackIntValue
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
def _PackIntValue(self, IntValue, Size):
if Size not in _FORMAT_CHAR.keys():
EdkLogger.error("BPDG", BuildToolError.FORMAT_INVALID,
"Invalid size %d for PCD %s in integer datum size(File: %s Line: %s)." % (Size, self.PcdCName, self.FileName, self.Lineno))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function SaveFileOnChange
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
def SaveFileOnChange(File, Content, IsBinaryFile=True):
if not IsBinaryFile:
Content = Content.replace("\n", os.linesep)
if os.path.exists(File):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"