oshp/headers

View on GitHub

Showing 5 of 61 total issues

Function work_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def work_headers(self, topsites_row):
        try:
            site = Site({'id': topsites_row[0], 'domain': topsites_row[1]})
            response = self.scanner.connect(site['domain'])
            if response  or (response['status_code' == 200]):
Severity: Minor
Found in lib/scanner/headers.py - About 45 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 _header_name_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _header_name_table(self, data):
        count = 0
        table = {}
        for site in data:
            for header_name in site['headers'].keys():
Severity: Minor
Found in lib/database/rdms_db.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 siteinfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def siteinfo(site=''):
    '''Secure headers used by a specific <site>'''
    result = {}
    if site != '':
        configured_headers = db.query(SELECT_SITE_HEADERS.format(site_name=site))
Severity: Minor
Found in web/webui.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 _header_value_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _header_value_table(self, data):
        count = 0
        table = {}
        for site in data:
            for header_name in site['headers'].keys():
Severity: Minor
Found in lib/database/rdms_db.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def save(self, command, table_name, table):
        print('Table: {}'.format(table_name))
        conn = self.get_db_connection()
        cursor = conn.cursor()
        if type(table) is list:
Severity: Minor
Found in lib/database/rdms_db.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