diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-02-08 03:14:02 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-02-08 03:14:02 +0000 |
commit | bbb7fbcd02c9d9a8a6d6ca44d7ce668b80962c21 (patch) | |
tree | 7e878e73c37c93703ddbd14d7cd1dcd83836c380 /lib | |
parent | 980ffa201e1bc3171faf08705cd5d2078483b63f (diff) | |
parent | 62ae61ed96005c42d3de597a0c8b17f233e46f2e (diff) | |
download | gitlab-ce-bbb7fbcd02c9d9a8a6d6ca44d7ce668b80962c21.tar.gz |
Merge branch 'jej-lint-scripts-and-config' into 'master'dz-nested-groups-docs
Syntax linting for init scripts
Closes #27787
See merge request !9054
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tasks/config_lint.rake | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/tasks/config_lint.rake b/lib/tasks/config_lint.rake new file mode 100644 index 00000000000..ddbcf1e1eb8 --- /dev/null +++ b/lib/tasks/config_lint.rake @@ -0,0 +1,25 @@ +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 |