wooyek/fakturownia-python

View on GitHub

Showing 4 of 10 total issues

Function parse_env has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def parse_env(content):  # pragma: no cover
    # content = six.u(content)
    # This comes from evnparse.Env.read_envfile. Kudos!
    for line in content.splitlines():
        if line.startswith("#"):
Severity: Minor
Found in src/fakturownia/settings.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

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

    def request(self, method, endpoint, params=None, payload=None, headers=None):
Severity: Minor
Found in src/fakturownia/core.py - About 35 mins to fix

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

        def normalize_vat(self, default_rate=None, intra_eu_vat_rate='np'):
            """This is a common business logic that maybe helpful in handling EU to EU invoicing"""
            eu_member_states = vat.eu_member_state_vat.keys()
            default_rate = default_rate or vat.get_standard_vat_rate(self.seller_country)
            if self.buyer_country not in eu_member_states:
    Severity: Minor
    Found in src/fakturownia/endpoints.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

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

        def prepare_post_data(self, **kwargs):
            data = kwargs or self._data.copy()
            if 'id' in self._data and 'id' not in data:
                data['id'] = self._data['id']
            for key in self._readonly:
    Severity: Minor
    Found in src/fakturownia/base.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