steromano87/Woodpecker

View on GitHub
woodpecker/io/correlators/htmlcorrelator.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function get_wn_headers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def get_wn_headers(self):
        # Retrieve white noise headers
        for index, entry in enumerate(self._parsed_entries.get('entries', [])):
            if index == 0:
                self.wn_headers = entry.request.headers
Severity: Minor
Found in woodpecker/io/correlators/htmlcorrelator.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

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

    def calculate_events(self,
                         think_time_threshold=3.0,
                         new_sequence_threshold=7.0):
        previous_entry = HtmlResource()

Severity: Minor
Found in woodpecker/io/correlators/htmlcorrelator.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

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

    def _add_http_redirect_event(self, entry, previous_entry=HtmlResource()):
        event = self._create_http_request_event(entry, 'http_redirect')
        if entry.url in \
                previous_entry.response.headers.get('Location', ''):
            # Try to add the redirect to the direct first level event
Severity: Minor
Found in woodpecker/io/correlators/htmlcorrelator.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 get_redirects has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_redirects(self):
        for entry in self._parsed_entries.get('entries', []):
            # If the response has a Location and the status is a 3XX,
            # add the location to redirects
            for header_name, header_value \
Severity: Minor
Found in woodpecker/io/correlators/htmlcorrelator.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 _create_http_request_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_http_request_event(self, entry, type_name):
        event = Event(type_name, event_id=entry.url)

        # Clean headers from white noise headers
        cleaned_headers = deepcopy(entry.request.headers)
Severity: Minor
Found in woodpecker/io/correlators/htmlcorrelator.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_referers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_referers(self):
        # Start reading the loaded entries and getting the Referers
        for entry in self._parsed_entries.get('entries', []):
            # If the call has a referer, add the referer to list
            for header_name, header_value \
Severity: Minor
Found in woodpecker/io/correlators/htmlcorrelator.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

There are no issues that match your filters.

Category
Status