diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-07-28 10:14:50 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-07-28 10:14:50 -0700 |
commit | f114d09c8d96d2ccdfcd7465b462a3a19d9d6478 (patch) | |
tree | 0a44a8489b3c045d79ef5e6ccacf53d9390d22b5 /tasks/spellcheck.rb | |
parent | 5a1bce1ca8bf3310f14632c28ed0f0e9b04ec2f9 (diff) | |
download | ohai-f114d09c8d96d2ccdfcd7465b462a3a19d9d6478.tar.gz |
Spelling fixesspelling
Pull in the latest rake task, fix some variable names, fix a few legit typos.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'tasks/spellcheck.rb')
-rw-r--r-- | tasks/spellcheck.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tasks/spellcheck.rb b/tasks/spellcheck.rb index 002518d9..076173fa 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: %i{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: %i{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." |