davispuh/TimezoneParser

View on GitHub
lib/timezone_parser.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

    def self.getTimezones(name, toTime = nil, fromTime = nil, regions = @@Regions, locales = @@Locales, type = nil, all = true, modules = @@Modules)
        timezones = SortedSet.new
        modules = AllModules if modules.nil? or modules.empty?
        timezones += Abbreviation::getTimezones(name, toTime, fromTime, regions, type) if modules.include?(:Abbreviations)
        return timezones.to_a if not all and not timezones.empty?
Severity: Minor
Found in lib/timezone_parser.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 getOffsets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def self.getOffsets(name, toTime = nil, fromTime = nil, regions = @@Regions, locales = @@Locales, type = nil, all = true, modules = @@Modules)
        offsets = SortedSet.new
        modules = AllModules if modules.nil? or modules.empty?
        offsets += Abbreviation::getOffsets(name, toTime, fromTime, regions, type) if modules.include?(:Abbreviations)
        return offsets.to_a if not all and not offsets.empty?
Severity: Minor
Found in lib/timezone_parser.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 getTimezones has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.getTimezones(name, toTime = nil, fromTime = nil, regions = @@Regions, locales = @@Locales, type = nil, all = true, modules = @@Modules)
Severity: Major
Found in lib/timezone_parser.rb - About 1 hr to fix

    Method getOffsets has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.getOffsets(name, toTime = nil, fromTime = nil, regions = @@Regions, locales = @@Locales, type = nil, all = true, modules = @@Modules)
    Severity: Major
    Found in lib/timezone_parser.rb - About 1 hr to fix

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

          def self.isValid?(name, locales = @@Locales, modules = @@Modules)
              valid = false
              modules = AllModules if modules.nil? or modules.empty?
              valid = Abbreviation::isValid?(name) if modules.include?(:Abbreviations)
              return valid if valid
      Severity: Minor
      Found in lib/timezone_parser.rb - 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

      There are no issues that match your filters.

      Category
      Status