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
89f0711b
Commit
89f0711b
authored
Nov 05, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only allow Ruby to have extra prepend line
parent
2833cc18
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
scripts/ee-specific-lines-check
scripts/ee-specific-lines-check
+9
-5
scripts/ee_specific_check/ee_specific_check.rb
scripts/ee_specific_check/ee_specific_check.rb
+1
-1
No files found.
scripts/ee-specific-lines-check
View file @
89f0711b
...
@@ -13,14 +13,18 @@ updated_numstat = updated_diff_numstat(base.ce_head, base.ee_head)
...
@@ -13,14 +13,18 @@ updated_numstat = updated_diff_numstat(base.ce_head, base.ee_head)
offenses
=
updated_numstat
.
select
do
|
file
,
updated_delta
|
offenses
=
updated_numstat
.
select
do
|
file
,
updated_delta
|
current_delta
=
current_numstat
[
file
]
current_delta
=
current_numstat
[
file
]
more_lines
=
more_lines
=
updated_delta
>
current_delta
current_delta
&&
updated_delta
>
current_delta
&&
allow_prepend_line
=
# Don't complain if we're just adding 1 or 2 more lines, which could be
# Don't complain if we're just adding 1 or 2 more lines, which could be
# `prepend EE::Module` and a blank line that we want.
# `prepend EE::Module` and a blank line that we want.
!
(
current_delta
==
0
&&
updated_delta
<=
2
)
!
(
current_delta
==
0
&&
updated_delta
<=
2
)
||
# We only allow Ruby files to have prepend line
!
file
.
end_with?
(
'.rb'
)
more_lines
&&
!
WHITELIST
.
any?
{
|
pattern
|
Dir
.
glob
(
pattern
).
include?
(
file
)
}
more_lines
&&
allow_prepend_line
&&
!
WHITELIST
.
any?
{
|
pattern
|
Dir
.
glob
(
pattern
).
include?
(
file
)
}
end
end
if
offenses
.
empty?
if
offenses
.
empty?
...
...
scripts/ee_specific_check/ee_specific_check.rb
View file @
89f0711b
...
@@ -278,7 +278,7 @@ module EESpecificCheck
...
@@ -278,7 +278,7 @@ module EESpecificCheck
def
scan_diff_numstat
(
numstat
)
def
scan_diff_numstat
(
numstat
)
numstat
.
scan
(
/(\d+)\s+(\d+)\s+(.+)/
)
numstat
.
scan
(
/(\d+)\s+(\d+)\s+(.+)/
)
.
each_with_object
(
{}
)
do
|
(
added
,
deleted
,
file
),
result
|
.
each_with_object
(
Hash
.
new
(
0
)
)
do
|
(
added
,
deleted
,
file
),
result
|
result
[
file
]
=
added
.
to_i
+
deleted
.
to_i
result
[
file
]
=
added
.
to_i
+
deleted
.
to_i
end
end
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