Showing 368 of 369 total issues
Do not read from ENV
directly post initialization. Open
Open
bearer: ENV["STAFF_ADMIN_TOKEN"],
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
push_url = "#{ENV['LAGOTTINO_URL']}/events"
- Exclude checks
Empty class detected. Open
Open
class DoiDeleteWorker
# include Shoryuken::Worker
# shoryuken_options queue: ->{ "#{ENV['RAILS_ENV']}_doi" }
- Read upRead up
- Exclude checks
Checks for classes and metaclasses without a body. Such empty classes and metaclasses are typically an oversight or we should provide a comment to be clearer what we're aiming for.
Example:
# bad
class Foo
end
class Bar
class << self
end
end
class << obj
end
# good
class Foo
def do_something
# ... code
end
end
class Bar
class << self
attr_reader :bar
end
end
class << obj
attr_reader :bar
end
Example: AllowComments: false (default)
# bad
class Foo
# TODO: implement later
end
class Bar
class << self
# TODO: implement later
end
end
class << obj
# TODO: implement later
end
Example: AllowComments: true
# good
class Foo
# TODO: implement later
end
class Bar
class << self
# TODO: implement later
end
end
class << obj
# TODO: implement later
end
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping. Open
Open
gem "json-canonicalization", '0.3.1'
- Read upRead up
- 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"
Do not read from ENV
directly post initialization. Open
Open
bearer: ENV["EVENTDATA_TOKEN"],
- Exclude checks
Avoid immutable Array literals in loops. It is better to extract it into a local variable or a constant. Open
Open
if [200, 201].include?(response.status)
- Exclude checks
Do not return a value in initialize
. Open
Open
return @errors if report.body.fetch("errors", nil).present?
- Read upRead up
- Exclude checks
Checks for the use of a return with a value in a context where the value will be ignored. (initialize and setter methods)
Example:
# bad
def initialize
foo
return :qux if bar?
baz
end
def foo=(bar)
return 42
end
Example:
# good
def initialize
foo
return if bar?
baz
end
def foo=(bar)
return
end
Do not read from ENV
directly post initialization. Open
Open
source_token = ENV["DATACITE_RESOLUTION_SOURCE_TOKEN"]
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
shoryuken_options queue: -> { "#{ENV['RAILS_ENV']}_doi" }, auto_delete: true
- Exclude checks
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem next_rails
should appear before sprockets
. Open
Open
gem 'next_rails'
- Read upRead up
- Exclude checks
Gems should be alphabetically sorted within groups.
Example:
# bad
gem 'rubocop'
gem 'rspec'
# good
gem 'rspec'
gem 'rubocop'
# good
gem 'rubocop'
gem 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Do not read from ENV
directly post initialization. Open
Open
host = ENV["EVENTDATA_URL"]
- Exclude checks
Useless assignment to variable - response
. Open
Open
response = Maremma.post(push_url, data: data.to_json,
- Read upRead up
- Exclude checks
Checks for every useless assignment to local variable in every
scope.
The basic idea for this cop was from the warning of ruby -cw
:
assigned but unused variable - foo
Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.
Example:
# bad
def some_method
some_var = 1
do_something
end
Example:
# good
def some_method
some_var = 1
do_something(some_var)
end
Do not read from ENV
directly post initialization. Open
Open
"#{ENV['SASHIMI_QUERY_URL']}/reports"
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
push_url = "#{ENV['LAGOTTINO_URL']}/events"
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
when ENV["API_URL"].include?("test")
- Exclude checks
Gems should be sorted in an alphabetical order within their section of the Gemfile. Gem json-canonicalization
should appear before next_rails
. Open
Open
gem "json-canonicalization", '0.3.1'
- Read upRead up
- Exclude checks
Gems should be alphabetically sorted within groups.
Example:
# bad
gem 'rubocop'
gem 'rspec'
# good
gem 'rspec'
gem 'rubocop'
# good
gem 'rubocop'
gem 'rspec'
# good only if TreatCommentsAsGroupSeparators is true
# For code quality
gem 'rubocop'
# For tests
gem 'rspec'
Do not read from ENV
directly post initialization. Open
Open
source_token = ENV["DATACITE_RELATED_SOURCE_TOKEN"]
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
source_token = ENV["DATACITE_USAGE_SOURCE_TOKEN"]
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
if ENV["STAFF_ADMIN_TOKEN"].present?
- Exclude checks
Do not read from ENV
directly post initialization. Open
Open
if ENV["STAFF_ADMIN_TOKEN"].present?
- Exclude checks