app/controllers/api/v2/de_cocs_controller.rb

Summary

Maintainability
A
25 mins
Test Coverage
B
83%

Method has too many lines. [25/10]
Open

      def index
        results = []
        if params[:id]
          if !params[:id].include?(".")
            expires_in 3.minutes

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def index
        results = []
        if params[:id]
          if !params[:id].include?(".")
            expires_in 3.minutes
Severity: Minor
Found in app/controllers/api/v2/de_cocs_controller.rb - 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

Line is too long. [107/100]
Open

            data_elements = autocompleter.find(datalement_id, kind: "data_elements", fields: DE_COC_FIELDS)

Line is too long. [115/100]
Open

            results = autocompleter.data_elements_with_category_combos(data_elements, limit_to_coc_with_id: coc_id)

There are no issues that match your filters.

Category
Status