Showing 10 of 16 total issues
File wryte.py
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
# pylint: disable=missing-docstring
# Copyright 2017-2018 Nir Cohen
#
# Licensed under the Apache License, Version 2.0 (the "License");
Wryte
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Wryte:
def __init__(
self,
name=None,
hostname=None,
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function main
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def main(level, message, objects, pretty, jsonify, name, no_color, simple):
Function main
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def main(level, message, objects, pretty, jsonify, name, no_color, simple):
wryter = Wryte(name=name, pretty=pretty, level=level, jsonify=jsonify, color=not no_color, simple=simple)
objcts = []
- 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 add_handler
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_handler(self, handler, name=None, formatter='json', level='info'):
"""Add a handler to the logger instance and return its name.
A `handler` can be any standard `logging` handler.
`formatter` can be one of `console`, `json` or a formatter instance.
- 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 format
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def format(self, record):
"""Formats the message to be human readable
This formatter receives a dictionary as `msg`. It then removes
irrelevant fields and declare generates a string that looks like so:
- 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 _normalize_objects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _normalize_objects(objects):
"""Return a normalized dictionary for a list of key value like objects.
This supports parsing dicts, json strings and key=value pairs.
- 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_base
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _get_base(self, name, hostname, enable_ec2=False):
"""Generate base fields for each log message.
This is evaluated once when the logger's instance is instantiated.
It is then later copied by each log message.
- 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 add_file_handler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_file_handler(self):
if not self._env('HANDLERS_FILE_PATH'):
self.logger.warning('File handler file path not set')
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"