denny/ShinyCMS-ruby

View on GitHub

Showing 657 of 658 total issues

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

  class PostPolicy
    attr_reader :this_user, :record

    def initialize( this_user, record )
      @this_user = this_user
Severity: Major
Found in plugins/ShinyBlog/app/policies/shiny_blog/post_policy.rb and 6 other locations - About 50 mins to fix
plugins/ShinyAccess/app/policies/shiny_access/group_policy.rb on lines 11..45
plugins/ShinyForms/app/policies/shiny_forms/form_policy.rb on lines 11..45
plugins/ShinyLists/app/policies/shiny_lists/list_policy.rb on lines 11..45
plugins/ShinyNews/app/policies/shiny_news/post_policy.rb on lines 11..45
plugins/ShinyNewsletters/app/policies/shiny_newsletters/template_policy.rb on lines 11..45
plugins/ShinyPages/app/policies/shiny_pages/template_policy.rb on lines 11..45

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

  class TemplatePolicy
    attr_reader :this_user, :record

    def initialize( this_user, record )
      @this_user = this_user
plugins/ShinyAccess/app/policies/shiny_access/group_policy.rb on lines 11..45
plugins/ShinyBlog/app/policies/shiny_blog/post_policy.rb on lines 11..45
plugins/ShinyForms/app/policies/shiny_forms/form_policy.rb on lines 11..45
plugins/ShinyLists/app/policies/shiny_lists/list_policy.rb on lines 11..45
plugins/ShinyNews/app/policies/shiny_news/post_policy.rb on lines 11..45
plugins/ShinyPages/app/policies/shiny_pages/template_policy.rb on lines 11..45

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

  class GroupPolicy
    attr_reader :this_user, :record

    def initialize( this_user, record )
      @this_user = this_user
Severity: Major
Found in plugins/ShinyAccess/app/policies/shiny_access/group_policy.rb and 6 other locations - About 50 mins to fix
plugins/ShinyBlog/app/policies/shiny_blog/post_policy.rb on lines 11..45
plugins/ShinyForms/app/policies/shiny_forms/form_policy.rb on lines 11..45
plugins/ShinyLists/app/policies/shiny_lists/list_policy.rb on lines 11..45
plugins/ShinyNews/app/policies/shiny_news/post_policy.rb on lines 11..45
plugins/ShinyNewsletters/app/policies/shiny_newsletters/template_policy.rb on lines 11..45
plugins/ShinyPages/app/policies/shiny_pages/template_policy.rb on lines 11..45

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

  class FormPolicy
    attr_reader :this_user, :record

    def initialize( this_user, record )
      @this_user = this_user
Severity: Major
Found in plugins/ShinyForms/app/policies/shiny_forms/form_policy.rb and 6 other locations - About 50 mins to fix
plugins/ShinyAccess/app/policies/shiny_access/group_policy.rb on lines 11..45
plugins/ShinyBlog/app/policies/shiny_blog/post_policy.rb on lines 11..45
plugins/ShinyLists/app/policies/shiny_lists/list_policy.rb on lines 11..45
plugins/ShinyNews/app/policies/shiny_news/post_policy.rb on lines 11..45
plugins/ShinyNewsletters/app/policies/shiny_newsletters/template_policy.rb on lines 11..45
plugins/ShinyPages/app/policies/shiny_pages/template_policy.rb on lines 11..45

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyProfiles

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyProfiles/lib/shiny_profiles/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyForms

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyForms/lib/shiny_forms/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class PagePolicy
    attr_reader :this_user, :record

    def initialize( this_user, record )
      @this_user = this_user
Severity: Minor
Found in plugins/ShinyPages/app/policies/shiny_pages/page_policy.rb and 1 other location - About 45 mins to fix
plugins/ShinyPages/app/policies/shiny_pages/section_policy.rb on lines 11..41

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinySEO

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinySEO/lib/shiny_seo/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyInserts

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyInserts/lib/shiny_inserts/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyAccess

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyAccess/lib/shiny_access/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyBlog

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyBlog/lib/shiny_blog/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyNewsletters

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNews/lib/shiny_news/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class Engine < ::Rails::Engine
    isolate_namespace ShinyNews

    config.generators do |g|
      g.test_framework :rspec
Severity: Major
Found in plugins/ShinyNews/lib/shiny_news/engine.rb and 7 other locations - About 45 mins to fix
plugins/ShinyAccess/lib/shiny_access/engine.rb on lines 11..23
plugins/ShinyBlog/lib/shiny_blog/engine.rb on lines 11..23
plugins/ShinyForms/lib/shiny_forms/engine.rb on lines 11..23
plugins/ShinyInserts/lib/shiny_inserts/engine.rb on lines 11..23
plugins/ShinyNewsletters/lib/shiny_newsletters/engine.rb on lines 11..23
plugins/ShinyProfiles/lib/shiny_profiles/engine.rb on lines 11..23
plugins/ShinySEO/lib/shiny_seo/engine.rb on lines 11..23

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

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

  class SectionPolicy
    attr_reader :this_user, :record

    def initialize( this_user, record )
      @this_user = this_user
Severity: Minor
Found in plugins/ShinyPages/app/policies/shiny_pages/section_policy.rb and 1 other location - About 45 mins to fix
plugins/ShinyPages/app/policies/shiny_pages/page_policy.rb on lines 11..41

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

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

      def add_element( formatting, name )
        return add_long_text_element name if formatting == 'simple_format'
        return add_html_element name      if formatting == 'sanitize'
        return add_image_element name     if formatting == 'image_tag' || name.include?( 'image' )

Severity: Minor
Found in plugins/ShinyCMS/app/public/models/concerns/shinycms/template.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Confirmed

    def index
      authenticate_user! unless params[:token]

      if subscriber
        @subscriptions = subscriber.subscriptions

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

    def check_with_akismet
      return true if user_signed_in?
      return true unless akismet_api_key_is_set? && feature_enabled?( :akismet_for_comments )

      spam, blatant = akismet_check( request, @new_comment )
Severity: Minor
Found in plugins/ShinyCMS/app/controllers/shinycms/comments_controller.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 selected_comment_ids has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Confirmed

    def selected_comment_ids
      comment_ids = []
      update_params[ :spam_comments ].each_pair do |key, value|
        next unless value == '1'

Severity: Minor
Found in plugins/ShinyCMS/app/controllers/shinycms/admin/comments_controller.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

Avoid too many return statements within this method.
Confirmed

      return false unless user.admin?
Severity: Major
Found in plugins/ShinyCMS/app/models/shinycms/feature_flag.rb - About 30 mins to fix

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

        def skip_callbacks_on_some_models
          ShinyNewsletters::Template.skip_callback :create, :after, :add_elements
          ShinyNewsletters::Edition.skip_callback  :create, :after, :add_elements
          ShinyPages::Template.skip_callback       :create, :after, :add_elements
          ShinyPages::Page.skip_callback           :create, :after, :add_elements
    Severity: Minor
    Found in plugins/ShinyCMS/lib/tasks/support/demo_site_task.rb and 1 other location - About 30 mins to fix
    plugins/ShinyCMS/lib/tasks/support/demo_site_task.rb on lines 120..126

    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

    Severity
    Category
    Status
    Source
    Language