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
1f77121e
Commit
1f77121e
authored
Sep 28, 2021
by
Albert Salim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Merge branch '333844-automated-code-review-comments' into 'master'"
This reverts merge request !64313
parent
b3be4dfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
32 deletions
+5
-32
danger/specs/Dangerfile
danger/specs/Dangerfile
+5
-32
No files found.
danger/specs/Dangerfile
View file @
1f77121e
...
@@ -32,22 +32,11 @@ request specs (and/or feature specs). Please add request specs under
...
@@ -32,22 +32,11 @@ request specs (and/or feature specs). Please add request specs under
See https://gitlab.com/groups/gitlab-org/-/epics/5076 for information.
See https://gitlab.com/groups/gitlab-org/-/epics/5076 for information.
MSG
MSG
MATCH_WITH_ARRAY_REGEX
=
/(?<exp_word>match|eq)(?<rest>[( ]?\[)/
.
freeze
has_app_changes
=
helper
.
all_changed_files
.
grep
(
%r{
\A
(app|lib|db/(geo/)?(post_)?migrate)/}
).
any?
has_ee_app_changes
=
helper
.
all_changed_files
.
grep
(
%r{
\A
ee/(app|lib|db/(geo/)?(post_)?migrate)/}
).
any?
SUGGEST_MR_COMMENT
=
<<~
SUGGEST_COMMENT
spec_changes
=
helper
.
all_changed_files
.
grep
(
%r{
\A
spec/}
)
```suggestion
%<suggested_line>s
If order of the result is not important, please consider using `match_array` to avoid flakiness.
```
SUGGEST_COMMENT
all_changed_files
=
helper
.
all_changed_files
has_app_changes
=
all_changed_files
.
grep
(
%r{
\A
(app|lib|db/(geo/)?(post_)?migrate)/}
).
any?
has_ee_app_changes
=
all_changed_files
.
grep
(
%r{
\A
ee/(app|lib|db/(geo/)?(post_)?migrate)/}
).
any?
spec_changes
=
all_changed_files
.
grep
(
%r{
\A
spec/}
)
has_spec_changes
=
spec_changes
.
any?
has_spec_changes
=
spec_changes
.
any?
has_ee_spec_changes
=
all_changed_files
.
grep
(
%r{
\A
ee/spec/}
).
any?
has_ee_spec_changes
=
helper
.
all_changed_files
.
grep
(
%r{
\A
ee/spec/}
).
any?
new_specs_needed
=
(
gitlab
.
mr_labels
&
NO_SPECS_LABELS
).
empty?
new_specs_needed
=
(
gitlab
.
mr_labels
&
NO_SPECS_LABELS
).
empty?
if
(
has_app_changes
||
has_ee_app_changes
)
&&
!
(
has_spec_changes
||
has_ee_spec_changes
)
&&
new_specs_needed
if
(
has_app_changes
||
has_ee_app_changes
)
&&
!
(
has_spec_changes
||
has_ee_spec_changes
)
&&
new_specs_needed
...
@@ -60,22 +49,6 @@ if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_ch
...
@@ -60,22 +49,6 @@ if has_ee_app_changes && has_spec_changes && !(has_app_changes || has_ee_spec_ch
end
end
# Forbidding a new file addition under `/spec/controllers` or `/ee/spec/controllers`
# Forbidding a new file addition under `/spec/controllers` or `/ee/spec/controllers`
if
project_helper
.
changes
.
added
.
files
.
grep
(
%r{^(ee/)?spec/controllers/}
).
any?
if
git
.
added_
files
.
grep
(
%r{^(ee/)?spec/controllers/}
).
any?
warn
CONTROLLER_SPEC_DEPRECATION_MESSAGE
warn
CONTROLLER_SPEC_DEPRECATION_MESSAGE
end
end
def
check_for_match_with_array!
(
project_helper
.
changes
.
added
.
files
+
project_helper
.
changes
.
modified
.
files
+
project_helper
.
changes
.
renamed_after
.
files
).
grep
(
%r{
\A
(ee/)?spec/}
).
each
do
|
filename
|
added_lines
=
helper
.
changed_lines
(
filename
).
grep
(
/\A\+ /
)
next
unless
added_lines
.
any?
{
|
line
|
line
=~
MATCH_WITH_ARRAY_REGEX
}
spec_file_lines
=
File
.
read
(
filename
).
lines
(
chomp:
true
)
added_lines
.
each
do
|
added_line
|
mr_line
=
spec_file_lines
.
find_index
(
added_line
.
delete_prefix
(
'+'
))
markdown
(
format
(
SUGGEST_MR_COMMENT
,
suggested_line:
spec_file_lines
[
mr_line
].
gsub
(
MATCH_WITH_ARRAY_REGEX
,
'match_array\k<rest>'
)),
file:
filename
,
line:
mr_line
.
succ
)
end
end
end
check_for_match_with_array!
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