decko-commons/decko

View on GitHub

Showing 661 of 695 total issues

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

    it "green ellipsis if added text partially fits" do
      a = "1234"
      b = "56789"
      expect(summary(a, b, summary: { length: 8 })).to eq(
        "#{del '1234'}#{ins '5...'}"
Severity: Minor
Found in card/spec/card/diff_spec.rb and 2 other locations - About 15 mins to fix
card/spec/card/diff_spec.rb on lines 75..79
card/spec/card/diff_spec.rb on lines 83..87

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

      Card::Auth.as_bot do
        [c1, c2, c3].each { |c| c.update content: "WeirdWord" }
        Card.create(name: "c1+*self+*read", type: "Pointer", content: "r3")
Severity: Minor
Found in mod/permissions/spec/set/all/permissions_spec.rb and 1 other location - About 15 mins to fix
mod/permissions/spec/set/all/permissions_spec.rb on lines 162..164

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

    it "handles contextual titles" do
      create name: "tabs card", type: "pointer",
             content: "[[A+B]]\n[[One+Two+Three]]\n[[Four+One+Five]]"
      tabs = render_content  "{{tabs card|tabs|closed;title:_left}}"
      assert_view_select tabs, "div[role=tabpanel]" do
Severity: Minor
Found in mod/content/spec/set/all/tabs_spec.rb and 1 other location - About 15 mins to fix
mod/content/spec/set/all/tabs_spec.rb on lines 61..68

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

      Card::Auth.as_bot do
        [c1, c2, c3].each { |c| c.update content: "WeirdWord" }
        Card.create(name: "c1+*self+*read", type: "Pointer", content: "u1")
Severity: Minor
Found in mod/permissions/spec/set/all/permissions_spec.rb and 1 other location - About 15 mins to fix
mod/permissions/spec/set/all/permissions_spec.rb on lines 179..181

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

        it "doesn't create an act" do
          Card::Auth.as(:anonymous) do
            act_count = Card::Act.count
            Card.create name: "create fail"
            expect(Card::Act.count).to eq act_count
Severity: Minor
Found in mod/history/spec/set/all/history_spec.rb and 1 other location - About 15 mins to fix
mod/history/spec/set/all/history_spec.rb on lines 116..120

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

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

        it "doesn't create an action" do
          Card::Auth.as(:anonymous) do
            action_count = Card::Action.count
            Card.create name: "create fail"
            expect(Card::Action.count).to eq action_count
Severity: Minor
Found in mod/history/spec/set/all/history_spec.rb and 1 other location - About 15 mins to fix
mod/history/spec/set/all/history_spec.rb on lines 108..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 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

Missing top-level module documentation comment.
Open

module ClassMethods
Severity: Minor
Found in mod/account/set/all/account.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Start context description with 'when', 'with', or 'without'.
Open

    context "blank password" do

Use %r around regular expression.
Open

  special_char: /[!"#$%&'()*+,-.\/:;<=>?@\[\]\\^_`{|}~]/,
Severity: Minor
Found in mod/account/set/right/password.rb by rubocop

This cop enforces using // or %r around regular expressions.

Example: EnforcedStyle: slashes (default)

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = %r{
  foo
  (bar)
  (baz)
}x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = /
  foo
  (bar)
  (baz)
/x

Example: EnforcedStyle: percent_r

# bad
snake_case = /^[\dA-Z_]+$/

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = %r{^[\dA-Z_]+$}

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: EnforcedStyle: mixed

# bad
snake_case = %r{^[\dA-Z_]+$}

# bad
regex = /
  foo
  (bar)
  (baz)
/x

# good
snake_case = /^[\dA-Z_]+$/

# good
regex = %r{
  foo
  (bar)
  (baz)
}x

Example: AllowInnerSlashes: false (default)

# If `false`, the cop will always recommend using `%r` if one or more
# slashes are found in the regexp string.

# bad
x =~ /home\//

# good
x =~ %r{home/}

Example: AllowInnerSlashes: true

# good
x =~ /home\//

Start context description with 'when', 'with', or 'without'.
Open

  context "signup (with approval)" do

Use let instead of an instance variable.
Open

      expect(@account.salt).not_to eq("")

Use let instead of an instance variable.
Open

        expect(@signup.type_id).to eq(Card::UserID)

Use let instead of an instance variable.
Open

      expect(@signup.format.invitation?).to be(true)

Start context description with 'when', 'with', or 'without'.
Open

    context "for Joe User" do

Use let instead of an instance variable.
Open

        Card::Auth.as_bot { r1_members.items = [@joe_user_card.id] }

Use let instead of an instance variable.
Open

      expect(@mail.to).to eq([@email])

Use let instead of an instance variable.
Open

      body = @mail.parts[0].body.raw_source

Use let instead of an instance variable.
Open

      Card::Env.params[:token] = Card::Auth::Token.encode @signup.id, anonymous: true

Use let instead of an instance variable.
Open

      expect(@signup.type_id).to eq(Card::SignupID)

Use let instead of an instance variable.
Open

        new_parties = [Card::AnyoneSignedInID, Card::SharkID, r1.id, @joe_user_card.id]
Severity
Category
Status
Source
Language