wikirate/wikirate

View on GitHub

Showing 183 of 231 total issues

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

    it "creates metric" do
      expect(metric).to be_instance_of Card
      expect(metric.type_name).to eq "Metric"
      expect(metric.relationship?).to be true
      expect(metric.metric_type).to eq "Relationship"
mod/deckorate_research/spec/set/metric_type/relationship_spec.rb on lines 28..32

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

        with_tag :tr, with: { class: "tr_class" } do
          with_tag :td, with: { class: "td_all td_1" }, text: "A"
          with_tag :td, with: { class: "td_all td_2" }, text: "RichText"
        end
Severity: Minor
Found in mod/deckorate_layout/spec/set/abstract/table_spec.rb and 1 other location - About 20 mins to fix
mod/deckorate_layout/spec/set/abstract/table_spec.rb on lines 23..26

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

    it "creates inverse metric" do
      expect(inverse_metric).to be_instance_of Card
      expect(inverse_metric.type_name).to eq "Metric"
      expect(inverse_metric.relationship?).to be true
      expect(inverse_metric.metric_type).to eq "Inverse Relationship"
mod/deckorate_research/spec/set/metric_type/relationship_spec.rb on lines 21..25

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

        with_tag :tr, with: { class: "tr_class" } do
          with_tag :td, with: { class: "td_all td_1" }, text: "r1"
          with_tag :td, with: { class: "td_all td_2" }, text: "Role"
        end
Severity: Minor
Found in mod/deckorate_layout/spec/set/abstract/table_spec.rb and 1 other location - About 20 mins to fix
mod/deckorate_layout/spec/set/abstract/table_spec.rb on lines 19..22

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

  it_behaves_like "cached count", "Death Star+answer", 35, 3 do
    # increment = 2, because one researched answer + one calculated answer
    let :add_one do
      Card["Jedi+disturbances in the force"].create_answers true do
        Death_Star "1999" => "yes"
mod/deckorate_core/spec/set/type_plus_right/metric/wikirate_company_spec.rb on lines 4..11
mod/deckorate_research/spec/set/type_plus_right/metric/metric_answer_spec.rb on lines 2..9

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

  it_behaves_like "cached count", "Jedi+disturbances in the force+companies", 4, 1 do
    let :add_one do
      Card["Jedi+disturbances in the force"].create_answers true do
        Samsung "1977" => "yes"
      end
mod/deckorate_research/spec/set/type_plus_right/metric/metric_answer_spec.rb on lines 2..9
mod/deckorate_research/spec/set/type_plus_right/wikirate_company/metric_answer_spec.rb on lines 2..10

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

  it_behaves_like "cached count", "Jedi+disturbances in the force+answer", 12, 1 do
    let :add_one do
      Card["Jedi+disturbances in the force"].create_answers true do
        Samsung "1977" => "yes"
      end
mod/deckorate_core/spec/set/type_plus_right/metric/wikirate_company_spec.rb on lines 4..11
mod/deckorate_research/spec/set/type_plus_right/wikirate_company/metric_answer_spec.rb on lines 2..10

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

    context "with metric argument" do
      before { filter_args metric: "myMetric" }
      it do
        is_expected.to eq cql(
          referred_to_by: { left: { name: "myMetric" }, right: "topic" }
Severity: Minor
Found in mod/topics/spec/set/abstract/topic_search_spec.rb and 1 other location - About 15 mins to fix
mod/topics/spec/set/abstract/topic_search_spec.rb on lines 34..39

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 "shows the link for view \"missing\"" do
    html = render_card :unknown, type_id: Card::WikirateCompanyID,
                                 name: "non-existing-card"
    expect(html).to eq(render_card(:link, type_id: Card::WikirateCompanyID,
                                          name: "non-existing-card"))
Severity: Minor
Found in mod/wikirate_companies/spec/set/type/wikirate_company_spec.rb and 1 other location - About 15 mins to fix
mod/topics/spec/set/type/wikirate_topic_spec.rb on lines 24..27

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

      .to include(have_attributes(year: 2011, company_id: apple, value: 5.0),
                  have_attributes(year: 2012, company_id: apple, value: 10.0),
                  have_attributes(year: 2013, company_id: apple, value: 10.0))
Severity: Minor
Found in mod/deckorate_calculations/spec/calculate/rubric_spec.rb and 2 other locations - About 15 mins to fix
mod/deckorate_calculations/spec/calculate/java_script_spec.rb on lines 9..11
mod/deckorate_calculations/spec/calculate/rubric_spec.rb on lines 9..11

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

    context "with dataset argument" do
      before { filter_args dataset: "myDataset" }
      it do
        is_expected.to eq cql(
          referred_to_by: { left: { name: "myDataset" }, right: "topic" }
Severity: Minor
Found in mod/topics/spec/set/abstract/topic_search_spec.rb and 1 other location - About 15 mins to fix
mod/topics/spec/set/abstract/topic_search_spec.rb on lines 25..30

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

      .to include(have_attributes(year: 2011, company_id: apple, value: 22.0),
                  have_attributes(year: 2012, company_id: apple, value: 24.0),
                  have_attributes(year: 2013, company_id: apple, value: 26.0))
Severity: Minor
Found in mod/deckorate_calculations/spec/calculate/java_script_spec.rb and 2 other locations - About 15 mins to fix
mod/deckorate_calculations/spec/calculate/rubric_spec.rb on lines 9..11
mod/deckorate_calculations/spec/calculate/rubric_spec.rb on lines 21..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 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 "initializes correcly" do
        expect(set.threshold(:researcher)).to eq 3
        expect(set.level(:researcher)).to eq :silver
        expect(set.level_index(:researcher)).to eq 1
Severity: Minor
Found in mod/badges/spec/badge_line_spec.rb and 1 other location - About 15 mins to fix
mod/badges/spec/badge_line_spec.rb on lines 22..25

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

      .to include(have_attributes(year: 2011, company_id: apple, value: 1.0),
                  have_attributes(year: 2012, company_id: apple, value: 2.0),
                  have_attributes(year: 2013, company_id: apple, value: 3.0))
Severity: Minor
Found in mod/deckorate_calculations/spec/calculate/rubric_spec.rb and 2 other locations - About 15 mins to fix
mod/deckorate_calculations/spec/calculate/java_script_spec.rb on lines 9..11
mod/deckorate_calculations/spec/calculate/rubric_spec.rb on lines 21..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 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 "initializes correcly" do
        expect(set.threshold(:researcher)).to eq 3
        expect(set.level(:researcher)).to eq :bronze
        expect(set.level_index(:researcher)).to eq 0
Severity: Minor
Found in mod/badges/spec/badge_line_spec.rb and 1 other location - About 15 mins to fix
mod/badges/spec/badge_line_spec.rb on lines 12..15

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

Rename have_table to table?.
Open

  def have_table values

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Line is too long. [127/90]
Open

        expect(html).to include(%{Only <a class="known-card" href="/Joe_User">Joe User</a>(author) can edit this text source.})

Spec path should end with spec/set/self/wikirate_company*companyreportqueries*_spec.rb.
Open

RSpec.describe Card::Set::Self::WikirateCompany, "company report queries" do

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Open

require 'net/https'
Severity: Minor
Found in script/monit_slack.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [140/90]
Open

  next unless Card[cardname + "+link"] && (!Card[cardname + "+title"] || !Card[cardname + "+description"] || !Card[cardname + "+image url"])
Severity: Minor
Found in script/update_source_title.rb by rubocop
Severity
Category
Status
Source
Language