Commit 0b3e5c6c authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'ck3g-fix-Layout-EmptyLinesAroundAttributeAccessor' into 'master'

Fix Layout/EmptyLinesAroundAttributeAccessor offences

See merge request gitlab-org/gitlab!81264
parents 7bc4b0bb 7c4f0b8d
...@@ -32,13 +32,6 @@ Graphql/IDType: ...@@ -32,13 +32,6 @@ Graphql/IDType:
Layout/ArgumentAlignment: Layout/ArgumentAlignment:
Enabled: false Enabled: false
# Offense count: 54
# Cop supports --auto-correct.
# Configuration parameters: AllowAliasSyntax, AllowedMethods.
# AllowedMethods: alias_method, public, protected, private
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: false
# Offense count: 771 # Offense count: 771
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth. # Configuration parameters: EnforcedStyle, IndentationWidth.
......
...@@ -7,6 +7,7 @@ class ApplicationMailer < ActionMailer::Base ...@@ -7,6 +7,7 @@ class ApplicationMailer < ActionMailer::Base
helper MarkupHelper helper MarkupHelper
attr_accessor :current_user attr_accessor :current_user
helper_method :current_user, :can? helper_method :current_user, :can?
default from: proc { default_sender_address.format } default from: proc { default_sender_address.format }
......
...@@ -4,6 +4,7 @@ class LfsDownloadObject ...@@ -4,6 +4,7 @@ class LfsDownloadObject
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :oid, :size, :link, :headers attr_accessor :oid, :size, :link, :headers
delegate :sanitized_url, :credentials, to: :sanitized_uri delegate :sanitized_url, :credentials, to: :sanitized_uri
validates :oid, format: { with: /\A\h{64}\z/ } validates :oid, format: { with: /\A\h{64}\z/ }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Storage module Storage
class Hashed class Hashed
attr_accessor :container attr_accessor :container
delegate :gitlab_shell, :repository_storage, to: :container delegate :gitlab_shell, :repository_storage, to: :container
REPOSITORY_PATH_PREFIX = '@hashed' REPOSITORY_PATH_PREFIX = '@hashed'
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Storage module Storage
class LegacyProject class LegacyProject
attr_accessor :project attr_accessor :project
delegate :namespace, :gitlab_shell, :repository_storage, to: :project delegate :namespace, :gitlab_shell, :repository_storage, to: :project
def initialize(project) def initialize(project)
......
...@@ -45,6 +45,7 @@ class WikiPage ...@@ -45,6 +45,7 @@ class WikiPage
# The GitLab Wiki instance. # The GitLab Wiki instance.
attr_reader :wiki attr_reader :wiki
delegate :container, to: :wiki delegate :container, to: :wiki
# The raw Gitlab::Git::WikiPage instance. # The raw Gitlab::Git::WikiPage instance.
......
...@@ -17,6 +17,7 @@ module Ci ...@@ -17,6 +17,7 @@ module Ci
MAX_TRACKABLE_FAILURES = 200 MAX_TRACKABLE_FAILURES = 200
attr_reader :pipeline attr_reader :pipeline
delegate :project, to: :pipeline delegate :project, to: :pipeline
def initialize(pipeline) def initialize(pipeline)
......
...@@ -57,6 +57,7 @@ module RateLimitedService ...@@ -57,6 +57,7 @@ module RateLimitedService
prepended do prepended do
attr_accessor :rate_limiter_bypassed attr_accessor :rate_limiter_bypassed
cattr_accessor :rate_limiter_scoped_and_keyed cattr_accessor :rate_limiter_scoped_and_keyed
def self.rate_limit(key:, opts:, rate_limiter: ::Gitlab::ApplicationRateLimiter) def self.rate_limit(key:, opts:, rate_limiter: ::Gitlab::ApplicationRateLimiter)
......
...@@ -6,6 +6,7 @@ module UpdateRepositoryStorageMethods ...@@ -6,6 +6,7 @@ module UpdateRepositoryStorageMethods
Error = Class.new(StandardError) Error = Class.new(StandardError)
attr_reader :repository_storage_move attr_reader :repository_storage_move
delegate :container, :source_storage_name, :destination_storage_name, to: :repository_storage_move delegate :container, :source_storage_name, :destination_storage_name, to: :repository_storage_move
def initialize(repository_storage_move) def initialize(repository_storage_move)
......
...@@ -4,6 +4,7 @@ module NotificationRecipients ...@@ -4,6 +4,7 @@ module NotificationRecipients
module Builder module Builder
class MergeRequestUnmergeable < Base class MergeRequestUnmergeable < Base
attr_reader :target attr_reader :target
def initialize(merge_request) def initialize(merge_request)
@target = merge_request @target = merge_request
end end
......
...@@ -4,6 +4,7 @@ module NotificationRecipients ...@@ -4,6 +4,7 @@ module NotificationRecipients
module Builder module Builder
class NewNote < Base class NewNote < Base
attr_reader :note attr_reader :note
def initialize(note) def initialize(note)
@note = note @note = note
end end
......
...@@ -4,6 +4,7 @@ module NotificationRecipients ...@@ -4,6 +4,7 @@ module NotificationRecipients
module Builder module Builder
class NewReview < Base class NewReview < Base
attr_reader :review attr_reader :review
def initialize(review) def initialize(review)
@review = review @review = review
end end
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
class NotificationService class NotificationService
class Async class Async
attr_reader :parent attr_reader :parent
delegate :respond_to_missing, to: :parent delegate :respond_to_missing, to: :parent
def initialize(parent) def initialize(parent)
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Projects module Projects
class BaseMoveRelationsService < BaseService class BaseMoveRelationsService < BaseService
attr_reader :source_project attr_reader :source_project
def execute(source_project, remove_remaining_elements: true) def execute(source_project, remove_remaining_elements: true)
return if source_project.blank? return if source_project.blank?
......
...@@ -11,6 +11,7 @@ module Projects ...@@ -11,6 +11,7 @@ module Projects
LARGE_FILE_SIZE = 1.megabytes LARGE_FILE_SIZE = 1.megabytes
attr_reader :lfs_download_object attr_reader :lfs_download_object
delegate :oid, :size, :credentials, :sanitized_url, :headers, to: :lfs_download_object, prefix: :lfs delegate :oid, :size, :credentials, :sanitized_url, :headers, to: :lfs_download_object, prefix: :lfs
def initialize(project, lfs_download_object) def initialize(project, lfs_download_object)
......
...@@ -34,6 +34,7 @@ end ...@@ -34,6 +34,7 @@ end
class Net::HTTP class Net::HTTP
attr_accessor :hostname_override attr_accessor :hostname_override
SSL_IVNAMES << :@hostname_override SSL_IVNAMES << :@hostname_override
SSL_ATTRIBUTES << :hostname_override SSL_ATTRIBUTES << :hostname_override
......
...@@ -37,6 +37,7 @@ module Security ...@@ -37,6 +37,7 @@ module Security
private private
attr_reader :pipeline, :params attr_reader :pipeline, :params
delegate :project, :has_security_findings?, to: :pipeline, private: true delegate :project, :has_security_findings?, to: :pipeline, private: true
def findings def findings
......
...@@ -22,6 +22,7 @@ module Ci ...@@ -22,6 +22,7 @@ module Ci
attr_reader :pipeline attr_reader :pipeline
attr_reader :runner_minutes attr_reader :runner_minutes
delegate :project, to: :pipeline delegate :project, to: :pipeline
def validate_build_matchers def validate_build_matchers
......
...@@ -34,6 +34,7 @@ module VulnerabilityExternalIssueLinks ...@@ -34,6 +34,7 @@ module VulnerabilityExternalIssueLinks
private private
attr_reader :user, :vulnerability, :link_type, :external_provider, :external_provider_service, :external_issue_link attr_reader :user, :vulnerability, :link_type, :external_provider, :external_provider_service, :external_issue_link
delegate :project, to: :vulnerability delegate :project, to: :vulnerability
def create_external_issue def create_external_issue
......
...@@ -7,6 +7,7 @@ module Gitlab ...@@ -7,6 +7,7 @@ module Gitlab
include ActiveModel::Model include ActiveModel::Model
attr_reader :xml_response, :identity attr_reader :xml_response, :identity
delegate :name_id, :name_id_format, :xml, to: :xml_response delegate :name_id, :name_id_format, :xml, to: :xml_response
validate :response_error_passthrough! validate :response_error_passthrough!
......
...@@ -63,6 +63,7 @@ module IncidentManagement ...@@ -63,6 +63,7 @@ module IncidentManagement
private private
attr_reader :rotation attr_reader :rotation
delegate :shift_cycle_duration, to: :rotation delegate :shift_cycle_duration, to: :rotation
# Starting time of a shift which covers the timestamp. # Starting time of a shift which covers the timestamp.
......
...@@ -12,6 +12,7 @@ module Gitlab ...@@ -12,6 +12,7 @@ module Gitlab
class InsufficientScopeError < AuthenticationError class InsufficientScopeError < AuthenticationError
attr_reader :scopes attr_reader :scopes
def initialize(scopes) def initialize(scopes)
@scopes = scopes.map { |s| s.try(:name) || s } @scopes = scopes.map { |s| s.try(:name) || s }
end end
......
...@@ -7,6 +7,7 @@ module Gitlab ...@@ -7,6 +7,7 @@ module Gitlab
module OAuth module OAuth
class AuthHash class AuthHash
attr_reader :auth_hash attr_reader :auth_hash
def initialize(auth_hash) def initialize(auth_hash)
@auth_hash = auth_hash @auth_hash = auth_hash
end end
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
module Checks module Checks
class BaseBulkChecker < BaseChecker class BaseBulkChecker < BaseChecker
attr_reader :changes_access attr_reader :changes_access
delegate(*ChangesAccess::ATTRIBUTES, to: :changes_access) delegate(*ChangesAccess::ATTRIBUTES, to: :changes_access)
def initialize(changes_access) def initialize(changes_access)
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
module Checks module Checks
class BaseSingleChecker < BaseChecker class BaseSingleChecker < BaseChecker
attr_reader :change_access attr_reader :change_access
delegate(*SingleChangeAccess::ATTRIBUTES, to: :change_access) delegate(*SingleChangeAccess::ATTRIBUTES, to: :change_access)
def initialize(change_access) def initialize(change_access)
......
...@@ -94,6 +94,7 @@ module Gitlab ...@@ -94,6 +94,7 @@ module Gitlab
private private
attr_reader :project, :destination, :started_at, :log_conditions attr_reader :project, :destination, :started_at, :log_conditions
delegate :current_monotonic_time, to: :class delegate :current_monotonic_time, to: :class
def age def age
......
...@@ -23,6 +23,7 @@ module Gitlab ...@@ -23,6 +23,7 @@ module Gitlab
private private
attr_reader :trace_artifact attr_reader :trace_artifact
delegate :aws?, :google?, to: :object_store_config, prefix: :provider delegate :aws?, :google?, to: :object_store_config, prefix: :provider
def fetch_md5_checksum def fetch_md5_checksum
......
...@@ -96,6 +96,7 @@ module Gitlab ...@@ -96,6 +96,7 @@ module Gitlab
attr_reader :instance_variables_builder attr_reader :instance_variables_builder
attr_reader :project_variables_builder attr_reader :project_variables_builder
attr_reader :group_variables_builder attr_reader :group_variables_builder
delegate :project, to: :pipeline delegate :project, to: :pipeline
def predefined_variables(job) def predefined_variables(job)
......
...@@ -12,6 +12,7 @@ module Gitlab ...@@ -12,6 +12,7 @@ module Gitlab
# Note that for very large tables, this may even timeout. # Note that for very large tables, this may even timeout.
class ExactCountStrategy class ExactCountStrategy
attr_reader :models attr_reader :models
def initialize(models) def initialize(models)
@models = models @models = models
end end
......
...@@ -14,6 +14,7 @@ module Gitlab ...@@ -14,6 +14,7 @@ module Gitlab
# however is guaranteed to be "fast", because it only looks up statistics. # however is guaranteed to be "fast", because it only looks up statistics.
class ReltuplesCountStrategy class ReltuplesCountStrategy
attr_reader :models attr_reader :models
def initialize(models) def initialize(models)
@models = models @models = models
end end
......
...@@ -46,6 +46,7 @@ module Gitlab ...@@ -46,6 +46,7 @@ module Gitlab
private private
attr_reader :model attr_reader :model
delegate :connection, to: :model delegate :connection, to: :model
def missing_partitions def missing_partitions
......
...@@ -31,6 +31,7 @@ module Gitlab ...@@ -31,6 +31,7 @@ module Gitlab
private private
attr_reader :connection attr_reader :connection
delegate :execute, :quote_table_name, :quote_column_name, to: :connection delegate :execute, :quote_table_name, :quote_column_name, to: :connection
def default_sequence(table, column) def default_sequence(table, column)
......
...@@ -8,6 +8,7 @@ module Gitlab ...@@ -8,6 +8,7 @@ module Gitlab
end end
attr_reader :raw_body attr_reader :raw_body
def initialize(raw_body) def initialize(raw_body)
@raw_body = raw_body @raw_body = raw_body
end end
......
...@@ -63,6 +63,7 @@ module Gitlab ...@@ -63,6 +63,7 @@ module Gitlab
class BlameLine class BlameLine
attr_accessor :lineno, :oldlineno, :commit, :line attr_accessor :lineno, :oldlineno, :commit, :line
def initialize(lineno, oldlineno, commit, line) def initialize(lineno, oldlineno, commit, line)
@lineno = lineno @lineno = lineno
@oldlineno = oldlineno @oldlineno = oldlineno
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
module Graphql module Graphql
class BatchKey class BatchKey
attr_reader :object attr_reader :object
delegate :hash, to: :object delegate :hash, to: :object
def initialize(object, lookahead = nil, object_name: nil) def initialize(object, lookahead = nil, object_name: nil)
......
...@@ -10,6 +10,7 @@ module Gitlab ...@@ -10,6 +10,7 @@ module Gitlab
# #
class InsecureKeyFingerprint class InsecureKeyFingerprint
attr_accessor :key attr_accessor :key
alias_attribute :fingerprint_md5, :fingerprint alias_attribute :fingerprint_md5, :fingerprint
# #
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
module Pagination module Pagination
class GitalyKeysetPager class GitalyKeysetPager
attr_reader :request_context, :project attr_reader :request_context, :project
delegate :params, to: :request_context delegate :params, to: :request_context
def initialize(request_context, project) def initialize(request_context, project)
......
...@@ -6,6 +6,7 @@ module Gitlab ...@@ -6,6 +6,7 @@ module Gitlab
class CursorBasedRequestContext class CursorBasedRequestContext
DEFAULT_SORT_DIRECTION = :desc DEFAULT_SORT_DIRECTION = :desc
attr_reader :request_context attr_reader :request_context
delegate :params, to: :request_context delegate :params, to: :request_context
def initialize(request_context) def initialize(request_context)
......
...@@ -5,6 +5,7 @@ module Gitlab ...@@ -5,6 +5,7 @@ module Gitlab
module Keyset module Keyset
class HeaderBuilder class HeaderBuilder
attr_reader :request_context attr_reader :request_context
delegate :params, :header, :request, to: :request_context delegate :params, :header, :request, to: :request_context
def initialize(request_context) def initialize(request_context)
......
...@@ -4,6 +4,7 @@ module Gitlab ...@@ -4,6 +4,7 @@ module Gitlab
module Pagination module Pagination
class OffsetPagination < Base class OffsetPagination < Base
attr_reader :request_context attr_reader :request_context
delegate :params, :header, :request, to: :request_context delegate :params, :header, :request, to: :request_context
def initialize(request_context) def initialize(request_context)
......
...@@ -5,6 +5,7 @@ module Gitlab ...@@ -5,6 +5,7 @@ module Gitlab
module Queries module Queries
class BaseQuery class BaseQuery
attr_accessor :client attr_accessor :client
delegate :query_range, :query, :label_values, :series, to: :client, prefix: true delegate :query_range, :query, :label_values, :series, to: :client, prefix: true
def raw_memory_usage_query(environment_slug) def raw_memory_usage_query(environment_slug)
......
...@@ -15,6 +15,7 @@ module Sidebars ...@@ -15,6 +15,7 @@ module Sidebars
include ::Sidebars::Concerns::HasPartial include ::Sidebars::Concerns::HasPartial
attr_reader :context attr_reader :context
delegate :current_user, :container, to: :@context delegate :current_user, :container, to: :@context
def initialize(context) def initialize(context)
......
...@@ -9,6 +9,7 @@ module QA ...@@ -9,6 +9,7 @@ module QA
extend Forwardable extend Forwardable
attr_reader :git_uri, :uri attr_reader :git_uri, :uri
def_delegators :@uri, :user, :host, :path def_delegators :@uri, :user, :host, :path
# See: config/initializers/1_settings.rb # See: config/initializers/1_settings.rb
......
...@@ -7,6 +7,7 @@ module QA ...@@ -7,6 +7,7 @@ module QA
module Specs module Specs
class Runner < Scenario::Template class Runner < Scenario::Template
attr_accessor :tty, :tags, :options attr_accessor :tty, :tags, :options
RegexMismatchError = Class.new(StandardError) RegexMismatchError = Class.new(StandardError)
DEFAULT_TEST_PATH_ARGS = ['--', File.expand_path('./features', __dir__)].freeze DEFAULT_TEST_PATH_ARGS = ['--', File.expand_path('./features', __dir__)].freeze
......
...@@ -501,6 +501,7 @@ RSpec.describe ApplicationController do ...@@ -501,6 +501,7 @@ RSpec.describe ApplicationController do
describe '#append_info_to_payload' do describe '#append_info_to_payload' do
controller(described_class) do controller(described_class) do
attr_reader :last_payload attr_reader :last_payload
urgency :high, [:foo] urgency :high, [:foo]
def index def index
......
...@@ -9,6 +9,7 @@ RSpec.describe Mentionable do ...@@ -9,6 +9,7 @@ RSpec.describe Mentionable do
include Mentionable include Mentionable
attr_accessor :project, :message attr_accessor :project, :message
attr_mentionable :message attr_mentionable :message
def author def author
......
...@@ -26,6 +26,7 @@ module SortingHelper ...@@ -26,6 +26,7 @@ module SortingHelper
include Comparable include Comparable
attr_reader :value attr_reader :value
delegate :==, :eql?, :hash, to: :value delegate :==, :eql?, :hash, to: :value
def initialize(value) def initialize(value)
......
...@@ -12,6 +12,7 @@ RSpec.describe ArrayMembersValidator do ...@@ -12,6 +12,7 @@ RSpec.describe ArrayMembersValidator do
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :children attr_accessor :children
validates :children, array_members: { member_class: child_class } validates :children, array_members: { member_class: child_class }
end end
end end
......
...@@ -10,6 +10,7 @@ RSpec.describe ColorValidator do ...@@ -10,6 +10,7 @@ RSpec.describe ColorValidator do
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :color attr_accessor :color
validates :color, color: true validates :color, color: true
end.new end.new
end end
......
...@@ -8,6 +8,7 @@ RSpec.describe CronValidator do ...@@ -8,6 +8,7 @@ RSpec.describe CronValidator do
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :cron attr_accessor :cron
validates :cron, cron: true validates :cron, cron: true
def cron_timezone def cron_timezone
...@@ -34,6 +35,7 @@ RSpec.describe CronValidator do ...@@ -34,6 +35,7 @@ RSpec.describe CronValidator do
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :cron_partytime attr_accessor :cron_partytime
validates :cron_partytime, cron: true validates :cron_partytime, cron: true
end.new end.new
end end
......
...@@ -8,6 +8,7 @@ RSpec.describe FutureDateValidator do ...@@ -8,6 +8,7 @@ RSpec.describe FutureDateValidator do
include ActiveModel::Model include ActiveModel::Model
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :expires_at attr_accessor :expires_at
validates :expires_at, future_date: true validates :expires_at, future_date: true
end.new end.new
end end
......
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