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
cb3ca8c6
Commit
cb3ca8c6
authored
Apr 28, 2020
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup section string extraction
parent
499d4435
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
ee/lib/gitlab/code_owners/file.rb
ee/lib/gitlab/code_owners/file.rb
+3
-3
ee/spec/lib/gitlab/code_owners/file_spec.rb
ee/spec/lib/gitlab/code_owners/file_spec.rb
+4
-4
No files found.
ee/lib/gitlab/code_owners/file.rb
View file @
cb3ca8c6
...
...
@@ -60,7 +60,7 @@ module Gitlab
def
get_parsed_sectional_data
parsed
=
{}
section
=
::
Gitlab
::
CodeOwners
::
Entry
::
DEFAULT_SECTION
.
downcase
section
=
::
Gitlab
::
CodeOwners
::
Entry
::
DEFAULT_SECTION
parsed
[
section
]
=
{}
...
...
@@ -70,13 +70,13 @@ module Gitlab
next
if
skip?
(
line
)
if
line
.
starts_with?
(
'['
)
&&
line
.
end_with?
(
']'
)
section
=
line
[
1
...-
1
].
downcase
section
=
line
[
1
...-
1
].
strip
parsed
[
section
]
||=
{}
next
end
extract_entry_and_populate_parsed
(
line
,
parsed
,
section
.
downcase
)
extract_entry_and_populate_parsed
(
line
,
parsed
,
section
)
end
parsed
...
...
ee/spec/lib/gitlab/code_owners/file_spec.rb
View file @
cb3ca8c6
...
...
@@ -52,7 +52,7 @@ describe Gitlab::CodeOwners::File do
data
=
file
.
parsed_data
expect
(
data
.
keys
.
length
).
to
eq
(
1
)
expect
(
data
.
keys
).
to
contain_exactly
(
::
Gitlab
::
CodeOwners
::
Entry
::
DEFAULT_SECTION
.
downcase
)
expect
(
data
.
keys
).
to
contain_exactly
(
::
Gitlab
::
CodeOwners
::
Entry
::
DEFAULT_SECTION
)
end
context
"when CODEOWNERS file contains multiple sections"
do
...
...
@@ -66,13 +66,13 @@ describe Gitlab::CodeOwners::File do
data
=
file
.
parsed_data
expect
(
data
.
keys
.
length
).
to
eq
(
3
)
expect
(
data
.
keys
).
to
contain_exactly
(
"codeowners"
,
"
documentation"
,
"d
atabase"
)
expect
(
data
.
keys
).
to
contain_exactly
(
"codeowners"
,
"
Documentation"
,
"D
atabase"
)
end
where
(
:section
,
:patterns
)
do
"codeowners"
|
[
"/**/ee/**/*"
]
"
d
ocumentation"
|
[
"/**/README.md"
,
"/**/ee/docs"
,
"/**/docs"
]
"
d
atabase"
|
[
"/**/README.md"
,
"/**/model/db"
]
"
D
ocumentation"
|
[
"/**/README.md"
,
"/**/ee/docs"
,
"/**/docs"
]
"
D
atabase"
|
[
"/**/README.md"
,
"/**/model/db"
]
end
with_them
do
...
...
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