Showing 183 of 231 total issues
Missing space after #
. Open
#csv_path = File.expand_path "../data/error.csv", __FILE__
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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?
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Create a ticketCreate a ticket
- Exclude checks
The second argument to describe should be the method being tested. '#instance' or '.class'. Open
RSpec.describe Card::Set::Type::MetricAnswer, "hybrid" do
- Create a ticketCreate a ticket
- Exclude checks
Redundant curly braces around a hash parameter. Open
request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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|
- Create a ticketCreate a ticket
- Exclude checks
Use nested module/class definitions instead of compact style. Open
class Card::Metric
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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"
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Create a ticketCreate a ticket
- Exclude checks
Empty example group detected. Open
RSpec.describe Card::Set::Type::User do
- Create a ticketCreate a ticket
- Exclude checks
include
is used at the top level. Use inside class
or module
. Open
include Comparable
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Create a ticketCreate a ticket
- Exclude checks
Missing top-level class documentation comment. Open
class AnswerCreator
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
- Create a ticketCreate a ticket
- Exclude checks
The second argument to describe should be the method being tested. '#instance' or '.class'. Open
RSpec.describe Card::Set::MetricType::Score, "basic properties" do
- Create a ticketCreate a ticket
- Exclude checks
Start context description with 'when', 'with', or 'without'. Open
RSpec.shared_context "report query" do |type, action|
- Create a ticketCreate a ticket
- Exclude checks
Spec path should end with spec/set/self/metric*metricreportqueries*_spec.rb
. Open
RSpec.describe Card::Set::Self::Metric, "metric report queries" do
- Create a ticketCreate a ticket
- Exclude checks