SUSE/machinery

View on GitHub

Showing 187 of 267 total issues

File cli.rb has 1088 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Machinery
  class Cli
    extend GLI::App

    program_desc "A systems management toolkit for Linux"
Severity: Major
Found in lib/cli.rb - About 2 days to fix

    Method content has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Open

          def content(description)
            return unless description.repositories
    
            if description.repositories.empty?
              puts "There are no repositories."
    Severity: Minor
    Found in plugins/repositories/repositories_renderer.rb - About 1 day 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 content has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

          def content(description)
            return unless description["unmanaged_files"]
    
            list do
              file_status = description["unmanaged_files"].extracted
    Severity: Minor
    Found in plugins/unmanaged_files/unmanaged_files_renderer.rb - About 7 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 list has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

      def list(store, system_descriptions, options = {})
        if options[:html]
          list_html(store, options)
        else
          if system_descriptions.empty?
    Severity: Minor
    Found in lib/list_task.rb - About 6 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

    File salt_states.rb has 362 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Machinery
      # TODO(gyee): add .repositories
      # NOTE(gyee): the order matters
      SALT_INIT_SLS = %(include:
      - .groups
    Severity: Minor
    Found in lib/salt_states.rb - About 4 hrs to fix

      Method parse_changes_line has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse_changes_line(line)
          # rpm provides lines per config file where first 9 characters indicate which
          # properties of the file are modified
          @rpm_changes, *fields = line.split(" ")
          # nine rpm changes are known
      Severity: Minor
      Found in lib/managed_files_database.rb - About 4 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

      File bootstrap-tooltip.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* ========================================================================
       * Bootstrap: tooltip.js v3.2.0
       * http://getbootstrap.com/javascript/#tooltip
       * Inspired by the original jQuery.tipsy by Jason Frame
       * ========================================================================
      Severity: Minor
      Found in html/assets/bootstrap-tooltip.js - About 3 hrs to fix

        File kiwi_config.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Machinery::KiwiConfig < Machinery::Exporter
          attr_accessor :xml_text, :sh
          attr_accessor :name
        
          def initialize(system_description, options = {})
        Severity: Minor
        Found in lib/kiwi_config.rb - About 3 hrs to fix

          Method matches? has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

            def matches?(value)
              @matchers.each do |operator, matchers|
                matchers.each do |matcher|
                  values_equal = case value
                  when Machinery::Array
          Severity: Minor
          Found in lib/element_filter.rb - About 3 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 SystemDescription has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Machinery::SystemDescription < Machinery::Object
            CURRENT_FORMAT_VERSION = 10
            EXTRACTABLE_SCOPES = [
              "changed_managed_files",
              "changed_config_files",
          Severity: Minor
          Found in lib/system_description.rb - About 3 hrs to fix

            Method apply_repositories has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

              def apply_repositories(xml)
                if @system_description.repositories
                  usable_repositories = false
                  @system_description.repositories.each do |repo|
                    # workaround kiwi issue by replacing spaces
            Severity: Minor
            Found in lib/kiwi_config.rb - About 3 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

            Function findUnmanagedFiles has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring.
            Open

            func findUnmanagedFiles(dir string, rpmFiles map[string]string, rpmDirs map[string]bool,
                unmanagedFiles map[string]string, ignoreList map[string]bool) {
                files, _ := readDir(dir)
                for _, f := range files {
                    fileName := dir + f.Name()
            Severity: Minor
            Found in machinery-helper/machinery_helper.go - About 3 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 integration_tests_sheet has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def integration_tests_sheet(matrix)
                @document.text "Integration Tests", align: :center, size: 24
                @document.move_down 22
            
                matrix.integration_tests.each do |test, support|
            Severity: Minor
            Found in tools/support_matrix/lib/support_matrix/pdf_formatter.rb - About 3 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 SaltStates has 27 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class SaltStates < Machinery::Exporter
                attr_accessor :name
            
                def initialize(system_description, options)
                  @name = "salt"
            Severity: Minor
            Found in lib/salt_states.rb - About 3 hrs to fix

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

                def migrate
                  if @hash.key?("packages")
                    @hash["packages"] = {
                      "_attributes" => {
                        "package_system" => "rpm"
              Severity: Minor
              Found in schema/migrations/migrate5to6.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 apply_services has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                def apply_services(xml)
                  return unless @system_description.services
              
                  xml.tag!("services-manager") do
                    xml.services("config:type" => "list") do
              Severity: Minor
              Found in lib/autoyast.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 build has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def build(system_description, output_path, options = {})
                  Machinery::LocalSystem.validate_architecture("x86_64")
                  Machinery::LocalSystem.validate_existence_of_packages(
                    ["python3-kiwi", "kiwi-image-vmx-requires"]
                  )
              Severity: Major
              Found in lib/build_task.rb - About 2 hrs to fix

                Function parallaxImgScroll has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                function parallaxImgScroll(){
                
                  for (i = 0; i < parallaxElementsArray.length; i++) {
                    
                    scrolled = $(window).scrollTop();
                Severity: Minor
                Found in manual/docs/js/parallaxImg.js - 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 build has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  def build(system_description, output_path, options = {})
                    Machinery::LocalSystem.validate_architecture("x86_64")
                    Machinery::LocalSystem.validate_existence_of_packages(
                      ["python3-kiwi", "kiwi-image-vmx-requires"]
                    )
                Severity: Minor
                Found in lib/build_task.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 shadow_attributes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    def shadow_attributes(shadow, user)
                      line = shadow.lines.find { |l| l.start_with?("#{user}:") }
                      if line
                        user, passwd, changed, min, max, warn, inactive, expire = line.split(":").map(&:chomp)
                
                
                Severity: Minor
                Found in plugins/users/users_inspector.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

                Severity
                Category
                Status
                Source
                Language