piotrmurach/tty

View on GitHub

Showing 8 of 10 total issues

Class Add has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Add < TTY::Cmd
      include PathHelpers

      attr_reader :app_name

Severity: Minor
Found in lib/tty/commands/add.rb - About 4 hrs to fix

    Method execute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def execute(input: $stdin, output: $stdout)
            output.puts "OPTS: #{options}" if options["debug"]
    
            coc_opt  = options["coc"] ? "--coc" : "--no-coc"
            ext_opt  = options["ext"] ? "--ext" : "--no-ext"
    Severity: Minor
    Found in lib/tty/commands/new.rb - About 2 hrs 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 execute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

          def execute(input: $stdin, output: $stdout)
            validate_pwd
            validate_cmd_name(cmd_name)
    
            test_dir = (options["test"] == "rspec") || ::Dir.exist?("spec") ? "spec" : "test"
    Severity: Minor
    Found in lib/tty/commands/add.rb - About 2 hrs 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 execute has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def execute(input: $stdin, output: $stdout)
            validate_pwd
            validate_cmd_name(cmd_name)
    
            test_dir = (options["test"] == "rspec") || ::Dir.exist?("spec") ? "spec" : "test"
    Severity: Major
    Found in lib/tty/commands/add.rb - About 2 hrs to fix

      File add.rb has 251 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "ostruct"
      
      require_relative "../cmd"
      require_relative "../templater"
      
      
      Severity: Minor
      Found in lib/tty/commands/add.rb - About 2 hrs to fix

        Method execute has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def execute(input: $stdin, output: $stdout)
                output.puts "OPTS: #{options}" if options["debug"]
        
                coc_opt  = options["coc"] ? "--coc" : "--no-coc"
                ext_opt  = options["ext"] ? "--ext" : "--no-ext"
        Severity: Minor
        Found in lib/tty/commands/new.rb - About 1 hr to fix

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

              def format_gem_dependencies(dependencies = gemspec_dependencies)
                gems = []
                indent = " " * pre_var_indent
                dependencies.each do |gem|
                  if gem.comment
          Severity: Minor
          Found in lib/tty/gemspec.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 cmd_desc_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def cmd_desc_args
                  return "" unless @options[:args].any?
          
                  " " + @options[:args].map do |arg|
                    if arg.start_with?("*")
          Severity: Minor
          Found in lib/tty/commands/add.rb - About 25 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