kigster/arli

View on GitHub

Showing 26 of 26 total issues

Method command_parsers has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def command_parsers
          @command_parsers ||= {
            search: Hashie::Mash.new(
              sentence: 'Search standard Arduino Library Database with over 4K entries ',
              description: %[This command provides both the simple name-based search interface,
Severity: Major
Found in lib/arli/cli/parser_factory.rb - About 4 hrs to fix

    Class Parser has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Parser < ::OptionParser
          attr_accessor :output_lines,
                        :command,
                        :config
    
    
    Severity: Minor
    Found in lib/arli/cli/parser.rb - About 3 hrs to fix

      Class MultiVersion has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class MultiVersion
            class << self
              def format_methods
                new({}).methods.grep(/^to_s_/).map { |m| m.to_s.gsub(/^to_s_/, '') }.map(&:to_sym)
              end
      Severity: Minor
      Found in lib/arli/library/multi_version.rb - About 2 hrs to fix

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

              def execute
                Dir.chdir(config.runtime.pwd) do
                  handle_preexisting_folder(path) if exists?
                  if Dir.exist?(temp_path) && !Dir.exist?(path)
                    FileUtils.mkdir_p(File.dirname(path))
        Severity: Minor
        Found in lib/arli/actions/move_to_library_path.rb - About 1 hr 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 run_system_command has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def run_system_command(*args)
                cmd = args.join(' ')
                raise 'No command to run was given' unless cmd
        
                info("\n" + cmd.green) if Arli.debug?
        Severity: Minor
        Found in lib/arli/helpers/system_commands.rb - About 1 hr 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 start has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def start
                if argv.empty?
                  factory.default_help
                  factory.global_parser.print_version_copyright
                  return
        Severity: Minor
        Found in lib/arli/cli/app.rb - About 1 hr 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 start has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def start
                if argv.empty?
                  factory.default_help
                  factory.global_parser.print_version_copyright
                  return
        Severity: Minor
        Found in lib/arli/cli/app.rb - About 1 hr to fix

          Method setup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                def setup
                  config.generate.project_name = config.runtime.argv.first
          
                  self.settings = config.generate
                  self.libraries = []
          Severity: Minor
          Found in lib/arli/commands/generate.rb - About 1 hr 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 identify_library has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def identify_library(arg)
                  results = if arg =~ %r[https?://]i
                              self.install_method = :url
                              result = search url: /^#{arg}$/i
          
          
          Severity: Minor
          Found in lib/arli/commands/install.rb - About 1 hr 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 to_s_long has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def to_s_long
                  lib_versions = versions.clone
                  latest       = lib_versions.pop
                  append do
                    "\nName:        #{lib.name.bold.yellow}\n" \
          Severity: Minor
          Found in lib/arli/library/multi_version.rb - About 1 hr 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 run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def run
                  Dir.chdir(workspace) do
                    run_with_info(
                      "Grabbing the template from\n • #{template_repo.bold.green}...",
                      "git clone -v #{template_repo} #{project_name} 2>&1"
          Severity: Minor
          Found in lib/arli/commands/generate.rb - About 1 hr to fix

            Method common_help_options has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def common_help_options
                    on('-C', '--no-color',
                       'Disable any color output.') do |*|
                      Colored2.disable! # if $stdout.tty?
                      config.no_color = true
            Severity: Minor
            Found in lib/arli/cli/parser.rb - About 1 hr to fix

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

                  def library_model(lib)
                    return lib if lib.is_a?(::Arduino::Library::Model)
              
                    ::Arduino::Library::Model.from(lib).tap do |model|
                      if model.nil?
              Severity: Minor
              Found in lib/arli/library.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

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

                    def process_search_options!
                      self.search_string = extract_search_argument!
                      raise_error_unless_search_string!
              
                      self.limit  = config.search.results.limit
              Severity: Minor
              Found in lib/arli/commands/search.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

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

                    def run_action(action_name)
                      klass = Arli::Actions.action(action_name)
                      if klass
                        action = klass.new(library, config: config)
                        if action.supported?
              Severity: Minor
              Found in lib/arli/library/installer.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

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

                    def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
              Severity: Minor
              Found in lib/arli/cli/runner.rb - About 35 mins to fix

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

                    def configure_via_arlifile!(mash)
                      if mash
                        config.libraries.path = mash.libraries_path if mash.libraries_path
                        config.arlifile.lock_format = mash.lock_format if mash.lock_format
                        self.device = mash.device if mash.device
                Severity: Minor
                Found in lib/arli/arli_file.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 read_dependencies has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def read_dependencies(libraries)
                      if libraries && !libraries.empty?
                        libraries.map { |lib| make_lib(lib) }
                      else
                        unless arlifile_path && File.exist?(arlifile_path)
                Severity: Minor
                Found in lib/arli/arli_file.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 option_help has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def option_help(commands: false, command_name: nil)
                        common_help_options
                        on('-h', '--help', 'prints this help') do
                          ::Arli.config.help = true
                
                
                Severity: Minor
                Found in lib/arli/cli/parser.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 output_command_description has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def output_command_description(command_name)
                        command_hash = factory.command_parsers[command_name]
                
                        if command_hash
                          if command_hash.description
                Severity: Minor
                Found in lib/arli/cli/parser.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