anamartinez/ruby-cldr-timezones

View on GitHub

Showing 2 of 2 total issues

File vars.rb has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Cldr::Timezones::UTC_OFFSET_WITH_COLON = '%s%02d:%02d'

#Just like in ActiveSupport::TimeZone we are providing a meaningful subset of 124 of timezones.
#However we are providing a subset that exists in CLDR.

Severity: Minor
Found in lib/cldr/timezones/vars.rb - About 2 hrs to fix

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

          def timezones_hash(locale, options)
            options_hash(options)
            timezones_translations = load_timezones_translations(locale)
            fallback = fallback(locale)
            timezones_identifiers = (@all ? TZInfo::Timezone.all : SUBSET_TIMEZONES)
    Severity: Minor
    Found in lib/cldr/timezones.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

    Severity
    Category
    Status
    Source
    Language