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
11e62405
Commit
11e62405
authored
Feb 08, 2017
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'ce/master' into rc/ce-to-ee-wednesday
parents
40e3494d
bbb7fbcd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
0 deletions
+53
-0
.gitlab-ci.yml
.gitlab-ci.yml
+1
-0
lib/tasks/config_lint.rake
lib/tasks/config_lint.rake
+25
-0
spec/tasks/config_lint_spec.rb
spec/tasks/config_lint_spec.rb
+27
-0
No files found.
.gitlab-ci.yml
View file @
11e62405
...
@@ -245,6 +245,7 @@ rubocop:
...
@@ -245,6 +245,7 @@ rubocop:
rake haml_lint
:
*exec
rake haml_lint
:
*exec
rake scss_lint
:
*exec
rake scss_lint
:
*exec
rake config_lint
:
*exec
rake brakeman
:
*exec
rake brakeman
:
*exec
rake flay
:
*exec
rake flay
:
*exec
license_finder
:
*exec
license_finder
:
*exec
...
...
lib/tasks/config_lint.rake
0 → 100644
View file @
11e62405
module
ConfigLint
def
self
.
run
(
files
)
failures
=
files
.
reject
do
|
file
|
yield
(
file
)
end
if
failures
.
present?
puts
failures
exit
failures
.
count
end
end
end
desc
"Checks syntax for shell scripts and nginx config files in 'lib/support/'"
task
:config_lint
do
shell_scripts
=
[
'lib/support/init.d/gitlab'
,
'lib/support/init.d/gitlab.default.example'
,
'lib/support/deploy/deploy.sh'
]
ConfigLint
.
run
(
shell_scripts
)
do
|
file
|
Kernel
.
system
(
'bash'
,
'-n'
,
file
)
end
end
spec/tasks/config_lint_spec.rb
0 → 100644
View file @
11e62405
require
'rake_helper'
Rake
.
application
.
rake_require
'tasks/config_lint'
describe
ConfigLint
do
let
(
:files
){
[
'lib/support/fake.sh'
]
}
it
'errors out if any bash scripts have errors'
do
expect
{
ConfigLint
.
run
(
files
){
system
(
'exit 1'
)
}
}.
to
raise_error
(
SystemExit
)
end
it
'passes if all scripts are fine'
do
expect
{
ConfigLint
.
run
(
files
){
system
(
'exit 0'
)
}
}.
not_to
raise_error
end
end
describe
'config_lint rake task'
do
before
(
:each
)
do
# Prevent `system` from actually being called
allow
(
Kernel
).
to
receive
(
:system
).
and_return
(
true
)
end
it
'runs lint on shell scripts'
do
expect
(
Kernel
).
to
receive
(
:system
).
with
(
'bash'
,
'-n'
,
'lib/support/init.d/gitlab'
)
run_rake_task
(
'config_lint'
)
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