MiraitSystems/enju_trunk

View on GitHub
app/models/sequence_pattern.rb

Summary

Maintainability
C
1 day
Test Coverage

Method get_next_number has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

  def get_next_number(current_volume, current_issue)
    next_volume = self.volume_param.nil? ? nil : current_volume
    next_issue = self.issue_param.nil? ? nil : current_issue

    next_issue = current_issue + self.issue_param if current_issue && self.issue_param
Severity: Minor
Found in app/models/sequence_pattern.rb - About 6 hrs 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

Avoid deeply nested control flow statements.
Open

            next_issue = 2 if Keycode.find(issue_sequence_type).try(:v).to_i == 4
Severity: Major
Found in app/models/sequence_pattern.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                next_volume = current_volume + self.volume_param if self.volume_param && (vol > current_volume)
    Severity: Major
    Found in app/models/sequence_pattern.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  next_issue = 1 if self.issue_param
      Severity: Major
      Found in app/models/sequence_pattern.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    next_volume = current_volume + self.volume_param if current_volume && self.volume_param
        Severity: Major
        Found in app/models/sequence_pattern.rb - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status