decko-commons/decko

View on GitHub

Showing 661 of 695 total issues

Assignment Branch Condition size for register_class is too high. [16.61/15]
Open

        def register_class klass, hash
          klass.config = hash.merge class: klass
          prefix_index = hash[:idx_char] || :default
          # ^ this is gross and needs to be moved out.

Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Cyclomatic complexity for scope_of is too high. [7/6]
Open

  def scope_of section
    case section

    when /main card content/
      with_or_without_main_frame ".d0-card-content"
Severity: Minor
Found in decko/features/support/scopes.rb by rubocop

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Assignment Branch Condition size for params_for is too high. [15.59/15]
Open

        def params_for page
          page_params = Rack::Utils.parse_nested_query "#{@param_name}=#{page}"
          page_params = @params.with_indifferent_access.deep_merge(page_params)

          if ::Kaminari.config.respond_to?(:params_on_first_page) &&

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

      context "with unknown codename and known name" do
        let(:ensure_args) { { name: "A", codename: :stranger, content: "updated" } }

        it "alters name`conflict: :defer`" do
          expect(ensure!(conflict: :defer).name).to eq("A 1")
Severity: Major
Found in card/spec/card/director/card_class_spec.rb and 1 other location - About 1 hr to fix
card/spec/card/director/card_class_spec.rb on lines 55..67

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

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

      context "with known codename" do
        let(:ensure_args) { { name: "A", codename: :admin, content: "updated" } }

        it "defers when `conflict: :defer`" do
          expect(ensure!(conflict: :defer).name).to eq("*admin")
Severity: Major
Found in card/spec/card/director/card_class_spec.rb and 1 other location - About 1 hr to fix
card/spec/card/director/card_class_spec.rb on lines 71..83

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

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

Example has too many lines [36/25].
Open

  it "handles nested layouts" do
    # format = Card["A"].format :html
    lay = format.bs do
      layout do
        row 8, 4 do

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

      context "when card is pristine" do
        # C is pristine (and blank)
        let(:ensure_args) { { name: "C", content: "updated" } }

        it "defers when `conflict: :defer`" do
Severity: Major
Found in card/spec/card/director/card_class_spec.rb and 1 other location - About 1 hr to fix
card/spec/card/director/card_class_spec.rb on lines 33..46

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

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

      context "when card is not pristine" do
        # A is not pristine (Joe User has edited it)
        let(:ensure_args) { { name: "A", content: "updated" } }

        it "defers when `conflict: :defer`" do
Severity: Major
Found in card/spec/card/director/card_class_spec.rb and 1 other location - About 1 hr to fix
card/spec/card/director/card_class_spec.rb on lines 16..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

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

    def parts_minus keys_to_ignore
      parts.map do |part|
        next if part.empty?
        next if part =~ /^_/ # this removes relative parts.  why?
        next if keys_to_ignore.member? part.to_name.key
Severity: Minor
Found in cardname/lib/cardname/contextual.rb - About 55 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 cards_with_disposable_attachments has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def cards_with_disposable_attachments
    draft_actions_with_attachment.each do |action|
      # we don't want to delete uploads in progress
      next unless old_enough?(action.created_at) && (card = action.card)
      # we can't delete attachments we don't have write access to
Severity: Minor
Found in mod/carrierwave/set/all/file_utils.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method match_prefices has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def match_prefices prefix_regexp
        while match_prefix prefix_regexp
          @match, @offset = current_match
          # see whether the full chunk actually matches
          # (as opposed to bogus prefix)
Severity: Minor
Found in card/lib/card/content/parser.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method perform has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

          def perform act_id, card, card_attribs, env, auth, method_name
Severity: Minor
Found in card/lib/card/set/event/delayed_event.rb - About 45 mins to fix

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

    it "creates all the necessary cards" do
      expect(@signup.type_id).to eq(Card::SignupID)
      expect(@account.email).to eq("wolf@decko.org")
      expect(@account.status).to eq("unverified")
      expect(@account.salt).not_to eq("")
Severity: Minor
Found in mod/account/spec/set/type/signup_spec.rb and 1 other location - About 40 mins to fix
mod/account/spec/set/type/signup_spec.rb on lines 105..110

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

  it "loads type set" do
    create_card "set test load", codename: "set_test_load", type_id: Card::CardtypeID
    Card::Cache.reset_all
    module Card::Set::Type::SetTestLoad
      extend Card::Set
Severity: Minor
Found in card/spec/cardio/mod/loader_spec.rb and 1 other location - About 40 mins to fix
card/spec/cardio/mod/loader_spec.rb on lines 78..88

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

  it "loads type set for a junction cardtyp" do
    create_card "set+test load", codename: "set_test_load", type_id: Card::CardtypeID
    Card::Cache.reset_all
    module Card::Set::Type::SetTestLoad
      extend Card::Set
Severity: Minor
Found in card/spec/cardio/mod/loader_spec.rb and 1 other location - About 40 mins to fix
card/spec/cardio/mod/loader_spec.rb on lines 66..76

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

    it "creates all the necessary cards" do
      expect(@signup.type_id).to eq(Card::SignupID)
      expect(@account.email).to eq("wolf@decko.org")
      expect(@account.status).to eq("unapproved")
      expect(@account.salt).not_to eq("")
Severity: Minor
Found in mod/account/spec/set/type/signup_spec.rb and 1 other location - About 40 mins to fix
mod/account/spec/set/type/signup_spec.rb on lines 47..52

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

  describe "subject" do
    subject { mailconfig[:subject] }

    it "uses *subject field" do
      is_expected.to include "*subject"
Severity: Minor
Found in mod/email/spec/set/type/email_template/email_config_spec.rb and 1 other location - About 40 mins to fix
mod/email/spec/set/type/email_template/email_config_spec.rb on lines 96..112

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

  describe "text message" do
    subject { mailconfig[:text_message] }

    it "uses *text_message field" do
      is_expected.to include "*text message"
Severity: Minor
Found in mod/email/spec/set/type/email_template/email_config_spec.rb and 1 other location - About 40 mins to fix
mod/email/spec/set/type/email_template/email_config_spec.rb on lines 76..92

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

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

      def initialize format, action, header=true, action_view=:summary, hide_diff=false
Severity: Minor
Found in mod/history/lib/card/action/action_renderer.rb - About 35 mins to fix

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

      def initialize component, name, html_class, tag_opts={}, &tag_block
Severity: Minor
Found in mod/bootstrap/lib/card/bootstrap/tag_method.rb - About 35 mins to fix
Severity
Category
Status
Source
Language