diff options
| author | Jarka Kadlecova <jarka@gitlab.com> | 2017-10-03 09:37:48 +0200 |
|---|---|---|
| committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-10-03 09:37:48 +0200 |
| commit | c488bcd13e6e0405d990608c8695ffabe17ffcae (patch) | |
| tree | 7c1e07081e8ccf88fef05a368a8c5bc4d87ceb55 /scripts | |
| parent | 59a6f15cd22621826116446d5f28753c973ba2d1 (diff) | |
| parent | bdc50ed779cb0c7d266c0f80f3e66a25da8b1964 (diff) | |
| download | gitlab-ce-c488bcd13e6e0405d990608c8695ffabe17ffcae.tar.gz | |
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into 18608-lock-issues-v2
# Conflicts:
# db/schema.rb
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/lint-changelog-yaml | 22 | ||||
| -rwxr-xr-x | scripts/lint-doc.sh | 18 | ||||
| -rwxr-xr-x | scripts/static-analysis | 3 |
3 files changed, 40 insertions, 3 deletions
diff --git a/scripts/lint-changelog-yaml b/scripts/lint-changelog-yaml new file mode 100755 index 00000000000..cce5f1c7667 --- /dev/null +++ b/scripts/lint-changelog-yaml @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby + +require 'yaml' + +invalid_changelogs = Dir['changelogs/**/*'].reject do |changelog| + next true if changelog =~ /(archive\.md|unreleased(-ee)?)$/ + next false unless changelog.end_with?('.yml') + + begin + YAML.load_file(changelog) + rescue + end +end + +if invalid_changelogs.any? + puts "Invalid changelogs found!\n" + puts invalid_changelogs.sort + exit 1 +else + puts "All changelogs are valid YAML.\n" + exit 0 +end diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 54c1ef3dfdd..e5242fee32b 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -3,15 +3,19 @@ cd "$(dirname "$0")/.." # Use long options (e.g. --header instead of -H) for curl examples in documentation. -grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/ +echo 'Checking for curl short options...' +grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/ >/dev/null 2>&1 if [ $? == 0 ] then - echo '✖ ERROR: Short options should not be used in documentation!' >&2 + echo '✖ ERROR: Short options for curl should not be used in documentation! + Use long options (e.g., --header instead of -H):' >&2 + grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/ exit 1 fi # Ensure that the CHANGELOG.md does not contain duplicate versions DUPLICATE_CHANGELOG_VERSIONS=$(grep --extended-regexp '^## .+' CHANGELOG.md | sed -E 's| \(.+\)||' | sort -r | uniq -d) +echo 'Checking for CHANGELOG.md duplicate entries...' if [ "${DUPLICATE_CHANGELOG_VERSIONS}" != "" ] then echo '✖ ERROR: Duplicate versions in CHANGELOG.md:' >&2 @@ -19,5 +23,15 @@ then exit 1 fi +# Make sure no files in doc/ are executable +EXEC_PERM_COUNT=$(find doc/ app/ -type f -perm 755 | wc -l) +echo 'Checking for executable permissions...' +if [ "${EXEC_PERM_COUNT}" -ne 0 ] +then + echo '✖ ERROR: Executable permissions should not be used in documentation! Use `chmod 644` to the files in question:' >&2 + find doc/ app/ -type f -perm 755 + exit 1 +fi + echo "✔ Linting passed" exit 0 diff --git a/scripts/static-analysis b/scripts/static-analysis index 295b6f132c1..aeefb2bc96f 100755 --- a/scripts/static-analysis +++ b/scripts/static-analysis @@ -13,7 +13,8 @@ tasks = [ %w[yarn run eslint], %w[bundle exec rubocop --require rubocop-rspec], %w[scripts/lint-conflicts.sh], - %w[bundle exec rake gettext:lint] + %w[bundle exec rake gettext:lint], + %w[scripts/lint-changelog-yaml] ] failed_tasks = tasks.reduce({}) do |failures, task| |
