yast/yast-yast2

View on GitHub
library/general/src/modules/Report.rb

Summary

Maintainability
F
4 days
Test Coverage

File Report.rb has 461 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "yast2/popup"

module Yast
  # Report module is universal reporting module. It properly display messages
Severity: Minor
Found in library/general/src/modules/Report.rb - About 7 hrs to fix

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

      class ReportClass < Module
        include Yast::Logger
    
        def main
          textdomain "base"
    Severity: Minor
    Found in library/general/src/modules/Report.rb - About 4 hrs to fix

      Method Summary has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Summary
            summary = ""
            # translators: summary header for messages generated through autoinstallation
            summary = Summary.AddHeader(summary, _("Messages"))
            summary = Summary.OpenList(summary)
      Severity: Major
      Found in library/general/src/modules/Report.rb - About 2 hrs to fix

        Method GetMessages has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def GetMessages(warnings, errors, messages, yes_no)
              richtext = ""
        
              if warnings
                # translators: warnings summary header
        Severity: Major
        Found in library/general/src/modules/Report.rb - About 2 hrs to fix

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

              def Summary
                summary = ""
                # translators: summary header for messages generated through autoinstallation
                summary = Summary.AddHeader(summary, _("Messages"))
                summary = Summary.OpenList(summary)
          Severity: Minor
          Found in library/general/src/modules/Report.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 Import has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def Import(settings)
                settings = deep_copy(settings)
                @message_settings = Ops.get_map(settings, "messages", {})
                @error_settings = Ops.get_map(settings, "errors", {})
                @warning_settings = Ops.get_map(settings, "warnings", {})
          Severity: Minor
          Found in library/general/src/modules/Report.rb - About 1 hr to fix

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

                def main
                  textdomain "base"
            
                  Yast.import "Mode"
                  Yast.import "Summary"
            Severity: Minor
            Found in library/general/src/modules/Report.rb - About 1 hr to fix

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

                  def ShowText(headline_string, message_string)
                    Builtins.y2milestone(1, "%1", message_string) if @log_errors
              
                    if @display_errors
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 Message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Message(message_string)
                    Builtins.y2milestone(1, "%1", message_string) if @log_messages
              
                    if @display_messages
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 Error has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Error(error_string)
                    Builtins.y2error(1, "%1", error_string) if @log_errors
              
                    if @display_errors
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 LongWarning has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def LongWarning(warning_string, width: 60, height: 10)
                    Builtins.y2warning(1, "%1", warning_string) if @log_warnings
              
                    if @display_warnings
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 LongMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def LongMessage(message_string, width: 60, height: 10)
                    Builtins.y2milestone(1, "%1", message_string) if @log_messages
              
                    if @display_messages
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 LongError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def LongError(error_string, width: 60, height: 10)
                    Builtins.y2error(1, "%1", error_string) if @log_errors
              
                    if @display_errors
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 Warning has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def Warning(warning_string)
                    Builtins.y2warning(1, "%1", warning_string) if @log_warnings
              
                    if @display_warnings
                      if Mode.commandline
              Severity: Minor
              Found in library/general/src/modules/Report.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 AnyQuestion has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
              Severity: Minor
              Found in library/general/src/modules/Report.rb - About 35 mins to fix

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

                    def ErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus)
                Severity: Minor
                Found in library/general/src/modules/Report.rb - About 35 mins to fix

                  Method AnyQuestion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def AnyQuestion(headline, message, yes_button_message, no_button_message, focus)
                        Builtins.y2milestone(1, "%1", message) if @log_yesno_messages
                  
                        focus = BACKWARD_MAPPING[focus] || focus
                        ret = false
                  Severity: Minor
                  Found in library/general/src/modules/Report.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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def LongError(error_string, width: 60, height: 10)
                        Builtins.y2error(1, "%1", error_string) if @log_errors
                  
                        if @display_errors
                          if Mode.commandline
                  Severity: Major
                  Found in library/general/src/modules/Report.rb and 1 other location - About 1 hr to fix
                  library/general/src/modules/Report.rb on lines 532..546

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def LongWarning(warning_string, width: 60, height: 10)
                        Builtins.y2warning(1, "%1", warning_string) if @log_warnings
                  
                        if @display_warnings
                          if Mode.commandline
                  Severity: Major
                  Found in library/general/src/modules/Report.rb and 1 other location - About 1 hr to fix
                  library/general/src/modules/Report.rb on lines 576..590

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 50.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                        if messages
                          # translators: message summary header
                          richtext = Ops.add(
                            Ops.add(Ops.add(richtext, "<P><B>"), _("Message:")),
                            "</B><BR>"
                  Severity: Major
                  Found in library/general/src/modules/Report.rb and 3 other locations - About 55 mins to fix
                  library/general/src/modules/Report.rb on lines 695..709
                  library/general/src/modules/Report.rb on lines 712..726
                  library/general/src/modules/Report.rb on lines 746..760

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 44.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def Warning(warning_string)
                        Builtins.y2warning(1, "%1", warning_string) if @log_warnings
                  
                        if @display_warnings
                          if Mode.commandline
                  Severity: Minor
                  Found in library/general/src/modules/Report.rb and 1 other location - About 55 mins to fix
                  library/general/src/modules/Report.rb on lines 554..568

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 44.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                        if yes_no
                          # translators: message summary header
                          richtext = Ops.add(
                            Ops.add(Ops.add(richtext, "<P><B>"), _("Message:")),
                            "</B><BR>"
                  Severity: Major
                  Found in library/general/src/modules/Report.rb and 3 other locations - About 55 mins to fix
                  library/general/src/modules/Report.rb on lines 695..709
                  library/general/src/modules/Report.rb on lines 712..726
                  library/general/src/modules/Report.rb on lines 729..743

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 44.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                        if warnings
                          # translators: warnings summary header
                          richtext = Ops.add(
                            Ops.add(Ops.add(richtext, "<P><B>"), _("Warning:")),
                            "</B><BR>"
                  Severity: Major
                  Found in library/general/src/modules/Report.rb and 3 other locations - About 55 mins to fix
                  library/general/src/modules/Report.rb on lines 712..726
                  library/general/src/modules/Report.rb on lines 729..743
                  library/general/src/modules/Report.rb on lines 746..760

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 44.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def Error(error_string)
                        Builtins.y2error(1, "%1", error_string) if @log_errors
                  
                        if @display_errors
                          if Mode.commandline
                  Severity: Minor
                  Found in library/general/src/modules/Report.rb and 1 other location - About 55 mins to fix
                  library/general/src/modules/Report.rb on lines 510..524

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 44.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 4 locations. Consider refactoring.
                  Open

                        if errors
                          # translators: errors summary header
                          richtext = Ops.add(
                            Ops.add(Ops.add(richtext, "<P><B>"), _("Error:")),
                            "</B><BR>"
                  Severity: Major
                  Found in library/general/src/modules/Report.rb and 3 other locations - About 55 mins to fix
                  library/general/src/modules/Report.rb on lines 695..709
                  library/general/src/modules/Report.rb on lines 729..743
                  library/general/src/modules/Report.rb on lines 746..760

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 44.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  There are no issues that match your filters.

                  Category
                  Status