steromano87/Woodpecker

View on GitHub

Showing 43 of 51 total issues

File httpsequence.py has 621 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import abc
import re
import sys

import gevent
Severity: Major
Found in woodpecker/sequences/httpsequence.py - About 1 day to fix

    HttpSequence has 28 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class HttpSequence(BaseSequence):
        __metaclass__ = abc.ABCMeta
    
        def __init__(self,
                     settings=None,
    Severity: Minor
    Found in woodpecker/sequences/httpsequence.py - About 3 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def parse_query_string(self, query_string):
              for param_couple in query_string.split('&'):
                  split_params = param_couple.split('=')
                  self.params[urllib.unquote_plus(split_params[0])] = \
                      urllib.unquote_plus(split_params[1])
      Severity: Major
      Found in woodpecker/io/resources/htmlresource.py and 1 other location - About 1 hr to fix
      woodpecker/io/resources/htmlresource.py on lines 60..64

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 67.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function search_by_data has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def search_by_data(self, event_data):
              if isinstance(event_data, dict):
                  found = False
                  for event_key, event in six.iteritems(self.events):
                      for search_key, search_value in six.iteritems(event_data):
      Severity: Minor
      Found in woodpecker/io/correlators/event.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def parse_form_data(self, form_data):
              for param_couple in form_data.split('&'):
                  split_params = param_couple.split('=')
                  self.form_data[urllib.unquote_plus(split_params[0])] = \
                      urllib.unquote_plus(split_params[1])
      Severity: Major
      Found in woodpecker/io/resources/htmlresource.py and 1 other location - About 1 hr to fix
      woodpecker/io/resources/htmlresource.py on lines 54..58

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 67.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function _generate_http_request_entry has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def _generate_http_request_entry(self,
                                           event,
                                           is_resource=False,
                                           is_async=False):
              # Check for prepended events
      Severity: Minor
      Found in woodpecker/io/generators/html/httpsequencegenerator.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 var_from_regex has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def var_from_regex(self,
                             name,
                             regex,
                             target='body',
                             instances='first',
      Severity: Minor
      Found in woodpecker/sequences/httpsequence.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 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 _parse_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _parse_request(self, index, resource):
              """
              Parses a request into HtmlResource
      
              :param index:
      Severity: Minor
      Found in woodpecker/io/parsers/html/sazparser.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 _handle_event_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_event_list(self, event_list):
              for event in event_list:
                  if event.type in ('http_request', 'http_load_page'):
                      self._generate_load_page_entry(event)
                  elif event.type == 'http_load_resource':
      Severity: Minor
      Found in woodpecker/io/generators/html/httpsequencegenerator.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 http_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def http_request(self,
                           url,
                           method='GET',
                           is_resource=False,
                           response_hooks=None,
      Severity: Minor
      Found in woodpecker/sequences/httpsequence.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 _parse_request has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _parse_request(entry, resource):
              """
              Parses a request into HtmlResource
      
              :param entry:
      Severity: Minor
      Found in woodpecker/io/parsers/html/harparser.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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def get(self, name):
              if name not in six.viewkeys(self._reserved_variables):
                  if name in six.viewkeys(self._public_variables):
                      return self._public_variables.get(name)
                  else:
      Severity: Minor
      Found in woodpecker/io/variablejar.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 _parse_response has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _parse_response(self, index, resource):
              """
              Parses a response into HtmlResource
      
              :param index:
      Severity: Minor
      Found in woodpecker/io/parsers/html/sazparser.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Minor
      Found in woodpecker/sequences/basesequence.py - About 45 mins to fix

        Function http_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def http_request(self,
        Severity: Minor
        Found in woodpecker/sequences/httpsequence.py - About 45 mins to fix

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

              def delete(self, name):
                  if name not in six.viewkeys(self._reserved_variables):
                      if name in six.viewkeys(self._public_variables):
                          self._public_variables.pop(name)
                          self._reserved_variables['last_updated_on'] = \
          Severity: Minor
          Found in woodpecker/io/variablejar.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self,
          Severity: Minor
          Found in woodpecker/sequences/httpsequence.py - About 45 mins to fix

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

                def patch(self,
            Severity: Minor
            Found in woodpecker/sequences/httpsequence.py - About 35 mins to fix
              Severity
              Category
              Status
              Source
              Language