Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-09-27 11:52:03 +0300
committerSean McGivern <sean@gitlab.com>2017-09-27 11:52:03 +0300
commit3fba557d5c310e1fc4e6866a6a342c40331b3ad2 (patch)
tree093dfbe25bb23d27ae2ae8ad3487e90ee3fca368 /scripts/lint-changelog-yaml
parent05d8e87dba4abaf9eb495bac147c4d4c5426da2e (diff)
Add static analysis job to find invalid YAML in changelogs
When a changelog has invalid YAML (typically, there is an unquoted @ at the start of the author field), then the entry will be discarded. This script checks all unreleased changelogs for validity, and runs as part of the static-analysis step, so the pipeline will fail if this happens in future.
Diffstat (limited to 'scripts/lint-changelog-yaml')
-rwxr-xr-xscripts/lint-changelog-yaml19
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/lint-changelog-yaml b/scripts/lint-changelog-yaml
new file mode 100755
index 00000000000..402a0c42bd3
--- /dev/null
+++ b/scripts/lint-changelog-yaml
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+
+require 'yaml'
+
+invalid_changelogs = Dir['changelogs/**/*.yml'].reject do |changelog|
+ begin
+ YAML.load_file(changelog)
+ rescue
+ end
+end
+
+if invalid_changelogs.any?
+ puts "Changelogs with invalid YAML found!\n"
+ puts invalid_changelogs.sort
+ exit 1
+else
+ puts "All changelogs are valid YAML.\n"
+ exit 0
+end