fgrehm/ventriloquist

View on GitHub

Showing 21 of 21 total issues

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

  module Ventriloquist
    module Services
      class MySql < Service
        def initialize(*args)
          super
Severity: Major
Found in lib/ventriloquist/services/mysql.rb and 1 other location - About 1 hr to fix
lib/ventriloquist/services/postgresql.rb on lines 2..39

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

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

  module Ventriloquist
    module Services
      class PostgreSQL < Service
        def initialize(*args)
          super
Severity: Major
Found in lib/ventriloquist/services/postgresql.rb and 1 other location - About 1 hr to fix
lib/ventriloquist/services/mysql.rb on lines 2..39

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

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 self.download_with_curl(machine, srcs, destination)
            Array(srcs).each_with_index do |src, idx|
              machine.env.ui.info("Attempting to download '#{src}' to '#{destination}'")
              begin
                machine.communicate.execute("curl #{src} -o #{destination} || { rm -f #{destination} && exit 1; }")
Severity: Major
Found in lib/ventriloquist/cap/utils/linux/download.rb and 1 other location - About 1 hr to fix
lib/ventriloquist/cap/utils/linux/download.rb on lines 26..34

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

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 self.download_with_wget(machine, srcs, destination)
            Array(srcs).each_with_index do |src, idx|
              machine.env.ui.info("Attempting to download '#{src}' to '#{destination}'")
              begin
                machine.communicate.execute("wget #{src} -O #{destination} || { rm -f #{destination} && exit 1; }")
Severity: Major
Found in lib/ventriloquist/cap/utils/linux/download.rb and 1 other location - About 1 hr to fix
lib/ventriloquist/cap/utils/linux/download.rb on lines 38..46

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

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 go_install has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

          def self.go_install(machine, version)
            if machine.communicate.test('which go > /dev/null')
              machine.env.ui.info("Skipping go installation")
              return
            end
Severity: Minor
Found in lib/ventriloquist/cap/platforms/debian/go_install.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

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

  module Ventriloquist
    module Platforms
      class Ruby < Platform
        def provision(machine)
          if @config[:versions].empty?
Severity: Minor
Found in lib/ventriloquist/platforms/ruby.rb and 1 other location - About 50 mins to fix
lib/ventriloquist/platforms/nodejs.rb on lines 2..16

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

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

  module Ventriloquist
    module Platforms
      class NodeJS < Platform
        def provision(machine)
          if @config[:versions].empty?
Severity: Minor
Found in lib/ventriloquist/platforms/nodejs.rb and 1 other location - About 50 mins to fix
lib/ventriloquist/platforms/ruby.rb on lines 2..16

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

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 self.pyenv_install_python(machine, version)
            if ! machine.communicate.test("pyenv versions | grep #{version}")
              machine.env.ui.info("Installing Python #{version}")
              machine.communicate.execute("pyenv install #{version}")
              machine.communicate.execute("pyenv global #{version}")
Severity: Minor
Found in lib/ventriloquist/cap/platforms/debian/python.rb and 1 other location - About 45 mins to fix
lib/ventriloquist/cap/platforms/linux/nvm_install_nodejs.rb on lines 6..12

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

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 self.nvm_install_nodejs(machine, version)
            if ! machine.communicate.test("nvm ls | grep #{version}")
              machine.env.ui.info("Installing NodeJS #{version}")
              machine.communicate.execute("nvm install #{version}")
              machine.communicate.execute("nvm alias default #{version}")
Severity: Minor
Found in lib/ventriloquist/cap/platforms/linux/nvm_install_nodejs.rb and 1 other location - About 45 mins to fix
lib/ventriloquist/cap/platforms/debian/python.rb on lines 24..30

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

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 install_packages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def self.install_packages(machine, packages, opts = {})
            packages = Array(packages).flatten
            machine.communicate.tap do |comm|
              # Based on http://askubuntu.com/a/17829
              packages_to_install = packages - installed_packages(machine)
Severity: Minor
Found in lib/ventriloquist/cap/utils/debian/install_packages.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 elixir_install has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def self.elixir_install(machine,version)
            @version = version

            machine.communicate.tap do |comm|
              if comm.test('which iex > /dev/null')
Severity: Minor
Found in lib/ventriloquist/cap/platforms/debian/elixir_install.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

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

  module Ventriloquist
    module Cap
      module Debian
        module MySqlInstallClient
          def self.mysql_install_client(machine)
Severity: Minor
Found in lib/ventriloquist/cap/services/debian/mysql_install_client.rb and 3 other locations - About 25 mins to fix
lib/ventriloquist/cap/services/debian/mysql_install_headers.rb on lines 2..10
lib/ventriloquist/cap/services/debian/pg_install_client.rb on lines 2..10
lib/ventriloquist/cap/services/debian/pg_install_headers.rb on lines 2..10

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

  module Ventriloquist
    module Cap
      module Debian
        module PgInstallClient
          def self.pg_install_client(machine)
Severity: Minor
Found in lib/ventriloquist/cap/services/debian/pg_install_client.rb and 3 other locations - About 25 mins to fix
lib/ventriloquist/cap/services/debian/mysql_install_client.rb on lines 2..10
lib/ventriloquist/cap/services/debian/mysql_install_headers.rb on lines 2..10
lib/ventriloquist/cap/services/debian/pg_install_headers.rb on lines 2..10

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

  module Ventriloquist
    module Cap
      module Debian
        module PgInstallHeaders
          def self.pg_install_headers(machine)
Severity: Minor
Found in lib/ventriloquist/cap/services/debian/pg_install_headers.rb and 3 other locations - About 25 mins to fix
lib/ventriloquist/cap/services/debian/mysql_install_client.rb on lines 2..10
lib/ventriloquist/cap/services/debian/mysql_install_headers.rb on lines 2..10
lib/ventriloquist/cap/services/debian/pg_install_client.rb on lines 2..10

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

  module Ventriloquist
    module Cap
      module Debian
        module MySqlInstallHeaders
          def self.mysql_install_headers(machine)
Severity: Minor
Found in lib/ventriloquist/cap/services/debian/mysql_install_headers.rb and 3 other locations - About 25 mins to fix
lib/ventriloquist/cap/services/debian/mysql_install_client.rb on lines 2..10
lib/ventriloquist/cap/services/debian/pg_install_client.rb on lines 2..10
lib/ventriloquist/cap/services/debian/pg_install_headers.rb on lines 2..10

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

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

          def self.download_with_curl(machine, srcs, destination)
            Array(srcs).each_with_index do |src, idx|
              machine.env.ui.info("Attempting to download '#{src}' to '#{destination}'")
              begin
                machine.communicate.execute("curl #{src} -o #{destination} || { rm -f #{destination} && exit 1; }")
Severity: Minor
Found in lib/ventriloquist/cap/utils/linux/download.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 download_with_wget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def self.download_with_wget(machine, srcs, destination)
            Array(srcs).each_with_index do |src, idx|
              machine.env.ui.info("Attempting to download '#{src}' to '#{destination}'")
              begin
                machine.communicate.execute("wget #{src} -O #{destination} || { rm -f #{destination} && exit 1; }")
Severity: Minor
Found in lib/ventriloquist/cap/utils/linux/download.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 provision_services has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def provision_services
        return if config.services.empty?

        @logger.info("Checking for Docker installation...")
        @installer.ensure_installed
Severity: Minor
Found in lib/ventriloquist/provisioner.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

  module Ventriloquist
    module Cap
      module Debian
        module VentriloquistContainersUpstart
          def self.ventriloquist_containers_upstart(machine)
lib/ventriloquist/cap/services/linux/mysql_configure_client.rb on lines 2..10
lib/ventriloquist/cap/services/linux/pg_export_pghost.rb on lines 2..10

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

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

  module Ventriloquist
    module Cap
      module Linux
        module PgExportPghost
          def self.pg_export_pghost(machine)
Severity: Minor
Found in lib/ventriloquist/cap/services/linux/pg_export_pghost.rb and 2 other locations - About 15 mins to fix
lib/ventriloquist/cap/services/debian/ventriloquist_containers_upstart.rb on lines 2..10
lib/ventriloquist/cap/services/linux/mysql_configure_client.rb on lines 2..10

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

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