Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
75551985
Commit
75551985
authored
Jun 19, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix todo offenses for Style/HashTransformValues
parent
e874bbb9
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
31 deletions
+16
-31
.rubocop_todo.yml
.rubocop_todo.yml
+0
-15
app/validators/addressable_url_validator.rb
app/validators/addressable_url_validator.rb
+3
-3
config/initializers/action_dispatch_journey_formatter.rb
config/initializers/action_dispatch_journey_formatter.rb
+2
-2
ee/app/services/packages/nuget/metadata_extraction_service.rb
...pp/services/packages/nuget/metadata_extraction_service.rb
+1
-2
lib/gitlab/config/entry/configurable.rb
lib/gitlab/config/entry/configurable.rb
+3
-1
lib/gitlab/config/entry/node.rb
lib/gitlab/config/entry/node.rb
+1
-1
lib/gitlab/discussions_diff/file_collection.rb
lib/gitlab/discussions_diff/file_collection.rb
+2
-2
lib/gitlab/error_tracking.rb
lib/gitlab/error_tracking.rb
+1
-2
lib/rspec_flaky/flaky_examples_collection.rb
lib/rspec_flaky/flaky_examples_collection.rb
+1
-1
spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb
...tabase_importers/common_metrics/prometheus_metric_spec.rb
+2
-2
No files found.
.rubocop_todo.yml
View file @
75551985
...
@@ -569,21 +569,6 @@ Style/HashTransformKeys:
...
@@ -569,21 +569,6 @@ Style/HashTransformKeys:
-
'
lib/banzai/filter/commit_trailers_filter.rb'
-
'
lib/banzai/filter/commit_trailers_filter.rb'
-
'
lib/gitlab/analytics/cycle_analytics/stage_events.rb'
-
'
lib/gitlab/analytics/cycle_analytics/stage_events.rb'
# Offense count: 10
# Cop supports --auto-correct.
Style/HashTransformValues
:
Exclude
:
-
'
app/validators/addressable_url_validator.rb'
-
'
config/initializers/action_dispatch_journey_formatter.rb'
-
'
ee/app/helpers/compliance_management/compliance_framework/project_settings_helper.rb'
-
'
ee/app/services/packages/nuget/metadata_extraction_service.rb'
-
'
lib/gitlab/config/entry/configurable.rb'
-
'
lib/gitlab/config/entry/node.rb'
-
'
lib/gitlab/discussions_diff/file_collection.rb'
-
'
lib/gitlab/error_tracking.rb'
-
'
lib/rspec_flaky/flaky_examples_collection.rb'
-
'
spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb'
# Offense count: 31
# Offense count: 31
# Configuration parameters: AllowIfModifier.
# Configuration parameters: AllowIfModifier.
Style/IfInsideElse
:
Style/IfInsideElse
:
...
...
app/validators/addressable_url_validator.rb
View file @
75551985
...
@@ -95,9 +95,9 @@ class AddressableUrlValidator < ActiveModel::EachValidator
...
@@ -95,9 +95,9 @@ class AddressableUrlValidator < ActiveModel::EachValidator
end
end
def
current_options
def
current_options
options
.
map
do
|
option
,
value
|
options
.
transform_values
do
|
value
|
[
option
,
value
.
is_a?
(
Proc
)
?
value
.
call
(
record
)
:
value
]
value
.
is_a?
(
Proc
)
?
value
.
call
(
record
)
:
value
end
.
to_h
end
end
end
def
blocker_args
def
blocker_args
...
...
config/initializers/action_dispatch_journey_formatter.rb
View file @
75551985
...
@@ -9,8 +9,8 @@ module ActionDispatch
...
@@ -9,8 +9,8 @@ module ActionDispatch
module
Path
module
Path
class
Pattern
class
Pattern
def
requirements_for_missing_keys_check
def
requirements_for_missing_keys_check
@requirements_for_missing_keys_check
||=
requirements
.
each_with_object
({})
do
|
(
key
,
regex
),
hash
|
@requirements_for_missing_keys_check
||=
requirements
.
transform_values
do
|
regex
|
hash
[
key
]
=
/\A
#{
regex
}
\Z/
/\A
#{
regex
}
\Z/
end
end
end
end
end
end
...
...
ee/app/services/packages/nuget/metadata_extraction_service.rb
View file @
75551985
...
@@ -48,8 +48,7 @@ module Packages
...
@@ -48,8 +48,7 @@ module Packages
def
extract_metadata
(
file
)
def
extract_metadata
(
file
)
doc
=
Nokogiri
::
XML
(
file
)
doc
=
Nokogiri
::
XML
(
file
)
XPATHS
.
map
{
|
key
,
query
|
[
key
,
doc
.
xpath
(
query
).
text
.
presence
]
}
XPATHS
.
transform_values
{
|
query
|
doc
.
xpath
(
query
).
text
.
presence
}
.
to_h
.
compact
.
compact
.
tap
do
|
metadata
|
.
tap
do
|
metadata
|
metadata
[
:package_dependencies
]
=
extract_dependencies
(
doc
)
metadata
[
:package_dependencies
]
=
extract_dependencies
(
doc
)
...
...
lib/gitlab/config/entry/configurable.rb
View file @
75551985
...
@@ -62,7 +62,9 @@ module Gitlab
...
@@ -62,7 +62,9 @@ module Gitlab
class_methods
do
class_methods
do
def
nodes
def
nodes
Hash
[(
@nodes
||
{}).
map
{
|
key
,
factory
|
[
key
,
factory
.
dup
]
}]
return
{}
unless
@nodes
@nodes
.
transform_values
(
&
:dup
)
end
end
def
reserved_node_names
def
reserved_node_names
...
...
lib/gitlab/config/entry/node.rb
View file @
75551985
...
@@ -68,7 +68,7 @@ module Gitlab
...
@@ -68,7 +68,7 @@ module Gitlab
value
.
specified?
&&
value
.
relevant?
value
.
specified?
&&
value
.
relevant?
end
end
Hash
[
meaningful
.
map
{
|
key
,
entry
|
[
key
,
entry
.
value
]
}]
meaningful
.
transform_values
{
|
entry
|
entry
.
value
}
end
end
end
end
...
...
lib/gitlab/discussions_diff/file_collection.rb
View file @
75551985
...
@@ -70,8 +70,8 @@ module Gitlab
...
@@ -70,8 +70,8 @@ module Gitlab
#
#
# Returns a Hash with { id => [Array of Gitlab::Diff::line], ...]
# Returns a Hash with { id => [Array of Gitlab::Diff::line], ...]
def
highlighted_lines_by_ids
(
ids
)
def
highlighted_lines_by_ids
(
ids
)
diff_files_indexed_by_id
.
slice
(
*
ids
).
each_with_object
({})
do
|
(
id
,
file
),
hash
|
diff_files_indexed_by_id
.
slice
(
*
ids
).
transform_values
do
|
file
|
hash
[
id
]
=
file
.
highlighted_diff_lines
.
map
(
&
:to_hash
)
file
.
highlighted_diff_lines
.
map
(
&
:to_hash
)
end
end
end
end
end
end
...
...
lib/gitlab/error_tracking.rb
View file @
75551985
...
@@ -173,8 +173,7 @@ module Gitlab
...
@@ -173,8 +173,7 @@ module Gitlab
.
connection
.
connection
.
schema_cache
.
schema_cache
.
instance_variable_get
(
:@columns_hash
)
.
instance_variable_get
(
:@columns_hash
)
.
map
{
|
k
,
v
|
[
k
,
v
.
map
(
&
:first
)]
}
.
transform_values
{
|
v
|
v
.
map
(
&
:first
)
}
.
to_h
event
.
extra
.
merge!
(
columns_hash
)
event
.
extra
.
merge!
(
columns_hash
)
end
end
...
...
lib/rspec_flaky/flaky_examples_collection.rb
View file @
75551985
...
@@ -23,7 +23,7 @@ module RspecFlaky
...
@@ -23,7 +23,7 @@ module RspecFlaky
end
end
def
to_h
def
to_h
Hash
[
map
{
|
uid
,
example
|
[
uid
,
example
.
to_h
]
}]
.
deep_symbolize_keys
transform_values
{
|
example
|
example
.
to_h
}
.
deep_symbolize_keys
end
end
def
-
(
other
)
def
-
(
other
)
...
...
spec/lib/gitlab/database_importers/common_metrics/prometheus_metric_spec.rb
View file @
75551985
...
@@ -8,8 +8,8 @@ describe Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric do
...
@@ -8,8 +8,8 @@ describe Gitlab::DatabaseImporters::CommonMetrics::PrometheusMetric do
end
end
it
'.group_titles equals ::PrometheusMetric'
do
it
'.group_titles equals ::PrometheusMetric'
do
existing_group_titles
=
::
PrometheusMetricEnums
.
group_details
.
each_with_object
({})
do
|
(
key
,
value
),
memo
|
existing_group_titles
=
::
PrometheusMetricEnums
.
group_details
.
transform_values
do
|
value
|
memo
[
key
]
=
value
[
:group_title
]
value
[
:group_title
]
end
end
expect
(
Gitlab
::
DatabaseImporters
::
CommonMetrics
::
PrometheusMetricEnums
.
group_titles
).
to
eq
(
existing_group_titles
)
expect
(
Gitlab
::
DatabaseImporters
::
CommonMetrics
::
PrometheusMetricEnums
.
group_titles
).
to
eq
(
existing_group_titles
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment