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
a4a13235
Commit
a4a13235
authored
Sep 02, 2021
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reuse already known flag_arg in Gitlab/MarkUsedFeatureFlags
parent
577be505
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
10 deletions
+8
-10
rubocop/cop/gitlab/mark_used_feature_flags.rb
rubocop/cop/gitlab/mark_used_feature_flags.rb
+8
-10
No files found.
rubocop/cop/gitlab/mark_used_feature_flags.rb
View file @
a4a13235
...
@@ -80,7 +80,7 @@ module RuboCop
...
@@ -80,7 +80,7 @@ module RuboCop
flag_value
=
flag_value
(
node
)
flag_value
=
flag_value
(
node
)
return
unless
flag_value
return
unless
flag_value
if
flag_arg_is_str_or_sym?
(
node
)
if
flag_arg_is_str_or_sym?
(
flag_arg
)
if
caller_is_feature_gitaly?
(
node
)
if
caller_is_feature_gitaly?
(
node
)
save_used_feature_flag
(
"gitaly_
#{
flag_value
}
"
)
save_used_feature_flag
(
"gitaly_
#{
flag_value
}
"
)
else
else
...
@@ -95,9 +95,9 @@ module RuboCop
...
@@ -95,9 +95,9 @@ module RuboCop
save_used_feature_flag
(
matching_feature_flag
)
save_used_feature_flag
(
matching_feature_flag
)
end
end
end
end
elsif
flag_arg_is_send_type?
(
node
)
elsif
flag_arg_is_send_type?
(
flag_arg
)
puts_if_ci
(
node
,
"Feature flag is dynamic: '
#{
flag_value
}
."
)
puts_if_ci
(
node
,
"Feature flag is dynamic: '
#{
flag_value
}
."
)
elsif
flag_arg_is_dstr_or_dsym?
(
node
)
elsif
flag_arg_is_dstr_or_dsym?
(
flag_arg
)
str_prefix
=
flag_arg
.
children
[
0
]
str_prefix
=
flag_arg
.
children
[
0
]
rest_children
=
flag_arg
.
children
[
1
..
]
rest_children
=
flag_arg
.
children
[
1
..
]
...
@@ -170,18 +170,16 @@ module RuboCop
...
@@ -170,18 +170,16 @@ module RuboCop
end
.
to_s
.
tr
(
"
\n
/"
,
' _'
)
end
.
to_s
.
tr
(
"
\n
/"
,
' _'
)
end
end
def
flag_arg_is_str_or_sym?
(
node
)
def
flag_arg_is_str_or_sym?
(
flag_arg
)
flag_arg
=
flag_arg
(
node
)
flag_arg
.
str_type?
||
flag_arg
.
sym_type?
flag_arg
.
str_type?
||
flag_arg
.
sym_type?
end
end
def
flag_arg_is_send_type?
(
node
)
def
flag_arg_is_send_type?
(
flag_arg
)
flag_arg
(
node
)
.
send_type?
flag_arg
.
send_type?
end
end
def
flag_arg_is_dstr_or_dsym?
(
node
)
def
flag_arg_is_dstr_or_dsym?
(
flag_arg
)
flag
=
flag_arg
(
node
)
(
flag_arg
.
dstr_type?
||
flag_arg
.
dsym_type?
)
&&
flag_arg
.
children
[
0
].
str_type?
(
flag
.
dstr_type?
||
flag
.
dsym_type?
)
&&
flag
.
children
[
0
].
str_type?
end
end
def
caller_is_feature?
(
node
)
def
caller_is_feature?
(
node
)
...
...
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