SUSE/machinery

View on GitHub

Showing 187 of 267 total issues

Method parse_scopes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_scopes(scope_string)
      unknown_scopes = []
      invalid_scopes = []
      scopes = []

Severity: Minor
Found in lib/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

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

  def apply_repositories(xml)
    return unless @system_description.repositories

    xml.tag!("add-on") do
      xml.add_on_products("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 run_server has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.run_server(system_description_store, opts, &block)
    if opts[:public] && opts[:ip]
      raise RuntimeError.new("It's only possible to use either an IP address or the 'public' " \
        "flag bot not both.")
    end
Severity: Major
Found in lib/html.rb - About 2 hrs to fix

    Method migrate_description has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def migrate_description(store, description_name, options = {})
          load_migrations
    
          hash = Machinery::Manifest.load(
            description_name,
    Severity: Major
    Found in lib/migration.rb - About 2 hrs to fix

      File autoyast.rb has 275 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Machinery::Autoyast < Machinery::Exporter
        attr_accessor :name
      
        def initialize(description)
          @name = "autoyast"
      Severity: Minor
      Found in lib/autoyast.rb - About 2 hrs to fix

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

              def content(description)
                return unless description["changed_config_files"]
        
                diffs_dir = description.scope_file_store("analyze/changed_config_files_diffs").path
        
        
        Severity: Minor
        Found in plugins/changed_config_files/changed_config_files_renderer.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 render_comparison has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def render_comparison(description1, description2, scopes, options = {})
            output = ""
            identical = true
            identical_scopes = []
            common_scopes = false
        Severity: Minor
        Found in lib/compare_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 handle_error has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.handle_error(e)
              Machinery::Ui.kill_pager
        
              case e
              when GLI::MissingRequiredArgumentsException
        Severity: Major
        Found in lib/cli.rb - About 2 hrs to fix

          Method migrate has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def migrate
              if @hash.key?("packages")
                @hash["packages"] = {
                  "_attributes" => {
                    "package_system" => "rpm"
          Severity: Major
          Found in schema/migrations/migrate5to6.rb - About 2 hrs to fix

            Method list has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def list(store, system_descriptions, options = {})
                if options[:html]
                  list_html(store, options)
                else
                  if system_descriptions.empty?
            Severity: Major
            Found in lib/list_task.rb - About 2 hrs to fix

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

                def migrate
                  ["changed_managed_files", "config_files"].each do |scope|
                    next unless @hash.key?(scope)
              
                    @hash[scope]["files"].each do |file|
              Severity: Minor
              Found in schema/migrations/migrate3to4.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! has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def apply!(system_description)
                    element_filters.each do |path, element_filter|
                      steps = path.split("/").reject(&:empty?)
                      target = steps.pop
              
              
              Severity: Minor
              Found in lib/filter.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 handle_error has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.handle_error(e)
                    Machinery::Ui.kill_pager
              
                    case e
                    when GLI::MissingRequiredArgumentsException
              Severity: Minor
              Found in lib/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

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

                def self.run_server(system_description_store, opts, &block)
                  if opts[:public] && opts[:ip]
                    raise RuntimeError.new("It's only possible to use either an IP address or the 'public' " \
                      "flag bot not both.")
                  end
              Severity: Minor
              Found in lib/html.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 KiwiConfig has 21 methods (exceeds 20 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 2 hrs to fix

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

                  class Array
                    class << self
                      attr_reader :attribute_keys, :element_classes
                
                      def has_attributes(*keys)
                Severity: Minor
                Found in lib/array.rb - About 2 hrs to fix

                  Method define_inspect_command_options has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.define_inspect_command_options(c)
                        c.flag [:name, :n],
                          type:     String,
                          required: false,
                          arg_name: "NAME",
                  Severity: Major
                  Found in lib/cli.rb - About 2 hrs to fix

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

                      def extract(system_description, workloads, path)
                        Dir.mktmpdir do |dir|
                          unless workloads.select { |_, w| w["data"] }.empty?
                            system_description.unmanaged_files.export_files_as_tarballs(dir)
                            workloads.each do |workload, config|
                    Severity: Minor
                    Found in lib/workload_mapper.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

                    Function show has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      Tooltip.prototype.show = function () {
                        var e = $.Event('show.bs.' + this.type)
                    
                        if (this.hasContent() && this.enabled) {
                          this.$element.trigger(e)
                    Severity: Major
                    Found in html/assets/bootstrap-tooltip.js - About 2 hrs to fix

                      Method upgrade has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def upgrade(store, name, options = {})
                          if !options[:all] && !store.list.include?(name)
                            raise Machinery::Errors::SystemDescriptionNotFound.new(
                              "System description '#{name}' does not exist."
                            )
                      Severity: Minor
                      Found in lib/upgrade_format_task.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language