Showing 12,636 of 12,636 total issues
unexpected token tCOMMA
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.set!("Past week: New collecting events", CollectingEvent.where(created_at: 1.week.ago.., project_id: @project_id).count)
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
json.partial! "/observation_matrix_columns/attributes", observation_matrix_column: a
- 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"
Prefer symbols instead of strings as hash keys. Open
'xmlns:dc' => 'http://purl.org/dc/terms/',
- Read upRead up
- Exclude checks
This cop checks for the use of strings as keys in hashes. The use of symbols is preferred instead.
Example:
# bad
{ 'one' => 1, 'two' => 2, 'three' => 3 }
# good
{ one: 1, two: 2, three: 3 }
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
json.partial! "/observation_matrix_rows/attributes", observation_matrix_row: a
- 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"
Use 2 (not 1) spaces for indentation. Open
json.partial! '/people/attributes', person: person
- Read upRead up
- Exclude checks
This cop checks for indentation that doesn't use the specified number of spaces.
See also the IndentationConsistency cop which is the companion to this one.
Example:
# bad
class A
def test
puts 'hello'
end
end
# good
class A
def test
puts 'hello'
end
end
Example: IgnoredPatterns: ['^\s*module']
# bad
module A
class B
def test
puts 'hello'
end
end
end
# good
module A
class B
def test
puts 'hello'
end
end
end
unexpected token kEND
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
end
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
Prefer symbols instead of strings as hash keys. Open
content_tag(:div, '', data: { 'global-id' => object.to_global_id.to_s, 'radial-annotator' => 'true', 'show-count' => showCount, 'pulse' => pulse })
- Read upRead up
- Exclude checks
This cop checks for the use of strings as keys in hashes. The use of symbols is preferred instead.
Example:
# bad
{ 'one' => 1, 'two' => 2, 'three' => 3 }
# good
{ one: 1, two: 2, three: 3 }
unexpected token kEND
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
end
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
unexpected token tCOMMA
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.set!("Past week: New images", Image.where(created_at: 1.week.ago.., project_id: @project_id).count)
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
unexpected token tCOMMA
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.set!("Past week: New roles", Role.where(created_at: 1.week.ago.., project_id: @project_id).count)
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
json.imported_objects dataset_record.metadata["imported_objects"] if dataset_record.metadata["imported_objects"]
- 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"
Prefer symbols instead of strings as hash keys. Open
'xsi:schemaLocation' => 'http://www.nexml.org/2009 ../xsd/nexml.xsd',
- Read upRead up
- Exclude checks
This cop checks for the use of strings as keys in hashes. The use of symbols is preferred instead.
Example:
# bad
{ 'one' => 1, 'two' => 2, 'three' => 3 }
# good
{ one: 1, two: 2, three: 3 }
unexpected token kDO_BLOCK
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.origin_citation do
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
Use if collection_object.blank?
instead of unless collection_object.present?
. Open
return DwcOccurrence.none unless collection_object.present?
- Read upRead up
- Exclude checks
This cop checks for code that can be written with simpler conditionals
using Object#blank?
defined by Active Support.
Interaction with Style/UnlessElse
:
The configuration of NotPresent
will not produce an offense in the
context of unless else
if Style/UnlessElse
is inabled. This is
to prevent interference between the auto-correction of the two cops.
Example: NilOrEmpty: true (default)
# Converts usages of `nil? || empty?` to `blank?`
# bad
foo.nil? || foo.empty?
foo == nil || foo.empty?
# good
foo.blank?
Example: NotPresent: true (default)
# Converts usages of `!present?` to `blank?`
# bad
!foo.present?
# good
foo.blank?
Example: UnlessPresent: true (default)
# Converts usages of `unless present?` to `if blank?`
# bad
something unless foo.present?
# good
something if foo.blank?
# bad
unless foo.present?
something
end
# good
if foo.blank?
something
end
# good
def blank?
!present?
end
Do not use Time.now
without zone. Use one of Time.zone.now
, Time.current
, Time.now.in_time_zone
, Time.now.utc
, Time.now.getlocal
, Time.now.xmlschema
, Time.now.iso8601
, Time.now.jisx0301
, Time.now.rfc3339
, Time.now.httpdate
, Time.now.to_i
, Time.now.to_f
instead. Open
json.cite_as "#{p.name} curators. #{Time.now.year}. Valid species for #{label_for_taxon_name(n)} in #{p.name}, a database in TaxonWorks. Accessed #{Time.now} by #{request.url}."
- Read upRead up
- Exclude checks
This cop checks for the use of Time methods without zone.
Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time) and the article http://danilenko.org/2012/7/6/rails_timezones/
Two styles are supported for this cop. When EnforcedStyle is 'strict' then only use of Time.zone is allowed.
When EnforcedStyle is 'flexible' then it's also allowed to use Time.intimezone.
Example: EnforcedStyle: strict
# `strict` means that `Time` should be used with `zone`.
# bad
Time.now
Time.parse('2015-03-02 19:05:37')
# bad
Time.current
Time.at(timestamp).in_time_zone
# good
Time.zone.now
Time.zone.parse('2015-03-02 19:05:37')
Example: EnforcedStyle: flexible (default)
# `flexible` allows usage of `in_time_zone` instead of `zone`.
# bad
Time.now
Time.parse('2015-03-02 19:05:37')
# good
Time.zone.now
Time.zone.parse('2015-03-02 19:05:37')
# good
Time.current
Time.at(timestamp).in_time_zone
unexpected token tRPAREN
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.set!("Past week: New taxon names", TaxonName.where(created_at: 1.week.ago..).count)
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
unexpected token tRPAREN
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.set!("Past week: New collection objects", CollectionObject.where(created_at: 1.week.ago..).count)
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
unexpected token kDO_BLOCK
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
json.unmoved do
- Read upRead up
- Exclude checks
This is not actually a cop. It does not inspect anything. It just provides methods to repack Parser's diagnostics/errors into RuboCop's offenses.
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
json.error_data dataset_record.metadata["error_data"] if dataset_record.metadata["error_data"]
- 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"
Prefer single-quoted strings when you don't need string interpolation or special symbols. Open
if ["Ready", "Staging", "Importing"].include? import_dataset.status
- 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"