Commit a6fd5753 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'self-assign-cop' into 'master'

Fix Style/SelfAssignment cop

See merge request gitlab-org/gitlab!41079
parents 62e6bb3d 349949b1
...@@ -818,14 +818,6 @@ Style/RescueModifier: ...@@ -818,14 +818,6 @@ Style/RescueModifier:
Style/RescueStandardError: Style/RescueStandardError:
Enabled: false Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
Style/SelfAssignment:
Exclude:
- 'app/models/concerns/bulk_member_access_load.rb'
- 'app/serializers/base_serializer.rb'
- 'spec/support/import_export/configuration_helper.rb'
# Offense count: 50 # Offense count: 50
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: AllowIfMethodIsEmpty. # Configuration parameters: AllowIfMethodIsEmpty.
......
...@@ -22,7 +22,7 @@ module BulkMemberAccessLoad ...@@ -22,7 +22,7 @@ module BulkMemberAccessLoad
end end
# Look up only the IDs we need # Look up only the IDs we need
resource_ids = resource_ids - access.keys resource_ids -= access.keys
return access if resource_ids.empty? return access if resource_ids.empty?
......
...@@ -9,7 +9,7 @@ class BaseSerializer ...@@ -9,7 +9,7 @@ class BaseSerializer
end end
def represent(resource, opts = {}, entity_class = nil) def represent(resource, opts = {}, entity_class = nil)
entity_class = entity_class || self.class.entity_class entity_class ||= self.class.entity_class
entity_class entity_class
.represent(resource, opts.merge(request: @request)) .represent(resource, opts.merge(request: @request))
......
---
title: Fix Style/SelfAssignment cop
merge_request: 41079
author: Rajendra Kadam
type: fixed
...@@ -44,8 +44,8 @@ module ConfigurationHelper ...@@ -44,8 +44,8 @@ module ConfigurationHelper
import_export_config = config_hash(config) import_export_config = config_hash(config)
excluded_attributes = import_export_config[:excluded_attributes][relation_name.to_sym] excluded_attributes = import_export_config[:excluded_attributes][relation_name.to_sym]
included_attributes = import_export_config[:included_attributes][relation_name.to_sym] included_attributes = import_export_config[:included_attributes][relation_name.to_sym]
attributes = attributes - Gitlab::Json.parse(excluded_attributes.to_json) if excluded_attributes attributes -= Gitlab::Json.parse(excluded_attributes.to_json) if excluded_attributes
attributes = attributes & Gitlab::Json.parse(included_attributes.to_json) if included_attributes attributes &= Gitlab::Json.parse(included_attributes.to_json) if included_attributes
attributes attributes
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