Showing 154 of 154 total issues
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
load Gem.bin_path("rspec-core", "rspec")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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. [91/80] Open
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
- Create a ticketCreate a ticket
- Exclude checks
Multiple headers with the same content Open
#### Response
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD024 - Multiple headers with the same content
Tags: headers
Aliases: no-duplicate-header
Parameters: allowdifferentnesting (boolean; default false)
This rule is triggered if there are multiple headers in the document that have the same text:
# Some text
## Some text
To fix this, ensure that the content of each header is different:
# Some text
## Some more text
Rationale: Some markdown parses generate anchors for headers based on the header name, and having headers with the same content can cause problems with this.
If the parameter allow_different_nesting
is set to true
, header duplication
under different nesting is allowed, like it usually happens in change logs:
# Change log
## 2.0.0
### Bug fixes
### Features
## 1.0.0
### Bug fixes
Put empty method definitions on a single line. Open
def show
end
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for the formatting of empty method definitions.
By default it enforces empty method definitions to go on a single
line (compact style), but it can be configured to enforce the end
to go on its own line (expanded style).
Note: A method definition is not considered empty if it contains comments.
Example: EnforcedStyle: compact (default)
# bad
def foo(bar)
end
def self.foo(bar)
end
# good
def foo(bar); end
def foo(bar)
# baz
end
def self.foo(bar); end
Example: EnforcedStyle: expanded
# bad
def foo(bar); end
def self.foo(bar); end
# good
def foo(bar)
end
def self.foo(bar)
end
Line is too long. [90/80] Open
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
- Create a ticketCreate a ticket
- Exclude checks
Align the parameters of a method call if they span more than one line. Open
Pathname.new(__FILE__).realpath)
- 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
Line is too long. [97/80] Open
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [97/80] Open
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
- Create a ticketCreate a ticket
- Exclude checks
Code block style Open
$ rails runner 'puts Env.APP_CONFIG("default")'
- Create a ticketCreate a ticket
- Exclude checks
Code block style Open
$ RAILS_MASTER_KEY=289e1431050b365b62bb5917acabcc53 APP_CONFIG=envVar rails runner 'puts Env.APP_CONFIG("default")'
- Create a ticketCreate a ticket
- Exclude checks
Code block style Open
$ RAILS_MASTER_KEY=289e1431050b365b62bb5917acabcc53 rails runner 'puts Env.APP_CONFIG'
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [92/80] Open
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
- Create a ticketCreate a ticket
- Exclude checks
Line is too long. [88/80] Open
# Never trust parameters from the scary internet, only allow the white list through.
- Create a ticketCreate a ticket
- Exclude checks
Missing top-level class documentation comment. Open
class ApplicationMailer < ActionMailer::Base
- 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
Line is too long. [94/80] Open
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
- Create a ticketCreate a ticket
- Exclude checks
Extra blank line detected. Open
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cops checks for two or more consecutive blank lines.
Example:
# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method
# good
some_method
# one empty line
some_method
Do not use block comments. Open
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop looks for uses of block comments (=begin...=end).
Example:
# bad
=begin
Multiple lines
of comments...
=end
# good
# Multiple lines
# of comments...
Code block style Open
$ APP_CONFIG=envVar rails runner 'puts Env.APP_CONFIG("default")'
- Create a ticketCreate a ticket
- Exclude checks
Use 2 (not 1) spaces for indenting an expression spanning multiple lines. Open
.select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks the indentation of the method name part in method calls that span more than one line.
Example: EnforcedStyle: aligned
# bad
while myvariable
.b
# do something
end
# good
while myvariable
.b
# do something
end
# good
Thing.a
.b
.c
Example: EnforcedStyle: indented
# good
while myvariable
.b
# do something
end
Example: EnforcedStyle: indentedrelativeto_receiver
# good
while myvariable
.a
.b
# do something
end
# good
myvariable = Thing
.a
.b
.c
Missing top-level class documentation comment. Open
class UsersController < ApplicationController
- 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