datacite/lupo

View on GitHub
app/graphql/types/member_type.rb

Summary

Maintainability
F
3 days
Test Coverage

File member_type.rb has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class MemberType < BaseObject
  description "Information about members"

  field :id,
        ID,
Severity: Minor
Found in app/graphql/types/member_type.rb - About 4 hrs to fix

    Method response has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def response(**args)
        Doi.gql_query(
          args[:query],
          ids: args[:ids],
          user_id: args[:user_id],
    Severity: Minor
    Found in app/graphql/types/member_type.rb - About 1 hr to fix

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

        def response(**args)
          Doi.gql_query(
            args[:query],
            ids: args[:ids],
            user_id: args[:user_id],
      Severity: Minor
      Found in app/graphql/types/member_type.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 6 locations. Consider refactoring.
      Open

        field :works,
              WorkConnectionWithTotalType,
              null: true, description: "Works by this provider." do
          argument :query, String, required: false
          argument :ids, [String], required: false
      Severity: Major
      Found in app/graphql/types/member_type.rb and 5 other locations - About 4 hrs to fix
      app/graphql/types/funder_type.rb on lines 25..52
      app/graphql/types/funder_type.rb on lines 54..81
      app/graphql/types/funder_type.rb on lines 83..110
      app/graphql/types/funder_type.rb on lines 112..140
      app/graphql/types/repository_type.rb on lines 224..252

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

      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

        field :softwares,
              SoftwareConnectionWithTotalType,
              null: true, description: "Software by this provider." do
          argument :query, String, required: false
          argument :ids, [String], required: false
      Severity: Major
      Found in app/graphql/types/member_type.rb and 1 other location - About 4 hrs to fix
      app/graphql/types/person_type.rb on lines 124..150

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

      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

        field :datasets,
              DatasetConnectionWithTotalType,
              null: true, description: "Datasets by this provider." do
          argument :query, String, required: false
          argument :ids, String, required: false
      Severity: Major
      Found in app/graphql/types/member_type.rb and 1 other location - About 4 hrs to fix
      app/graphql/types/member_type.rb on lines 81..107

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

      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

        field :publications,
              PublicationConnectionWithTotalType,
              null: true, description: "Publications by this provider." do
          argument :query, String, required: false
          argument :ids, String, required: false
      Severity: Major
      Found in app/graphql/types/member_type.rb and 1 other location - About 4 hrs to fix
      app/graphql/types/member_type.rb on lines 53..79

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

      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

        field :prefixes,
              MemberPrefixConnectionWithTotalType,
              null: true, description: "Prefixes managed by the member" do
          argument :query, String, required: false
          argument :state, String, required: false
      Severity: Minor
      Found in app/graphql/types/member_type.rb and 1 other location - About 50 mins to fix
      app/graphql/types/repository_type.rb on lines 254..262

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

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

        def data_management_plans(**args)
          args[:resource_type_id] = "Text"
          args[:resource_type] = "Data Management Plan"
          ElasticsearchModelResponseConnection.new(
            response(**args),
      Severity: Major
      Found in app/graphql/types/member_type.rb and 12 other locations - About 20 mins to fix
      app/graphql/types/funder_type.rb on lines 203..209
      app/graphql/types/organization_type.rb on lines 290..296
      app/graphql/types/query_type.rb on lines 915..918
      app/graphql/types/query_type.rb on lines 958..961
      app/graphql/types/query_type.rb on lines 1001..1004
      app/graphql/types/query_type.rb on lines 1044..1047
      app/graphql/types/query_type.rb on lines 1087..1090
      app/graphql/types/query_type.rb on lines 1130..1133
      app/graphql/types/query_type.rb on lines 1173..1176
      app/graphql/types/query_type.rb on lines 1216..1219
      app/graphql/types/query_type.rb on lines 1259..1262
      app/graphql/types/repository_type.rb on lines 309..315

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

        def download_count
          args = { first: 0 }
          @r = response(**args) if @r.nil?
          if @r.results.total.positive?
            aggregate_count(@r.response.aggregations.downloads.buckets)
      Severity: Minor
      Found in app/graphql/types/member_type.rb and 5 other locations - About 15 mins to fix
      app/graphql/types/data_catalog_type.rb on lines 159..165
      app/graphql/types/data_catalog_type.rb on lines 169..175
      app/graphql/types/data_catalog_type.rb on lines 179..185
      app/graphql/types/member_type.rb on lines 314..320
      app/graphql/types/member_type.rb on lines 334..340

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

        def citation_count
          args = { first: 0 }
          @r = response(**args) if @r.nil?
          if @r.results.total.positive?
            aggregate_count(@r.response.aggregations.citations.buckets)
      Severity: Minor
      Found in app/graphql/types/member_type.rb and 5 other locations - About 15 mins to fix
      app/graphql/types/data_catalog_type.rb on lines 159..165
      app/graphql/types/data_catalog_type.rb on lines 169..175
      app/graphql/types/data_catalog_type.rb on lines 179..185
      app/graphql/types/member_type.rb on lines 314..320
      app/graphql/types/member_type.rb on lines 324..330

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

        def view_count
          args = { first: 0 }
          @r = response(**args) if @r.nil?
          if @r.results.total.positive?
            aggregate_count(@r.response.aggregations.views.buckets)
      Severity: Minor
      Found in app/graphql/types/member_type.rb and 5 other locations - About 15 mins to fix
      app/graphql/types/data_catalog_type.rb on lines 159..165
      app/graphql/types/data_catalog_type.rb on lines 169..175
      app/graphql/types/data_catalog_type.rb on lines 179..185
      app/graphql/types/member_type.rb on lines 324..330
      app/graphql/types/member_type.rb on lines 334..340

      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

      There are no issues that match your filters.

      Category
      Status