Showing 12,635 of 12,635 total issues
unexpected token tRPAREN
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
Tag.where(keyword_id:).where(tag_object_type: ['Container', 'Otu', 'CollectionObject']).distinct.all.each do |o|
- 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 tRCURLY
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
.where(g: {id:})
- 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
georeferenceSources: "Georeferenced image.",
- 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"
class definition in method body
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
class RequestUI
- 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 2 (not 4) spaces for indentation. Open
def source_use_only
- 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 tRCURLY
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
.where(i: {id:})
- 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.
cannot assign to a keyword
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
is_hybrid: nil,
- 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.
cannot assign to a keyword
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
has_external_accepted_name: nil, # could be homonym or synonym, either way protonym is not valid. will use taxonomicStatus to determine the kind of relationship
- 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 tRCURLY
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
klass.constantize.joins(:tags).where(tags: {keyword_id:}).each do |o|
- 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
partials = CollectingEvent.where(geographic_area:)
- 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.
Specify a :dependent
option. Open
has_one :sled_image
- Read upRead up
- Exclude checks
This cop looks for has_many
or has_one
associations that don't
specify a :dependent
option.
It doesn't register an offense if :through
option was specified.
Example:
# bad
class User < ActiveRecord::Base
has_many :comments
has_one :avatar
end
# good
class User < ActiveRecord::Base
has_many :comments, dependent: :restrict_with_exception
has_one :avatar, dependent: :destroy
has_many :patients, through: :appointments
end
cannot assign to a keyword
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
create_original_combination: true, # default to creating an original combination, is set to false if missing
- 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.
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
scope :used_recently_on_sources, -> { joins(sources: [:project_sources]).includes(sources: [:project_sources]).where(sources: { updated_at: 10.weeks.ago..Time.now } ).order('"sources"."updated_at" DESC') }
- 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
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
scope :used_recently, -> { joins(:identifiers).includes(:identifiers).where(identifiers: { updated_at: 10.weeks.ago..Time.now } ).order('"identifiers"."created_at" DESC') }
- 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
class definition in method body
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
class Response
- 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 the new style validations validates :column, uniqueness: value
over validates_uniqueness_of
. Open
validates_uniqueness_of :identifier, scope: [:namespace_id, :project_id, :type], message: lambda { |error, attributes| "#{attributes[:value]} already taken"}
- Read upRead up
- Exclude checks
This cop checks for the use of old-style attribute validation macros.
Example:
# bad
validates_acceptance_of :foo
validates_confirmation_of :foo
validates_exclusion_of :foo
validates_format_of :foo
validates_inclusion_of :foo
validates_length_of :foo
validates_numericality_of :foo
validates_presence_of :foo
validates_absence_of :foo
validates_size_of :foo
validates_uniqueness_of :foo
# good
validates :foo, acceptance: true
validates :foo, confirmation: true
validates :foo, exclusion: true
validates :foo, format: true
validates :foo, inclusion: true
validates :foo, length: true
validates :foo, numericality: true
validates :foo, presence: true
validates :foo, absence: true
validates :foo, size: true
validates :foo, uniqueness: true
unexpected token tRCURLY
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
.where(i: {id:})
- 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.
Avoid using update_column
because it skips validations. Open
update_column(:cached, identifier)
- Read upRead up
- Exclude checks
This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations
Methods may be ignored from this rule by configuring a Whitelist
.
Example:
# bad
Article.first.decrement!(:view_count)
DiscussionBoard.decrement_counter(:post_count, 5)
Article.first.increment!(:view_count)
DiscussionBoard.increment_counter(:post_count, 5)
person.toggle :active
product.touch
Billing.update_all("category = 'authorized', author = 'David'")
user.update_attribute(:website, 'example.com')
user.update_columns(last_request_at: Time.current)
Post.update_counters 5, comment_count: -1, action_count: 1
# good
user.update(website: 'example.com')
FileUtils.touch('file')
Example: Whitelist: ["touch"]
# bad
DiscussionBoard.decrement_counter(:post_count, 5)
DiscussionBoard.increment_counter(:post_count, 5)
person.toggle :active
# good
user.touch
unexpected token tRPAREN
(Using Ruby 2.4 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
pinboard: Image.pinned_by(user_id).where(project_id:).to_a,
- 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 the new style validations validates :column, absence: value
over validates_absence_of
. Open
validates_absence_of :predicate
- Read upRead up
- Exclude checks
This cop checks for the use of old-style attribute validation macros.
Example:
# bad
validates_acceptance_of :foo
validates_confirmation_of :foo
validates_exclusion_of :foo
validates_format_of :foo
validates_inclusion_of :foo
validates_length_of :foo
validates_numericality_of :foo
validates_presence_of :foo
validates_absence_of :foo
validates_size_of :foo
validates_uniqueness_of :foo
# good
validates :foo, acceptance: true
validates :foo, confirmation: true
validates :foo, exclusion: true
validates :foo, format: true
validates :foo, inclusion: true
validates :foo, length: true
validates :foo, numericality: true
validates :foo, presence: true
validates :foo, absence: true
validates :foo, size: true
validates :foo, uniqueness: true