yast/yast-yast2

View on GitHub
library/packages/src/modules/SignatureCheckDialogs.rb

Summary

Maintainability
F
5 days
Test Coverage

File SignatureCheckDialogs.rb has 838 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

module Yast
  class SignatureCheckDialogsClass < Module
    def main
Severity: Major
Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 days to fix

    Method ImportGPGKeyIntoTrustedDialog has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def ImportGPGKeyIntoTrustedDialog(key, repository)
          key = deep_copy(key)
          # additional Richtext (HTML) warning text (kind of help), 1/2
          warning_text = _(
            "<p>The owner of the key may distribute updates,\n" \
    Severity: Major
    Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 3 hrs to fix

      Method UseUnsignedItem has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def UseUnsignedItem(item_type, item_name, dont_show_dialog_ident, repository)
            Builtins.y2milestone(
              "UseUnsignedItem: type: %1, name: %2, dontshowid: %3, repo: %4",
              item_type,
              item_name,
      Severity: Major
      Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 hrs to fix

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

          class SignatureCheckDialogsClass < Module
            def main
              Yast.import "Pkg"
              Yast.import "UI"
              textdomain "base"
        Severity: Minor
        Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 hrs to fix

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

              def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialog_ident, repoid)
                repo_url = Ops.get_string(Pkg.SourceGeneralData(repoid), "url", "")
                description_text = Builtins.sformat(
                  if item_type == :package
                    # popup question, %1 stands for the package name, %2 for the complex multiline description of the GnuPG key
          Severity: Major
          Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 hrs to fix

            Method ItemSignedWithPublicSignature has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def ItemSignedWithPublicSignature(item_type, item_name, key)
                  key = deep_copy(key)
                  description_text = Builtins.sformat(
                    if item_type == :package
                      # popup question, %1 stands for the package name, %2 for the key ID, %3 for the key name
            Severity: Major
            Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 hrs to fix

              Method UseItemWithNoChecksum has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def UseItemWithNoChecksum(item_type, item_name, dont_show_dialog_ident)
                    description_text = Builtins.sformat(
                      if item_type == :package
                        # popup question, %1 stands for the package name
                        _(
              Severity: Major
              Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 2 hrs to fix

                Method GPGKeyAsTerm has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def GPGKeyAsTerm(key)
                      key = deep_copy(key)
                      rt = Ops.add(
                        # GPG key property
                        Builtins.sformat(
                Severity: Minor
                Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 1 hr to fix

                  Method UseCorruptedItem has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def UseCorruptedItem(item_type, item_name, key, repository)
                        key = deep_copy(key)
                        repo = Pkg.SourceGeneralData(repository)
                  
                        description_text = Builtins.sformat(
                  Severity: Minor
                  Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 1 hr to fix

                    Method GPGKeyAsString has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def GPGKeyAsString(key)
                          key = deep_copy(key)
                          # Part of the GnuPG key description in popup, %1 is a GnuPG key ID
                          Ops.add(
                            Ops.add(
                    Severity: Minor
                    Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 1 hr to fix

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

                          def StringSplitter(whattosplit, delimiter, after_chars)
                            splittedstring = ""
                            after_chars_counter = 0
                            max_size = Builtins.size(whattosplit)
                      
                      
                      Severity: Minor
                      Found in library/packages/src/modules/SignatureCheckDialogs.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 SetShowThisPopup has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def SetShowThisPopup(popup_type, show_it, popup_url)
                            if popup_type.nil? || show_it.nil?
                              Builtins.y2error(
                                "Neither popup_type %1 nor show_it %2 can be nil!",
                                popup_type,
                      Severity: Minor
                      Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 1 hr to fix

                        Method RunSimpleErrorPopup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def RunSimpleErrorPopup(heading, description_text, dont_show_dialog_ident, dont_show_dialog_param)
                              UI.OpenDialog(
                                Opt(:decorated),
                                VBox(
                                  # dialog heading - displayed in a big bold font
                        Severity: Minor
                        Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 1 hr to fix

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

                              def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialog_ident, repoid)
                          Severity: Minor
                          Found in library/packages/src/modules/SignatureCheckDialogs.rb - About 35 mins to fix

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

                                def GPGKeyAsString(key)
                                  key = deep_copy(key)
                                  # Part of the GnuPG key description in popup, %1 is a GnuPG key ID
                                  Ops.add(
                                    Ops.add(
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.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 WaitForSymbolUserInput has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def WaitForSymbolUserInput(list_of_accepted, default_symb)
                                  list_of_accepted = deep_copy(list_of_accepted)
                                  user_input = nil
                                  ret = nil
                            
                            
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.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 ItemSignedWithUnknownSignature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialog_ident, repoid)
                                  repo_url = Ops.get_string(Pkg.SourceGeneralData(repoid), "url", "")
                                  description_text = Builtins.sformat(
                                    if item_type == :package
                                      # popup question, %1 stands for the package name, %2 for the complex multiline description of the GnuPG key
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.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 UseUnsignedItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def UseUnsignedItem(item_type, item_name, dont_show_dialog_ident, repository)
                                  Builtins.y2milestone(
                                    "UseUnsignedItem: type: %1, name: %2, dontshowid: %3, repo: %4",
                                    item_type,
                                    item_name,
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.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 ImportGPGKeyIntoTrustedDialog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def ImportGPGKeyIntoTrustedDialog(key, repository)
                                  key = deep_copy(key)
                                  # additional Richtext (HTML) warning text (kind of help), 1/2
                                  warning_text = _(
                                    "<p>The owner of the key may distribute updates,\n" \
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.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

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

                                def WaitForYesNoCancelUserInput
                                  user_input = nil
                                  ret = nil
                            
                                  loop do
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.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

                                  UI.OpenDialog(
                                    Opt(:decorated),
                                    VBox(
                                      # popup heading
                                      Heading(_("Unknown GnuPG Key")),
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.rb and 1 other location - About 25 mins to fix
                            library/packages/src/modules/SignatureCheckDialogs.rb on lines 365..382

                            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 30.

                            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

                                  UI.OpenDialog(
                                    Opt(:decorated),
                                    VBox(
                                      # popup heading
                                      Heading(_("No Checksum Found")),
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.rb and 1 other location - About 25 mins to fix
                            library/packages/src/modules/SignatureCheckDialogs.rb on lines 516..533

                            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 30.

                            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

                                  if Ops.greater_than(Builtins.size(Ops.get_string(key, "created", "")), 0)
                                    # GPG key property
                                    rt = Ops.add(
                                      rt,
                                      Builtins.sformat(
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.rb and 1 other location - About 15 mins to fix
                            library/packages/src/modules/SignatureCheckDialogs.rb on lines 1089..1096

                            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 25.

                            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

                                  if Ops.greater_than(Builtins.size(Ops.get_string(key, "expires", "")), 0)
                                    # GPG key property
                                    rt = Ops.add(
                                      rt,
                                      Builtins.sformat(
                            Severity: Minor
                            Found in library/packages/src/modules/SignatureCheckDialogs.rb and 1 other location - About 15 mins to fix
                            library/packages/src/modules/SignatureCheckDialogs.rb on lines 1078..1085

                            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 25.

                            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