carlossg/librarian

View on GitHub

Showing 34 of 34 total issues

Class Environment has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Environment

    include Support::AbstractMethod

    attr_accessor :ui
Severity: Minor
Found in lib/librarian/environment.rb - About 4 hrs to fix

    Class Database has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Database
    
          class << self
            def library
              name.split("::").first.downcase
    Severity: Minor
    Found in lib/librarian/config/database.rb - About 4 hrs to fix

      Class ManifestSet has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class ManifestSet
      
          class << self
            def shallow_strip(manifests, names)
              new(manifests).shallow_strip!(names).send(method_for(manifests))
      Severity: Minor
      Found in lib/librarian/manifest_set.rb - About 2 hrs to fix

        Class Implementation has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Implementation
        
              class MultiSource
                attr_accessor :sources
                def initialize(sources)
        Severity: Minor
        Found in lib/librarian/resolver/implementation.rb - About 2 hrs to fix

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

                def cache!
                  repository_cached? and return or repository_cached!
          
                  unless repository.git?
                    repository.path.rmtree if repository.path.exist?
          Severity: Minor
          Found in lib/librarian/source/git.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

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

            class Cli < Thor
          
              autoload :ManifestPresenter, "librarian/cli/manifest_presenter"
          
              include Thor::Actions
          Severity: Minor
          Found in lib/librarian/cli.rb - About 2 hrs to fix

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

                  class Repository
            
                    class << self
                      def clone!(environment, path, repository_url)
                        path = Pathname.new(path)
            Severity: Minor
            Found in lib/librarian/source/git/repository.rb - About 2 hrs to fix

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

                class SpecChangeSet
              
                  attr_accessor :environment
                  private :environment=
                  attr_reader :spec, :lock
              Severity: Minor
              Found in lib/librarian/spec_change_set.rb - About 2 hrs to fix

                Method config has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    def config(key = nil, value = nil)
                      if key
                        raise Error, "cannot set both value and delete" if value && options["delete"]
                        if options["delete"]
                          scope = config_scope(true)
                Severity: Minor
                Found in lib/librarian/cli.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

                Class Manifest has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Manifest
                
                    attr_accessor :source, :name, :extra
                    private :source=, :name=, :extra=
                
                
                Severity: Minor
                Found in lib/librarian/manifest.rb - About 2 hrs to fix

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

                      def enforce_consistency!(dependencies, manifests)
                        manifest_set = ManifestSet.new(manifests)
                        return if manifest_set.in_compliance_with?(dependencies)
                        return if manifest_set.consistent?
                  
                  
                  Severity: Minor
                  Found in lib/librarian/resolver.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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def run(specfile = nil, sources = [], &block)
                        specfile, sources = nil, specfile if specfile.kind_of?(Array) && sources.empty?
                  
                        Target.new(self).tap do |target|
                          target.precache_sources(sources)
                  Severity: Minor
                  Found in lib/librarian/dsl.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 enforce_consistency! has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def enforce_consistency!(dependencies, manifests)
                        manifest_set = ManifestSet.new(manifests)
                        return if manifest_set.in_compliance_with?(dependencies)
                        return if manifest_set.consistent?
                  
                  
                  Severity: Minor
                  Found in lib/librarian/resolver.rb - About 1 hr to fix

                    Method logging_command has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def logging_command(command, options)
                              silent = options.delete(:silent)
                    
                              pwd = Dir.pwd
                    
                    
                    Severity: Minor
                    Found in lib/librarian/source/git/repository.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 logging_command has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def logging_command(command, options)
                              silent = options.delete(:silent)
                    
                              pwd = Dir.pwd
                    
                    
                    Severity: Minor
                    Found in lib/librarian/source/git/repository.rb - About 1 hr to fix

                      Method do_resolve has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def do_resolve(state)
                              stack = [state]
                              while !stack.empty? do
                                state = stack.pop
                                shift_resolved_enqueued_dependencies(state) or return
                      Severity: Minor
                      Found in lib/librarian/resolver/implementation.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 extract_and_parse_sources has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def extract_and_parse_sources(lines)
                              sources = []
                              while source_type_names.include?(lines.first)
                                source = {}
                                source_type_name = lines.shift
                      Severity: Minor
                      Found in lib/librarian/lockfile/parser.rb - About 1 hr to fix

                        Method debug has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def debug(string = nil, &block)
                              return unless ui
                        
                              if ui.respond_to?(:debug_line_numbers) && ui.debug_line_numbers
                                loc = caller.find{|l| !(l =~ /in `debug'$/)}
                        Severity: Minor
                        Found in lib/librarian/logger.rb - About 55 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! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                                  def run!(command, options = { })
                                    i, o, e = IO.pipe, IO.pipe, IO.pipe
                                    pid = fork do
                                      $stdin.reopen i[0]
                                      $stdout.reopen o[1]
                        Severity: Minor
                        Found in lib/librarian/posix.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 extract_and_parse_sources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def extract_and_parse_sources(lines)
                                sources = []
                                while source_type_names.include?(lines.first)
                                  source = {}
                                  source_type_name = lines.shift
                        Severity: Minor
                        Found in lib/librarian/lockfile/parser.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

                        Severity
                        Category
                        Status
                        Source
                        Language