voxpupuli/puppet_webhook

View on GitHub

Showing 17 of 23 total issues

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

  plat.defaultdir '/etc/default'
  plat.servicetype 'systemd'
  plat.codename 'xenial'
  plat.servicedir '/etc/systemd/system'

Severity: Major
Found in build/vanagon/platforms/ubuntu-16.04-amd64.rb and 2 other locations - About 1 hr to fix
build/vanagon/platforms/ubuntu-18.04-amd64.rb on lines 4..29
build/vanagon/platforms/ubuntu-20.04-amd64.rb on lines 4..29

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

  plat.defaultdir '/etc/default'
  plat.servicetype 'systemd'
  plat.codename 'bionic'
  plat.servicedir '/etc/systemd/system'

Severity: Major
Found in build/vanagon/platforms/ubuntu-18.04-amd64.rb and 2 other locations - About 1 hr to fix
build/vanagon/platforms/ubuntu-16.04-amd64.rb on lines 4..29
build/vanagon/platforms/ubuntu-20.04-amd64.rb on lines 4..29

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

  plat.defaultdir '/etc/default'
  plat.servicetype 'systemd'
  plat.codename 'focal'
  plat.servicedir '/etc/systemd/system'

Severity: Major
Found in build/vanagon/platforms/ubuntu-20.04-amd64.rb and 2 other locations - About 1 hr to fix
build/vanagon/platforms/ubuntu-16.04-amd64.rb on lines 4..29
build/vanagon/platforms/ubuntu-18.04-amd64.rb on lines 4..29

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

  plat.servicedir '/usr/lib/systemd/system'
  plat.defaultdir '/etc/sysconfig'
  plat.servicetype 'systemd'

  plat.docker_image 'voxpupuli/builder:el8'
Severity: Minor
Found in build/vanagon/platforms/el-8-x86_64.rb and 1 other location - About 55 mins to fix
build/vanagon/platforms/el-7-x86_64.rb on lines 4..28

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

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

  plat.servicedir '/usr/lib/systemd/system'
  plat.defaultdir '/etc/sysconfig'
  plat.servicetype 'systemd'

  plat.docker_image 'voxpupuli/builder:el7'
Severity: Minor
Found in build/vanagon/platforms/el-7-x86_64.rb and 1 other location - About 55 mins to fix
build/vanagon/platforms/el-8-x86_64.rb on lines 4..28

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

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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
Confirmed

      def initialize(agent, command, timeouts = nil, options = nil, nodes = [], **args) # rubocop:disable Metrics/ParameterLists
Severity: Minor
Found in lib/puppet_webhook/orchestrators/mcollective.rb - About 45 mins to fix

    Method ignore_env? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Confirmed

            def ignore_env?(env)
              list = APP_CONFIG.ignore_environments
              return false if list.nil? || list.empty?
    
              list.each do |l|
    Severity: Minor
    Found in app/controllers/api/v1/r10k/environment_controller.rb - About 45 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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Confirmed

        def initialize(service, url, channel, user, options = {})
    Severity: Minor
    Found in lib/puppet_webhook/chatops.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Confirmed

            def initialize(channel, url, user, message, options = {})
      Severity: Minor
      Found in lib/puppet_webhook/chatops/rocketchat.rb - About 35 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Confirmed

              def initialize(channel, url, user, message, options = {})
        Severity: Minor
        Found in lib/puppet_webhook/chatops/slack.rb - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

                  return 'tfs'              if tfs_webhook?
          Severity: Major
          Found in lib/puppet_webhook/parsers/payload.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Confirmed

                    return 'stash'            if stash_webhook?
            Severity: Major
            Found in lib/puppet_webhook/parsers/payload.rb - About 30 mins to fix

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

                plat.servicedir '/lib/systemd/system'
                plat.defaultdir '/etc/default'
                plat.servicetype 'systemd'
                plat.codename 'stretch'
              
              
              Severity: Minor
              Found in build/vanagon/platforms/debian-9-amd64.rb and 1 other location - About 30 mins to fix
              build/vanagon/platforms/debian-10-amd64.rb on lines 4..14

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

              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

                plat.servicedir '/lib/systemd/system'
                plat.defaultdir '/etc/default'
                plat.servicetype 'systemd'
                plat.codename 'buster'
              
              
              Severity: Minor
              Found in build/vanagon/platforms/debian-10-amd64.rb and 1 other location - About 30 mins to fix
              build/vanagon/platforms/debian-9-amd64.rb on lines 4..14

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

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

                    def detect_vcs
                      return 'github'           if github_webhook?
                      return 'gitlab'           if gitlab_webhook?
                      return 'bitbucket-server' if bitbucket_server_webhook?
                      return 'bitbucket'        if bitbucket_webhook?
              Severity: Minor
              Found in lib/puppet_webhook/parsers/payload.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.
              Confirmed

                    when 'rocketchat'
                      require_relative 'chatops/rocketchat'
                      logger.info("Sending Rocket.Chat webhook message to #{@url}")
                      Chatops::Rocketchat.new(
                        @channel,
              Severity: Minor
              Found in lib/puppet_webhook/chatops.rb and 1 other location - About 25 mins to fix
              lib/puppet_webhook/chatops.rb on lines 33..43

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

                    when 'slack'
                      require_relative 'chatops/slack'
                      logger.info("Sending Slack webhook message to #{@url}")
                      Chatops::Slack.new(
                        @channel,
              Severity: Minor
              Found in lib/puppet_webhook/chatops.rb and 1 other location - About 25 mins to fix
              lib/puppet_webhook/chatops.rb on lines 44..54

              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