yast/yast-alternatives

View on GitHub

Showing 7 of 7 total issues

File spec_helper.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

SRC_PATH = File.expand_path("../../src", __FILE__)
DATA_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "data")
ENV["Y2DIR"] = SRC_PATH

require "yast"
Severity: Minor
Found in test/spec_helper.rb - About 2 hrs to fix

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

    def alternative_with_slaves_stub
      allow(Cheetah).to receive(:run).with(
        "update-alternatives", "--query", "editor", stdout: :capture
      ).and_return(
        "Name: editor\n" \
    Severity: Minor
    Found in test/spec_helper.rb - About 1 hr to fix

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

      def some_alternatives_some_without_choices_stub
        allow(Cheetah).to receive(:run).with(
          "update-alternatives", "--get-selections", stdout: :capture
        ).and_return(
          "rake                           auto     /usr/bin/rake.ruby.ruby2.1\n" \
      Severity: Minor
      Found in test/spec_helper.rb - About 1 hr to fix

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

          let(:alternative) do
            Y2Alternatives::Alternative.new(
              "editor",
              "manual",
              "/usr/bin/nano",
        Severity: Minor
        Found in test/dialog/edit_alternative_spec.rb and 1 other location - About 25 mins to fix
        test/alternative_spec.rb on lines 144..153

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

        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

            subject(:alternative) do
              Y2Alternatives::Alternative.new(
                "editor",
                "manual",
                "/usr/bin/nano",
        Severity: Minor
        Found in test/alternative_spec.rb and 1 other location - About 25 mins to fix
        test/dialog/edit_alternative_spec.rb on lines 39..48

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

        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 alternatives_pip_with_two_choices_stub
          allow(Cheetah).to receive(:run).with(
            "update-alternatives", "--get-selections", stdout: :capture
          ).and_return(
            "pip                            auto     /usr/bin/pip3.4\n"
        Severity: Minor
        Found in test/spec_helper.rb and 1 other location - About 25 mins to fix
        test/spec_helper.rb on lines 150..159

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

        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 alternative_without_choices_stub
          allow(Cheetah).to receive(:run).with(
            "update-alternatives", "--get-selections", stdout: :capture
          ).and_return(
            "pip                            auto     \n"
        Severity: Minor
        Found in test/spec_helper.rb and 1 other location - About 25 mins to fix
        test/spec_helper.rb on lines 76..85

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

        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

        Severity
        Category
        Status
        Source
        Language