twitter/twitter-cldr-rb

View on GitHub

Showing 209 of 209 total issues

Method elements has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def elements(node, kind, context, width, options = {})
Severity: Minor
Found in lib/twitter_cldr/resources/calendars_importer.rb - About 35 mins to fix

    Method format_display_name has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def format_display_name(date, type, fmt, dst = TZInfo::Timezone.default_dst, &block)
    Severity: Minor
    Found in lib/twitter_cldr/timezones/generic_location.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def initialize(direction, left, right, original_rule_text, index)
      Severity: Minor
      Found in lib/twitter_cldr/transforms/conversions/conversion_rule.rb - About 35 mins to fix

        Method arraycopy has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def arraycopy(orig, orig_index, dest, dest_index, length)
        Severity: Minor
        Found in lib/twitter_cldr/shared/bidi.rb - About 35 mins to fix

          Method format_tokens has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def format_tokens(tokens, format, hour, min, sec)
          Severity: Minor
          Found in lib/twitter_cldr/timezones/gmt_location.rb - About 35 mins to fix

            Method format_offset has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def format_offset(offset, is_basic, use_utc_indicator, is_short, ignore_seconds)
            Severity: Minor
            Found in lib/twitter_cldr/timezones/iso8601_location.rb - About 35 mins to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                    def engine
                      @engine ||= BrahmicBreakEngine.new(
                        # How many words in a row are "good enough"?
                        lookahead: 3,
              
              
              Severity: Minor
              Found in lib/twitter_cldr/segmentation/burmese_break_engine.rb and 2 other locations - About 35 mins to fix
              lib/twitter_cldr/segmentation/khmer_break_engine.rb on lines 32..59
              lib/twitter_cldr/segmentation/lao_break_engine.rb on lines 32..59

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                    def engine
                      @engine ||= BrahmicBreakEngine.new(
                        # How many words in a row are "good enough"?
                        lookahead: 3,
              
              
              Severity: Minor
              Found in lib/twitter_cldr/segmentation/khmer_break_engine.rb and 2 other locations - About 35 mins to fix
              lib/twitter_cldr/segmentation/burmese_break_engine.rb on lines 32..59
              lib/twitter_cldr/segmentation/lao_break_engine.rb on lines 32..59

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                    def engine
                      @engine ||= BrahmicBreakEngine.new(
                        # How many words in a row are "good enough"?
                        lookahead: 3,
              
              
              Severity: Minor
              Found in lib/twitter_cldr/segmentation/lao_break_engine.rb and 2 other locations - About 35 mins to fix
              lib/twitter_cldr/segmentation/burmese_break_engine.rb on lines 32..59
              lib/twitter_cldr/segmentation/khmer_break_engine.rb on lines 32..59

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 36.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                    def includes_range?(range)
                      result = bsearch do |cur_range|
                        fo = front_overlap?(cur_range, range)
                        ro = rear_overlap?(cur_range, range)
              
              
              Severity: Minor
              Found in lib/twitter_cldr/utils/range_set.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

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

                    def partial_location_name_for(metazone, mz_name)
                      region_code = ZoneMeta.canonical_country_for(tz_id)
              
                      location = if region_code
                        if region_code == metazone.reference_region_code
              Severity: Minor
              Found in lib/twitter_cldr/timezones/generic_location.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

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

                      def load
                        results = Hash.new do |h, k|
                          h[k] = Hash.new { |h, k| h[k] = [] }
                        end
              
              
              Severity: Minor
              Found in lib/twitter_cldr/resources/properties/property_importer.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

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

                    def sample(sample_size = 1)
                      sample_set = Set.new
                      counter = 1
              
                      until sample_set.size == sample_size
              Severity: Minor
              Found in lib/twitter_cldr/shared/postal_code_generator.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

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

                    def parse_number(number, options = {})
                      precision = options[:precision] || precision_from(number)
                      rounding = options[:rounding] || 0
              
                      if number.is_a? BigDecimal
              Severity: Minor
              Found in lib/twitter_cldr/formatters/numbers/number_formatter.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

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

                    def deep_merge!(first, second)
                      if first.is_a?(Hash) && second.is_a?(Hash)
                        second.each { |key, val| first[key] = deep_merge!(first[key], val) }
                      elsif first.is_a?(Array) && second.is_a?(Array)
                        second.each_with_index { |elem, index| first[index] = deep_merge!(first[index], elem) }
              Severity: Minor
              Found in lib/twitter_cldr/utils.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

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

                    def traverse_hash(hash, path, &block)
                      return if path.empty?
              
                      path.inject(hash) do |current, key|
                        return unless current.is_a?(Hash)
              Severity: Minor
              Found in lib/twitter_cldr/utils.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

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

                    def expand(pattern)
                      if pattern.is_a?(Symbol)
                        # symbols mean another path was given
                        path = pattern.to_s.split(".").map(&:to_sym)
                        data = data_reader.pattern_at_path(path)
              Severity: Minor
              Found in lib/twitter_cldr/tokenizers/pattern_tokenizer.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

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

                    def intersection(range_set)
                      new_ranges = []
              
                      range_set.ranges.each do |their_range|
                        ranges.each do |our_range|
              Severity: Minor
              Found in lib/twitter_cldr/utils/range_set.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

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

                    def tailoring_data(locale)
                      doc = get_collation_xml(locale).at_xpath('//collations')
              
                      collations = doc.at_xpath('//collations')
              
              
              Severity: Minor
              Found in lib/twitter_cldr/resources/tailoring_importer.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

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

                    def era(date, pattern, length, options = {})
                      choices = case length
                        when 0
                          ["", ""]
                        when 1..3
              Severity: Minor
              Found in lib/twitter_cldr/formatters/calendars/date_time_formatter.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

              Severity
              Category
              Status
              Source
              Language