Showing 56 of 172 total issues
Function process
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def process(self, data):
if isinstance(data, dict):
data = [data]
s = time()
- 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 send
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send(self, data):
if len(self.hooks) == 0:
logger.info('no webhooks to send to... '
'is your webhooks.yml missing?')
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
Function get
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get(self):
parser = reqparse.RequestParser()
parser.add_argument('q')
args = parser.parse_args()
- 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 _check_create_queue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _check_create_queue(self, last_flushed):
if len(self.create_queue) == 0:
return time.time()
if ((time.time() - last_flushed) <= CREATE_QUEUE_FLUSH) \
- 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 search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def search(self, data):
s = self.handle().query(Token)
for k in ['token', 'username', 'admin', 'write', 'read']:
if data.get(k):
- 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
Avoid deeply nested control flow statements. Open
with open(args.config_path, 'w') as f:
f.write(yaml.dump(data, default_flow_style=False))
Function _pull
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _pull(self, filters):
try:
with Client(ROUTER_ADDR, session['token']) as client:
r = client.indicators_search(filters)
- 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 _upsert
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _upsert(self, s, n, d, token, cached_added, batch):
Function _check_indicator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _check_indicator(i, t):
if not i.get('group'):
i['group'] = t['groups'][0]
if not i.get('provider'):
- 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 handle_indicators_create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def handle_indicators_create(self, token, data, id=None, client_id=None,
Avoid deeply nested control flow statements. Open
with open(args.config_path, 'w') as f:
f.write(yaml.dump(data, default_flow_style=False))
Function main
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def main():
from gevent import pywsgi, pool
from geventwebsocket.handler import WebSocketHandler
p = get_argument_parser()
- 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 upsert
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def upsert(self, token, data, **kwargs):
if isinstance(data, dict):
data = [data]
s = self.handle()
- 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 _search_bulk
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _search_bulk(filters):
try:
with Client(ROUTER_ADDR, session['token']) as client:
r = client.indicators_search(filters)
- 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 before_request
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def before_request():
"""
Grab the API token from headers
:return: 401 if no token is present
- 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 process
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process(i, max=MAX_QUERY_RESULTS):
if not _enabled(i):
return
try:
- 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
Avoid too many return
statements within this function. Open
return myfeed, 200
Avoid too many return
statements within this function. Open
return {'data': r, 'message': 'success'}, 201
Avoid too many return
statements within this function. Open
return s
Avoid too many return
statements within this function. Open
return s