summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-07-10 14:46:38 -0700
committerGitHub <noreply@github.com>2020-07-10 14:46:38 -0700
commitc0b2391a2cb0be442971d597f9e2bda413f927d6 (patch)
treeb8be6f686177a2dc104a6531599fa37311876eb4
parenta36d0aabebfa51e14e6429e40baa9473d832cb3a (diff)
parent22c946bbfef24f64987a69f2fb2db468ce6bca6a (diff)
downloadchef-c0b2391a2cb0be442971d597f9e2bda413f927d6.tar.gz
Merge pull request #10142 from chef/fix-spellcheck-task
Fix spellcheck CI task
-rw-r--r--.expeditor/verify.pipeline.yml3
-rw-r--r--cspell.json6
-rw-r--r--tasks/spellcheck.rb20
3 files changed, 23 insertions, 6 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml
index 60142e9928..987980aa3a 100644
--- a/.expeditor/verify.pipeline.yml
+++ b/.expeditor/verify.pipeline.yml
@@ -573,9 +573,8 @@ steps:
- label: "Spellcheck"
commands:
- - ruby -rjson -e "JSON.parse(File.read('cspell.json'))" 2>/dev/null || (echo "Failed to parse config file 'cspell.json', skipping spellcheck" && exit 1)
- npm install -g cspell
- - cspell "**/*"
+ - rake -f tasks/spellcheck.rb spellcheck
soft_fail: true
expeditor:
executor:
diff --git a/cspell.json b/cspell.json
index ac59cb0e51..c900adbc84 100644
--- a/cspell.json
+++ b/cspell.json
@@ -634,6 +634,7 @@
"gettype",
"gids",
"Gilles",
+ "gitkeep",
"glibc",
"globalstate",
"globbing",
@@ -1605,6 +1606,7 @@
"rpmvercmp",
"rquery",
"rsakey",
+ "RSAT",
"rspec",
"rstrip",
"rsync",
@@ -1659,6 +1661,7 @@
"scutil",
"secedit",
"secoption",
+ "secopts",
"secp",
"securerandom",
"SECURITYPOLICY",
@@ -2175,7 +2178,8 @@
"zolo",
"zombiejs",
"Zuazo",
- "Zygmuntowicz"
+ "Zygmuntowicz",
+ "zypp"
],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
diff --git a/tasks/spellcheck.rb b/tasks/spellcheck.rb
index 002518d9ee..5b185c1ed6 100644
--- a/tasks/spellcheck.rb
+++ b/tasks/spellcheck.rb
@@ -17,17 +17,31 @@
namespace :spellcheck do
task :fetch_common do
- sh "wget https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt -O chef_dictionary.txt"
+ sh "wget -q https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt -O chef_dictionary.txt"
end
- task run: :fetch_common do
+ task run: [:config_check, :fetch_common] do
sh 'cspell "**/*"'
end
desc "List the unique unrecognized words in the project."
- task unknown_words: :fetch_common do
+ task unknown_words: [:config_check, :fetch_common] do
sh 'cspell "**/*" --wordsOnly --no-summary | sort | uniq'
end
+
+ task :config_check do
+ require 'json'
+
+ config_file = 'cspell.json'
+
+ unless File.readable?(config_file)
+ abort "Spellcheck config file '#{config_file}' not found, skipping spellcheck"
+ end
+
+ unless (JSON.parse(File.read(config_file)) rescue false)
+ abort "Failed to parse config file '#{config_file}', skipping spellcheck"
+ end
+ end
end
desc "Run spellcheck on the project."