Showing 7 of 7 total issues

Function generate has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

def generate(date_from="1800-01-01",
             date_to=datetime.today().strftime('%Y-%m-%d'),
             gender=None,
             region=None,
             limit=10):
Severity: Minor
Found in egn/__init__.py - About 6 hrs 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

File __init__.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import argparse
import sys
import random
from datetime import timedelta, datetime
Severity: Minor
Found in egn/__init__.py - About 2 hrs to fix

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

    def calc_args(parser):
        '''
            Method to parse the argparse values and return an output.
        '''
    
    
    Severity: Minor
    Found in egn/__init__.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

    Avoid deeply nested control flow statements.
    Open

                        if counter > limit:
                            return egns
        return egns
    Severity: Major
    Found in egn/__init__.py - About 45 mins to fix

      Function generate has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def generate(date_from="1800-01-01",
      Severity: Minor
      Found in egn/__init__.py - About 35 mins to fix

        Function validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def validate(egn):
            '''
                Check Bulgarian EGN codes for validity
                full information about algoritm is available here
                http://www.grao.bg/esgraon.html#section2
        Severity: Minor
        Found in egn/__init__.py - About 35 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

        Function generate_random has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def generate_random(gender=None,
                            region=None,
                            limit=10):
            """
            Generate a random EGN.
        Severity: Minor
        Found in egn/__init__.py - About 25 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