Showing 1,050 of 1,372 total issues
Function _tzinfo
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _tzinfo(self, dt, is_dst=False):
tzinfo = dt.tzinfo
if isinstance(tzinfo, LocalTimezone) and tzinfo._offset is not None:
return tzinfo
- 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 render_admin_panel
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def render_admin_panel(self, req, cat, page, path_info):
log_type = self.env.log_type
log_level = self.env.log_level
log_file = self.env.log_file
log_dir = self.env.log_dir
- 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 save
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def save(self):
authenticated = int(self.authenticated)
now = int(time_now())
items = list(self.items())
if not authenticated and not self._old and not items:
- 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 _export_rss
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _export_rss(self, req, ticket):
changes = []
for change in self.rendered_changelog_entries(req, ticket):
changes.append(change)
- 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 drawEdge
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawEdge(ctx, edge) {
var p = [{x: edge.source.bx + edge.source.bw * 2 / 3,
y: edge.source.by - 1,
dx: 0, dy: -1},
{x: edge.source.bx + edge.source.bw / 3,
WikiAdmin
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class WikiAdmin(Component):
"""trac-admin command provider for wiki administration."""
implements(IAdminCommandProvider, IEnvironmentSetupParticipant)
AttachmentModule
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class AttachmentModule(Component):
implements(IRequestHandler, INavigationContributor, IWikiSyntaxProvider,
IResourceManager)
Consider simplifying this complex logical expression. Open
if call_stack == -1 and tok == NAME and value in ('def', 'class'):
in_def = True
elif tok == OP and value == '(':
if in_def:
# Avoid false positives for declarations such as:
TracAdmin
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class TracAdmin(cmd.Cmd):
intro = ''
doc_header = 'Trac Admin Console %(version)s\n' \
'Available Commands:\n' \
% {'version': TRAC_VERSION}
Configuration
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Configuration(object):
"""Thin layer over `ConfigParser` from the Python standard library.
In addition to providing some convenience methods, the class remembers
the last modification time of the configuration file, and reparses it
Ticket
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Ticket(object):
realm = 'ticket'
# Fields that must not be modified directly by the user
TicketSystem
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class TicketSystem(Component):
implements(IPermissionRequestor, IWikiSyntaxProvider, IResourceManager,
ITicketManipulator)
change_listeners = ExtensionPoint(ITicketChangeListener)
SubversionRepository
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class SubversionRepository(Repository):
"""Repository implementation based on the svn.fs API."""
has_linear_changesets = True
Function ensure_inline
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def ensure_inline(self, text, in_paragraph=True):
content_for_span = None
interrupt_paragraph = False
if isinstance(text, Element):
tagname = text.tag.lower()
- 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 _parse_date_iso8601
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _parse_date_iso8601(text, tzinfo):
match = _ISO_8601_RE.match(text)
if match:
try:
g = match.groups()
- 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 to_unicode
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def to_unicode(text, charset=None):
"""Convert input to a `str` object.
For a `bytes` object, we'll first try to decode the bytes using the given
`charset` encoding (or UTF-8 if none is specified), then we fall back to
- 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 get_console_locale
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_console_locale(env=None, lang=None,
categories=('LANGUAGE', 'LC_ALL', 'LC_MESSAGES',
'LANG')):
"""Return negotiated locale for console by locale environments and
[trac] default_language."""
- 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 stripentities
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def stripentities(text, keepxmlentities=False):
"""Return a copy of the given text with any character or numeric entities
replaced by the equivalent UTF-8 characters.
>>> stripentities('1 < 2')
- 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 execute_command
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def execute_command(self, *args):
"""Execute a command given by a list of arguments."""
args = list(args)
for provider in self.providers:
for cmd in provider.get_admin_commands() or []:
- 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 _get_default_ambiwidth
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _get_default_ambiwidth():
"""Return width of East Asian Ambiguous based on locale environment
variables or Windows codepage.
"""
- 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"