SpamExperts/OrangeAssassin

View on GitHub

Showing 287 of 802 total issues

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

    def test_interval(self, value):
        "Set the test_interval as relative delta object"
        if value.endswith("s"):
            self._test_interval = datetime.timedelta(seconds=int(value[:-1]))
        elif value.endswith("m"):
Severity: Minor
Found in oa/dns_interface.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 is_query_restricted has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def is_query_restricted(self, qname):
        """Checks whether the qname is restricted by the dns_query_restriction
        option if the qname or one of it's parent domains matches an entry in
        the restriction that is returned, by default qnames are not
        restricted
Severity: Minor
Found in oa/dns_interface.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 postparsing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def postparsing(self, ruleset, _depth=0):
        """Get the referenced sub-rules of this meta-rule and add execute the
        python code creating an appropriate match function for this meta-rule.
        """
        if _depth > MAX_RECURSION:
Severity: Minor
Found in oa/rules/meta.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 get_rule_kwargs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_rule_kwargs(data):
        """Extract the keyword arguments necessary to create a new instance
        for this class.
        """
        kwargs = dict()
Severity: Minor
Found in oa/rules/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

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

    def get_user_ruleset(self, user=None):
        """Get the corresponding ruleset for this user. If the
        `allow_user_rules` is not set to True then it will get
        the main ruleset loaded from the site files/

Severity: Minor
Found in oa/server.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 check_spf_whitelist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_spf_whitelist(self, msg, list_name):
        parsed_list = self.parse_list(list_name)
        if self[list_name]:
            if not self.check_for_spf_pass(msg):
                return False
Severity: Minor
Found in oa/plugins/spf.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 __getstate__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __getstate__(self):
        odict = self.__dict__.copy()  # copy the dict since we change it
        if "RelayCountryPlugin" in odict["plugin_data"]:
            del odict["plugin_data"]["RelayCountryPlugin"]["ipv4"]
            del odict["plugin_data"]["RelayCountryPlugin"]["ipv6"]
Severity: Minor
Found in oa/context.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