wikirate/wikirate

View on GitHub

Showing 183 of 231 total issues

Missing space after #.
Open

#csv_path = File.expand_path "../data/error.csv", __FILE__

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

  unless value_type_card.real?
Severity: Minor
Found in script/standardize_metric_values.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

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

RSpec.shared_context "answer query" do

The second argument to describe should be the method being tested. '#instance' or '.class'.
Open

RSpec.describe Card::Set::Type::MetricAnswer, "hybrid" do

Redundant curly braces around a hash parameter.
Open

request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})
Severity: Minor
Found in script/monit_slack.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Missing top-level class documentation comment.
Open

    class SearchLog

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

Rename has_value? to value?.
Open

      def has_value? company_id, year

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

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

RSpec.shared_context "award badges context" do |threshold|

Use nested module/class definitions instead of compact style.
Open

class Card::Metric

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Align the parameters of a method call if they span more than one line.
Open

               class: "wikirate_company_autocomplete form-control"

Here we check if the parameters on a multi-line method call or definition are aligned.

Example: EnforcedStyle: withfirstparameter (default)

# good

foo :bar,
    :baz

# bad

foo :bar,
  :baz

Example: EnforcedStyle: withfixedindentation

# good

foo :bar,
  :baz

# bad

foo :bar,
    :baz

Spec path should end with spec/set/metric_type/score*basicproperties*_spec.rb.
Open

RSpec.describe Card::Set::MetricType::Score, "basic properties" do

Empty example group detected.
Open

RSpec.describe Card::Set::Type::User do

include is used at the top level. Use inside class or module.
Open

include Comparable
Severity: Minor
Found in mod/badges/set/abstract/01_badge.rb by rubocop

This cop checks that include, extend and prepend exists at the top level. Using these at the top level affects the behavior of Object. There will not be using include, extend and prepend at the top level. Let's use it inside class or module.

Example:

# bad
include M

class C
end

# bad
extend M

class C
end

# bad
prepend M

class C
end

# good
class C
  include M
end

# good
class C
  extend M
end

# good
class C
  prepend M
end

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

  context "html format" do

Missing top-level class documentation comment.
Open

  class AnswerCreator

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

When using method_missing, define respond_to_missing? and fall back on super.
Open

    def method_missing company, *args
      # return super unless Card[company]&.type_id == WikiRateCompanyID
      args.first.each_pair do |year, value|
        create_answer company, year, value
      end

This cop checks for the presence of method_missing without also defining respond_to_missing? and falling back on super.

Example:

#bad
def method_missing(name, *args)
  # ...
end

#good
def respond_to_missing?(name, include_private)
  # ...
end

def method_missing(name, *args)
  # ...
  super
end

Empty example group detected.
Open

RSpec.describe Card::Set::Type::MetricAnswer do

The second argument to describe should be the method being tested. '#instance' or '.class'.
Open

RSpec.describe Card::Set::MetricType::Score, "basic properties" do

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

RSpec.shared_context "report query" do |type, action|

Spec path should end with spec/set/self/metric*metricreportqueries*_spec.rb.
Open

RSpec.describe Card::Set::Self::Metric, "metric report queries" do
Severity
Category
Status
Source
Language