gitlabhq/gitlabhq

View on GitHub
lib/api/helpers/services_helpers.rb

Summary

Maintainability
F
6 days
Test Coverage

Method services has 559 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.services
        {
          'alerts' => [],
          'asana' => [
            {
Severity: Major
Found in lib/api/helpers/services_helpers.rb - About 2 days to fix

    File services_helpers.rb has 758 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module API
      module Helpers
        # Helpers module for API::Services
        #
        # The data structures inside this model are returned using class methods,
    Severity: Major
    Found in lib/api/helpers/services_helpers.rb - About 1 day to fix

      Method chat_notification_events has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def self.chat_notification_events
              [
                {
                  required: false,
                  name: :push_events,
      Severity: Major
      Found in lib/api/helpers/services_helpers.rb - About 2 hrs to fix

        Method chat_notification_channels has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def self.chat_notification_channels
                [
                  {
                    required: false,
                    name: :push_channel,
        Severity: Minor
        Found in lib/api/helpers/services_helpers.rb - About 2 hrs to fix

          Method service_classes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def self.service_classes
                  [
                    ::AlertsService,
                    ::AsanaService,
                    ::AssemblaService,
          Severity: Minor
          Found in lib/api/helpers/services_helpers.rb - About 1 hr to fix

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

                  def self.chat_notification_settings
                    [
                      {
                        required: true,
                        name: :webhook,
            Severity: Minor
            Found in lib/api/helpers/services_helpers.rb - About 1 hr to fix

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

                        {
                          required: true,
                          name: :webhook,
                          type: String,
                          desc: 'The chat webhook'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 1 other location - About 40 mins to fix
              lib/api/helpers/services_helpers.rb on lines 336..359

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

              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

                          {
                            required: true,
                            name: :teamcity_url,
                            type: String,
                            desc: 'TeamCity root URL like https://teamcity.example.com'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 1 other location - About 40 mins to fix
              lib/api/helpers/services_helpers.rb on lines 194..217

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

              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

                          {
                            required: true,
                            name: :recipients,
                            type: String,
                            desc: 'Comma-separated list of recipient email addresses'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 1 other location - About 40 mins to fix
              lib/api/helpers/services_helpers.rb on lines 12..35

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

              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

                          {
                            required: true,
                            name: :bamboo_url,
                            type: String,
                            desc: 'Bamboo root URL like https://bamboo.example.com'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 1 other location - About 40 mins to fix
              lib/api/helpers/services_helpers.rb on lines 678..701

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

              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

                          {
                            required: true,
                            name: :new_issue_url,
                            type: String,
                            desc: 'The new issue URL'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 3 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 220..237
              lib/api/helpers/services_helpers.rb on lines 288..305
              lib/api/helpers/services_helpers.rb on lines 565..582

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

              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

                          {
                            required: true,
                            name: :new_issue_url,
                            type: String,
                            desc: 'New issue URL'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 3 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 220..237
              lib/api/helpers/services_helpers.rb on lines 565..582
              lib/api/helpers/services_helpers.rb on lines 617..634

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

              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

                          {
                            required: true,
                            name: :new_issue_url,
                            type: String,
                            desc: 'New issue URL'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 3 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 288..305
              lib/api/helpers/services_helpers.rb on lines 565..582
              lib/api/helpers/services_helpers.rb on lines 617..634

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

              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

                          {
                            required: true,
                            name: :token,
                            type: String,
                            desc: 'Drone CI token'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 2 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 240..257
              lib/api/helpers/services_helpers.rb on lines 511..528

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

              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

                          {
                            required: true,
                            name: :api_url,
                            type: String,
                            desc: 'Prometheus API Base URL, like http://prometheus.example.com/'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 3 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 220..237
              lib/api/helpers/services_helpers.rb on lines 288..305
              lib/api/helpers/services_helpers.rb on lines 617..634

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

              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

                          {
                            required: true,
                            name: :username,
                            type: String,
                            desc: 'The username'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 2 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 240..257
              lib/api/helpers/services_helpers.rb on lines 316..333

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

              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

                          {
                            required: true,
                            name: :token,
                            type: String,
                            desc: 'Buildkite project GitLab token'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 2 other locations - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 316..333
              lib/api/helpers/services_helpers.rb on lines 511..528

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

              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

                          {
                            required: true,
                            name: :token,
                            type: String,
                            desc: 'Campfire token'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 1 other location - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 531..548

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

              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

                          {
                            required: true,
                            name: :recipients,
                            type: String,
                            desc: 'Comma-separated list of recipient email addresses'
              Severity: Minor
              Found in lib/api/helpers/services_helpers.rb and 1 other location - About 20 mins to fix
              lib/api/helpers/services_helpers.rb on lines 260..277

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

              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