versioneye/naturalsorter

View on GitHub
lib/version_tag_recognizer.rb

Summary

Maintainability
F
3 days
Test Coverage

Method does_it_fit_stability? has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def self.does_it_fit_stability?( version_number, stability )
    patch = self.patch?( version_number )
    return true if (stability.casecmp( A_STABILITY_PATCH ) == 0) && patch

    stable = self.stable?( version_number )
Severity: Minor
Found in lib/version_tag_recognizer.rb - About 2 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

Method stability_tag_for has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def self.stability_tag_for( version )
    if version.to_s.match(/@.*$/)
      spliti = version.split("@")
      return spliti[1]
    else
Severity: Minor
Found in lib/version_tag_recognizer.rb - 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

Method stable? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def self.stable? value
    return true if value.to_s.empty?
    return false if value.to_s.match(/\Adev-/i) || value.to_s.match(/-dev\z/i)
    return false if self.preview?( value )

Severity: Minor
Found in lib/version_tag_recognizer.rb - 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

Method value_for has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.value_for( value )
    return 0  if self.dev? value
    return 2  if self.snapshot? value
    return 3  if self.alpha? value
    return 4  if self.beta? value
Severity: Minor
Found in lib/version_tag_recognizer.rb - 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

Method value_for_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.value_for_key( value )
    return 0  if A_STABILITY_DEV.eql? value
    return 2  if A_STABILITY_SNAPSHOT.eql? value
    return 3  if A_STABILITY_ALPHA.eql? value
    return 4  if A_STABILITY_BETA.eql? value
Severity: Minor
Found in lib/version_tag_recognizer.rb - 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

Method tagged? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.tagged? value
    return true if self.patch?(value)
    return true if self.alpha?(value)
    return true if self.beta?(value)
    return true if self.dev?(value)
Severity: Minor
Found in lib/version_tag_recognizer.rb - 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

Method remove_tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.remove_tag value
    if self.patch? value
      return value.gsub(/\.patch.*$/i, "")
    elsif self.alpha? value
      new_value = value.gsub(/\.[\w-]*alpha.*$/i, "")
Severity: Minor
Found in lib/version_tag_recognizer.rb - 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

Avoid too many return statements within this method.
Open

    return 11 if self.patch? value
Severity: Major
Found in lib/version_tag_recognizer.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return 5  if A_STABILITY_RC.eql? value
    Severity: Major
    Found in lib/version_tag_recognizer.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return true if value.to_s.match(/.*patch.*/i)
      Severity: Major
      Found in lib/version_tag_recognizer.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return true if self.rc?(value)
        Severity: Major
        Found in lib/version_tag_recognizer.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return value.gsub(/\.jbossorg.*$/i, "")
          Severity: Major
          Found in lib/version_tag_recognizer.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return A_STABILITY_SNAPSHOT
            Severity: Major
            Found in lib/version_tag_recognizer.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return true if value.to_s.match(/.+FINAL.*/i)
              Severity: Major
              Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return 6  if self.pre? value
                Severity: Major
                Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return 1
                  Severity: Major
                  Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                        return false
                    Severity: Major
                    Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                          return 5  if self.rc? value
                      Severity: Major
                      Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                            return true if value.to_s.match(/.+GA.*/i)
                        Severity: Major
                        Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                              return 6  if A_STABILITY_PRE.eql? value
                          Severity: Major
                          Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                return 10 if A_STABILITY_STABLE.eql? value
                            Severity: Major
                            Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                  return 1
                              Severity: Major
                              Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                    return true if self.pre?(value)
                                Severity: Major
                                Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                        return value.gsub(/\.snapshot.*$/i, "")
                                  Severity: Major
                                  Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                        return false
                                    Severity: Major
                                    Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return A_STABILITY_RC
                                      Severity: Major
                                      Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return A_STABILITY_BETA
                                        Severity: Major
                                        Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                return value.gsub(/\.[\w-]*pre.*$/i, "")
                                          Severity: Major
                                          Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                    return A_STABILITY_PRE
                                            Severity: Major
                                            Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                      return A_STABILITY_ALPHA
                                              Severity: Major
                                              Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                    return value
                                                Severity: Major
                                                Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                      return true if (stability.casecmp( A_STABILITY_BETA ) == 0) && beta
                                                  Severity: Major
                                                  Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                        return true if value.to_s.match(/.+SP.*/i)
                                                    Severity: Major
                                                    Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                          return true if (stability.casecmp( A_STABILITY_DEV )      == 0)
                                                      Severity: Major
                                                      Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                            return 11 if A_STABILITY_PATCH.eql? value
                                                        Severity: Major
                                                        Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                              return 10 if self.stable? value
                                                          Severity: Major
                                                          Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                return true if self.snapshot?(value)
                                                            Severity: Major
                                                            Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                  return true if self.jbossorg?(value)
                                                              Severity: Major
                                                              Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                    return true if (stability.casecmp( A_STABILITY_ALPHA ) == 0) && alpha
                                                                Severity: Major
                                                                Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                      return true if (stability.casecmp( A_STABILITY_SNAPSHOT ) == 0) && snapshot
                                                                  Severity: Major
                                                                  Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                            return A_STABILITY_DEV
                                                                    Severity: Major
                                                                    Found in lib/version_tag_recognizer.rb - About 30 mins to fix

                                                                      There are no issues that match your filters.

                                                                      Category
                                                                      Status