technicalpickles/jeweler

View on GitHub

Showing 35 of 35 total issues

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

  class Generator
    module ShouldaMixin
      def self.extended(generator)
        generator.development_dependencies << ['shoulda', '>= 0']
      end
Severity: Major
Found in lib/jeweler/generator/shoulda_mixin.rb and 5 other locations - About 40 mins to fix
lib/jeweler/generator/bacon_mixin.rb on lines 2..37
lib/jeweler/generator/micronaut_mixin.rb on lines 2..37
lib/jeweler/generator/minitest_mixin.rb on lines 2..37
lib/jeweler/generator/riot_mixin.rb on lines 2..37
lib/jeweler/generator/testspec_mixin.rb on lines 2..37

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

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 6 locations. Consider refactoring.
Open

  class Generator
    module RiotMixin
      def self.extended(generator)
        generator.development_dependencies << ['riot', '>= 0']
      end
Severity: Major
Found in lib/jeweler/generator/riot_mixin.rb and 5 other locations - About 40 mins to fix
lib/jeweler/generator/bacon_mixin.rb on lines 2..37
lib/jeweler/generator/micronaut_mixin.rb on lines 2..37
lib/jeweler/generator/minitest_mixin.rb on lines 2..37
lib/jeweler/generator/shoulda_mixin.rb on lines 2..37
lib/jeweler/generator/testspec_mixin.rb on lines 2..37

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

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

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

  def write_version(major, minor, patch, build, _options = {})
Severity: Minor
Found in lib/jeweler.rb - About 35 mins to fix

    Avoid too many return statements within this method.
    Open

                return 1
    Severity: Major
    Found in lib/jeweler/generator/application.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return 1
      Severity: Major
      Found in lib/jeweler/generator/application.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return 1
        Severity: Major
        Found in lib/jeweler/generator/application.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return 1
          Severity: Major
          Found in lib/jeweler/generator/application.rb - About 30 mins to fix

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

                  def self.build_for(jeweler)
                    command = new
            
                    command.base_dir = jeweler.base_dir
                    command.gemspec = jeweler.gemspec
            Severity: Minor
            Found in lib/jeweler/commands/release_gemspec.rb and 2 other locations - About 25 mins to fix
            lib/jeweler/commands/release_to_git.rb on lines 54..64
            lib/jeweler/commands/write_gemspec.rb on lines 26..36

            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

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

                def create_files
                  if File.exist?(target_dir) || File.directory?(target_dir)
                    raise FileInTheWay, "The directory #{target_dir} already exists, aborting. Maybe move it out of the way before continuing?"
                  else
                    FileUtils.mkdir target_dir
            Severity: Minor
            Found in lib/jeweler/generator.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 3 locations. Consider refactoring.
            Open

                  def self.build_for(jeweler)
                    command = new
            
                    command.base_dir = jeweler.base_dir
                    command.gemspec = jeweler.gemspec
            Severity: Minor
            Found in lib/jeweler/commands/write_gemspec.rb and 2 other locations - About 25 mins to fix
            lib/jeweler/commands/release_gemspec.rb on lines 71..81
            lib/jeweler/commands/release_to_git.rb on lines 54..64

            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 3 locations. Consider refactoring.
            Open

                  def self.build_for(jeweler)
                    command = new
            
                    command.base_dir = jeweler.base_dir
                    command.gemspec = jeweler.gemspec
            Severity: Minor
            Found in lib/jeweler/commands/release_to_git.rb and 2 other locations - About 25 mins to fix
            lib/jeweler/commands/release_gemspec.rb on lines 71..81
            lib/jeweler/commands/write_gemspec.rb on lines 26..36

            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

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

              def git_base_dir(base_dir = nil)
                base_dir = if base_dir
                             File.dirname(base_dir)
                           else
                             File.expand_path(self.base_dir || '.')
            Severity: Minor
            Found in lib/jeweler.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 run! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                    def run!(*arguments)
                      options = build_options(arguments)
            
                      if options[:invalid_argument]
                        $stderr.puts options[:invalid_argument]
            Severity: Minor
            Found in lib/jeweler/generator/application.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

                  begin
                    generator_mixin_name = "#{testing_framework.to_s.capitalize}Mixin"
                    generator_mixin = self.class.const_get(generator_mixin_name)
                    extend generator_mixin
                  rescue NameError => e
            Severity: Minor
            Found in lib/jeweler/generator.rb and 1 other location - About 20 mins to fix
            lib/jeweler/generator.rb on lines 87..93

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

            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

                  begin
                    generator_mixin_name = "#{documentation_framework.to_s.capitalize}Mixin"
                    generator_mixin = self.class.const_get(generator_mixin_name)
                    extend generator_mixin
                  rescue NameError => e
            Severity: Minor
            Found in lib/jeweler/generator.rb and 1 other location - About 20 mins to fix
            lib/jeweler/generator.rb on lines 79..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 27.

            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