Showing 78 of 108 total issues
Function main
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
def main():
# === Extract options ===
parser = OptionParser(usage="usage: %prog [options] <timeColumn> <timeInterval> <groupByColumn> ...")
parser.add_option(
'-p', '--pivot', dest='pivot', action='store_true', default=False,
- 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_line
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def parse_line(self, row):
# Drop all rows in non-successful status
if row['Transactional Status'] != 'S':
return
- 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
File geonames_updater.py
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python3.5
from configparser import ConfigParser
from optparse import OptionParser
import dateutil.parser
Function read
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def read(path, version, callback, column_headers, encoding):
# Coerce to a list
if not hasattr(version, 'extend'):
version = [version]
- 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 parseSearchResponse
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function parseSearchResponse ( $xml_response ) {
$currency = CurrencyConversion::init();
$country_list = CountryCodeConversion::init();
$response = $this->getMetadataRequest();
- 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
File PayflowReports.php
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php error_reporting (E_ALL);
/*
* Base class for a returned Payflow Report. This class is used by all others to access Payflow report data.
*
Function update_gdoc_results
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def update_gdoc_results(doc=None, results=[]):
log.info("Updating results in {url}".format(url=doc))
doc = Spreadsheet(doc=doc)
existing = list(doc.get_all_rows())
- 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
Method parseSearchResponse
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseSearchResponse ( $xml_response ) {
$currency = CurrencyConversion::init();
$country_list = CountryCodeConversion::init();
$response = $this->getMetadataRequest();
Function pivotDataByYear
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def pivotDataByYear(stats):
"""
Transformation of the statistical data -- grouping reports by date
Returns ((list of years), {report: {date: [year data]}})
- 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
File PayflowSearch.php
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php error_reporting (E_ALL);
require_once( 'PayflowReports.php' );
Function parseCLDR
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def parseCLDR(cldr_path):
"""Parse CLDR XML files into currency and locale data
Returns a set of: (
cldr date
{currencyIso: {digits, rounding}},
- 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
File stats_abba.py
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
# From: http://github.com/thumbtack/abba/python/abba/stats.py, commit 0a7fcda0
# Copyright (c) 2012 Thumbtack, Inc.
import collections
import math
Function execute_paged
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def execute_paged(self, query, pageIndex, pageSize=1000, dir='ASC'):
""" Execute a paged query. This will yield a dictionary of the results
until there are no more results to yield. The pageIndex will be added
to the order by automatically. If the Query already has a limit, it will
be respected (only that many rows will be returned.)
- 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 __init__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, label=None, type="", campaign=None, banners=None, start=None, end=None, disabled=False, **ignore):
config = get_config()
for key in config.ignored_columns:
if key in ignore:
ignore.pop(key)
- 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 curl_download
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function curl_download( $url, $cert, $vars = NULL ) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
- 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_line
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def parse_line(self, row):
required_fields = [
"Period 3 Amount",
"Subscription Currency",
"Subscription ID",
- 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
Method runReport
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function runReport() {
$xml = $this->runReportRequest();
$request = $this->createRequest( $xml );
$rc = $this->sendRequest( $request );
Function runAudit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function runAudit( $begin, $end ) {
$report = new CustomReport( array ( $begin . ' 00:00:00', $end . ' 23:59:59') );
if ( $report->runReport()) {
$results = $report->getResults();
} else {
- 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 begin
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def begin(filename=None, failopen=False):
if not filename:
unique = os.environ['LOGNAME']
cmd = os.path.basename(sys.argv[0])
filename = "/tmp/%s-%s.lock" % (unique, cmd)
- 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 extractNumericLocale
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def extractNumericLocale(locale, pPattern, nPattern=None):
"""Extract grouping char, decimal char, digit grouping, positive, and negative format strings from a pattern
pPattern -- the positive pattern
nPattern -- the negative pattern if given
"""
- 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"