ANSSI-FR/polichombr

View on GitHub

Showing 85 of 1,244 total issues

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

def send_sample(sample="", family=None, tlp=None, api_key=""):
    """
        Send a sample using the SampleModule API
    """
    sapi = SampleModule(api_key=api_key)
Severity: Minor
Found in examples/send_sample.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 do_diff_samples has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def do_diff_samples(sid1, sid2):
    """
        Diff form has been submitted
    """
    sample1 = api.get_elem_by_type("sample", sid1)
Severity: Minor
Found in polichombr/views/webui_sample.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 register_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def register_user():
    """
    User registration, if enabled in configuration file.
    """
    if g.user.is_authenticated or not current_app.config['USERS_CAN_REGISTER']:
Severity: Minor
Found in polichombr/views/webui_user.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 machoc_diff_with_all_samples has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def machoc_diff_with_all_samples(cls, sample, level=0.8):
        """
            Diff a sample with all other samples. Class method.
        """
        if sample.functions.count() == 0:
Severity: Minor
Found in polichombr/controllers/sample.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_uncategorized_samples has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_user_uncategorized_samples(user, limit=15):
        """
            By user with no family.
        """
        samples = []
Severity: Minor
Found in polichombr/controllers/sample.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