datacite/lupo

View on GitHub
app/serializers/provider_serializer.rb

Summary

Maintainability
C
1 day
Test Coverage

File provider_serializer.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ProviderSerializer
  include JSONAPI::Serializer

  set_key_transform :camel_lower
  set_type :providers
Severity: Minor
Found in app/serializers/provider_serializer.rb - About 2 hrs to fix

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

      attribute :technical_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :secondary_billing_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :service_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :billing_information,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :secondary_technical_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :billing_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :secondary_service_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 262..275
    app/serializers/repository_serializer.rb on lines 110..125

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

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

      attribute :voting_contact,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Major
    Found in app/serializers/provider_serializer.rb and 8 other locations - About 35 mins to fix
    app/serializers/provider_serializer.rb on lines 78..93
    app/serializers/provider_serializer.rb on lines 148..163
    app/serializers/provider_serializer.rb on lines 167..182
    app/serializers/provider_serializer.rb on lines 186..201
    app/serializers/provider_serializer.rb on lines 205..220
    app/serializers/provider_serializer.rb on lines 224..239
    app/serializers/provider_serializer.rb on lines 243..258
    app/serializers/repository_serializer.rb on lines 110..125

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

    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

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

      attribute :from_salesforce,
                if:
                  Proc.new { |object, params|
                    params[:detail] && params[:current_ability] &&
                      params[:current_ability].can?(:read_salesforce_id, object) ==
    Severity: Minor
    Found in app/serializers/provider_serializer.rb and 2 other locations - About 15 mins to fix
    app/serializers/contact_serializer.rb on lines 34..42
    app/serializers/repository_serializer.rb on lines 162..170

    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

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

      attribute :has_password,
                if:
                  Proc.new { |object, params|
                    params[:current_ability] &&
                      params[:current_ability].can?(
    Severity: Minor
    Found in app/serializers/provider_serializer.rb and 2 other locations - About 15 mins to fix
    app/serializers/client_serializer.rb on lines 38..48
    app/serializers/repository_serializer.rb on lines 84..94

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

    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