SpeciesFileGroup/taxonworks

View on GitHub
lib/generators/taxon_works/task/task_generator.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method has too many lines. [38/25]
Open

  def add_scopes_to_routes
    scopes = ['scope :tasks']
    scope_index = 0

    @paths.each do |path|

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method add_scopes_to_routes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def add_scopes_to_routes
    scopes = ['scope :tasks']
    scope_index = 0

    @paths.each do |path|
Severity: Minor
Found in lib/generators/taxon_works/task/task_generator.rb - About 1 hr to fix

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

      def add_scopes_to_routes
        scopes = ['scope :tasks']
        scope_index = 0
    
        @paths.each do |path|
    Severity: Minor
    Found in lib/generators/taxon_works/task/task_generator.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

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

          puts Rainbow("* Restart your rails development server and confirm the new 'TODO: Task name' card exists and resolves").blue

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

          puts Rainbow(error_str).red

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

          puts Rainbow('--vue is incompatible with method action names, an index is created by default').red

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

          puts "ERROR: Couldn't find 'task' scope!"

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

            puts "ERROR: \"#{innermost_scope_str}\" already exists!"

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

          puts Rainbow('* Update the generated code throught changing "vue-task" to something specific').blue

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    Do not write to stdout. Use Rails's logger if you want to log.
    Open

          puts "Next steps:"

    This cop checks for the use of output calls like puts and print

    Example:

    # bad
    puts 'A debug message'
    pp 'A debug message'
    print 'A debug message'
    
    # good
    Rails.logger.debug 'A debug message'

    TODO found
    Open

        user_tasks_str += "  name: 'TODO: Task name'\n"

    TODO found
    Open

        user_tasks_str += "  description: 'TODO: Task description'\n"

    TODO found
    Open

          puts Rainbow("* Restart your rails development server and confirm the new 'TODO: Task name' card exists and resolves").blue

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

          puts "Next steps:"

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    There are no issues that match your filters.

    Category
    Status