Short-cm/amazon-ses-template-editor

View on GitHub

Showing 2 of 2 total issues

Function upload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def upload(config, args, prefix=''):
    for template_conf in config['templates']:
        if args.template is not None and template_conf['name'] != args.template:
            continue
        html_part = open(template_conf['html']).read()
Severity: Minor
Found in amazon-ses-template-editor.py - About 1 hr to fix

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 configure_handler has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def configure_handler(config):
    class HB2Handler(http.server.BaseHTTPRequestHandler):
        def render_template(self, template_name):
            matching_templates = list(filter(lambda t: t['template'] == template_name, self.config['test']))
            if not matching_templates:
Severity: Minor
Found in amazon-ses-template-editor.py - About 55 mins to fix

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

Severity
Category
Status
Source
Language