Commit 8c5c8ec1 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'fix-trivial-accessors' into 'master'

chore(rubocop): fix Style/TrivialAccessors issues

See merge request gitlab-org/gitlab-ce!24416
parents 4725ae2b c379973b
...@@ -686,17 +686,6 @@ Style/TrailingUnderscoreVariable: ...@@ -686,17 +686,6 @@ Style/TrailingUnderscoreVariable:
- 'spec/lib/gitlab/etag_caching/middleware_spec.rb' - 'spec/lib/gitlab/etag_caching/middleware_spec.rb'
- 'spec/services/quick_actions/interpret_service_spec.rb' - 'spec/services/quick_actions/interpret_service_spec.rb'
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
# Whitelist: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
Style/TrivialAccessors:
Exclude:
- 'app/models/external_issue.rb'
- 'app/serializers/base_serializer.rb'
- 'lib/gitlab/auth/ldap/person.rb'
- 'lib/system_check/base_check.rb'
# Offense count: 4 # Offense count: 4
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/UnlessElse: Style/UnlessElse:
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class ExternalIssue class ExternalIssue
include Referable include Referable
attr_reader :project
def initialize(issue_identifier, project) def initialize(issue_identifier, project)
@issue_identifier, @project = issue_identifier, project @issue_identifier, @project = issue_identifier, project
end end
...@@ -32,12 +34,8 @@ class ExternalIssue ...@@ -32,12 +34,8 @@ class ExternalIssue
[self.class, to_s].hash [self.class, to_s].hash
end end
def project
@project
end
def project_id def project_id
@project.id project.id
end end
def to_reference(_from = nil, full: nil) def to_reference(_from = nil, full: nil)
......
...@@ -16,11 +16,11 @@ class BaseSerializer ...@@ -16,11 +16,11 @@ class BaseSerializer
.as_json .as_json
end end
def self.entity(entity_class) class << self
attr_reader :entity_class
def entity(entity_class)
@entity_class ||= entity_class @entity_class ||= entity_class
end end
def self.entity_class
@entity_class
end end
end end
...@@ -98,9 +98,7 @@ module Gitlab ...@@ -98,9 +98,7 @@ module Gitlab
private private
def entry attr_reader :entry
@entry
end
def config def config
@config ||= Gitlab::Auth::LDAP::Config.new(provider) @config ||= Gitlab::Auth::LDAP::Config.new(provider)
......
...@@ -70,18 +70,14 @@ module SystemCheck ...@@ -70,18 +70,14 @@ module SystemCheck
# multiple reasons why a check can fail # multiple reasons why a check can fail
# #
# @param [String] reason to be displayed # @param [String] reason to be displayed
def skip_reason=(reason) attr_writer :skip_reason
@skip_reason = reason
end
# Skip reason defined during runtime # Skip reason defined during runtime
# #
# This value have precedence over the one defined in the subclass # This value have precedence over the one defined in the subclass
# #
# @return [String] the reason # @return [String] the reason
def skip_reason attr_reader :skip_reason
@skip_reason
end
# Does the check support automatically repair routine? # Does the check support automatically repair routine?
# #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment