diff options
author | Pete Higgins <pete@peterhiggins.org> | 2020-08-04 13:38:08 -0700 |
---|---|---|
committer | Pete Higgins <pete@peterhiggins.org> | 2020-08-05 11:44:44 -0700 |
commit | cfbcf978ba4cb6247ec41518023c2cd0e972aed8 (patch) | |
tree | 1dfaa425db3377bfe3a7a5a0b3b1e6b20a4e8ef8 | |
parent | 229755a0f5a3da36799a73b6fb764bc7e02579a2 (diff) | |
download | chef-cfbcf978ba4cb6247ec41518023c2cd0e972aed8.tar.gz |
Update spellcheck config with nice stuff from other repos.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r-- | tasks/spellcheck.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/tasks/spellcheck.rb b/tasks/spellcheck.rb index 076173fa1d..a5c775eb83 100644 --- a/tasks/spellcheck.rb +++ b/tasks/spellcheck.rb @@ -16,19 +16,21 @@ # namespace :spellcheck do - task :fetch_common do - sh "wget -q https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt -O chef_dictionary.txt" - end - - task run: %i{config_check fetch_common} do + task run: :prereqs do sh 'cspell "**/*"' end desc "List the unique unrecognized words in the project." - task unknown_words: %i{config_check fetch_common} do + task unknown_words: :prereqs do sh 'cspell "**/*" --wordsOnly --no-summary | sort | uniq' end + task prereqs: %i{cspell_check config_check fetch_common} + + task :fetch_common do + sh "wget -q https://raw.githubusercontent.com/chef/chef_dictionary/master/chef.txt -O chef_dictionary.txt" + end + task :config_check do require "json" @@ -42,6 +44,14 @@ namespace :spellcheck do abort "Failed to parse config file '#{config_file}', skipping spellcheck" end end + + task :cspell_check do + require 'chef-utils' + ChefUtils.which('cspell') || abort(<<~INSTALL_CSPELL) + cspell is needed to run the spellcheck tasks. Run `npm install -g cspell` to install. + For more information: https://www.npmjs.com/package/cspell + INSTALL_CSPELL + end end desc "Run spellcheck on the project." |