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
62ae61ed
Commit
62ae61ed
authored
Feb 07, 2017
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI runs lint on shell scripts in lib/support
parent
8abdabdb
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 @
62ae61ed
...
@@ -243,6 +243,7 @@ rubocop:
...
@@ -243,6 +243,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 @
62ae61ed
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 @
62ae61ed
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