eagletmt/akabei

View on GitHub

Showing 9 of 9 total issues

Method parse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse(data)
      info = new
      data.each_line do |line|
        line.strip!
        next if line.start_with?('#')
Severity: Minor
Found in lib/akabei/package_info.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 to_entry has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def to_entry
      entry = PackageEntry.new
      %w[
        filename
        name
Severity: Minor
Found in lib/akabei/package.rb - About 1 hr to fix

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

        def system(args, opts)
          opts = opts.dup
          env = {}
          opts.delete(:env).tap do |e|
            break unless e
    Severity: Minor
    Found in lib/akabei/system.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 init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def init(name)
            # Check key's validity
            if options[:repo_key]
              Signer.new(options[:repo_key])
            end
    Severity: Minor
    Found in lib/akabei/omakase/cli.rb - About 1 hr to fix

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

            def validate!
              REQUIRED_ATTRIBUTES.each do |attr|
                unless @config.has_key?(attr)
                  raise InvalidConfig.new("#{attr.inspect} is required")
                end
      Severity: Minor
      Found in lib/akabei/omakase/config.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 archive_all has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def archive_all(src, dest, comp, format)
            Archive::Writer.open_filename(dest.to_s, comp, format) do |archive|
              list_tree_paths(src).sort.each do |path|
                archive.new_entry do |entry|
                  entry.pathname = path.relative_path_from(src).to_s
      Severity: Minor
      Found in lib/akabei/archive_utils.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 build_in_chroot has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def build_in_chroot(builder, chroot, repo_db, repo_files, abs, package_dir)
      Severity: Minor
      Found in lib/akabei/build_helper.rb - About 45 mins to fix

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

            def load(path)
              path = Pathname.new(path)
              return unless path.readable?
              verify!(path)
              db = {}
        Severity: Minor
        Found in lib/akabei/repository.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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def add(key, val)
              ivar = "@#{key}".intern
              if ARRAY_ATTRIBUTES.include?(key)
                instance_variable_get(ivar) << val
              elsif DESC_ATTRIBUTES.include?(key)
        Severity: Minor
        Found in lib/akabei/package_entry.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