uktrade/lite-forms

View on GitHub

Showing 32 of 39 total issues

Avoid too many return statements within this function.
Open

            return data["key"] == key
Severity: Major
Found in templatetags/custom_tags.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return True
    Severity: Major
    Found in templatetags/custom_tags.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return True
      Severity: Major
      Found in templatetags/custom_tags.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return True
        Severity: Major
        Found in templatetags/custom_tags.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return data
          Severity: Major
          Found in templatetags/custom_tags.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return False
            Severity: Major
            Found in templatetags/custom_tags.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return redirect(request.path)
              Severity: Major
              Found in views.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return data["id"] == key
                Severity: Major
                Found in templatetags/custom_tags.py - About 30 mins to fix

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

                  def _prepare_data(request, inject_data):
                      data = request.POST.copy()
                  
                      # Handle lists (such as checkboxes)
                      data = handle_lists(data)
                  Severity: Minor
                  Found in submitters.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 update_progress_indicators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def update_progress_indicators(self):
                          index = 0
                          if self.show_progress_indicators:
                              for form in self.forms:
                                  if form:
                  Severity: Minor
                  Found in components.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 convert_list_to_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def convert_list_to_tree(items, key="key", value="value", children="children", exclude=None):
                      return_value = []
                  
                      for item in items:
                          node = TreeNode(item[key], item[value])
                  Severity: Minor
                  Found in helpers.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 nest_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def nest_data(sent_data):
                      """
                      Nests strings into dictionaries eg
                      {
                          'site.name': 'SITE1'
                  Severity: Minor
                  Found in helpers.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