folkengine/random_name_generator

View on GitHub

Showing 3 of 3 total issues

Class RNGSyllable has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

class RNGSyllable
  attr_reader :raw, :syllable, :next_syllable_requirement, :previous_syllable_requirement

  VOWELS ||= %w[i y ɨ ʉ ɯ u ɪ ʏ ʊ ɯ ʊ e ø ɘ ɵ ɤ o ø ə ɵ ɤ o ɛ œ ɜ ɞ ʌ ɔ æ ɐ ɞ a ɶ ä ɒ ɑ].freeze
  CONSONANTS ||= %w[b ɓ ʙ β c d ɗ ɖ ð f g h j k l ł m ɱ n ɳ p q r s t v w x y z].freeze
Severity: Minor
Found in lib/random_name_generator/rng_syllable.rb - About 2 hrs to fix

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

      def refresh
        @file.readlines.each do |line|
          syllable = RNGSyllable.new(line) unless line.empty?
          if syllable.prefix?
            @pre_syllables.push(syllable)
    Severity: Minor
    Found in lib/random_name_generator/random_name_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

    required_ruby_version (2.2, declared in random_name_generator.gemspec) and TargetRubyVersion (2.1, declared in .rubocop.yml) should be equal.
    Open

      spec.required_ruby_version = '>= 2.2'
    Severity: Minor
    Found in random_name_generator.gemspec by rubocop

    Checks that required_ruby_version of gemspec and TargetRubyVersion of .rubocop.yml are equal. Thereby, RuboCop to perform static analysis working on the version required by gemspec.

    Example:

    # When `TargetRubyVersion` of .rubocop.yml is `2.3`.
    
    # bad
    Gem::Specification.new do |spec|
      spec.required_ruby_version = '>= 2.2.0'
    end
    
    # bad
    Gem::Specification.new do |spec|
      spec.required_ruby_version = '>= 2.4.0'
    end
    
    # good
    Gem::Specification.new do |spec|
      spec.required_ruby_version = '>= 2.3.0'
    end
    
    # good
    Gem::Specification.new do |spec|
      spec.required_ruby_version = '>= 2.3'
    end
    
    # good
    Gem::Specification.new do |spec|
      spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
    end
    Severity
    Category
    Status
    Source
    Language