summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-08-05 18:47:55 -0700
committerGitHub <noreply@github.com>2020-08-05 18:47:55 -0700
commit390f6ce9f21e3fac52d6a91b42c847639efbc7a8 (patch)
tree632e61518618bff0024a561ab0ef75301d3789f1
parentf7c7f0a87ceedbb81702a741cd08dec025bd5891 (diff)
parentd0e5a03a7aa8f3e39a530119fdca3c598c15cd2c (diff)
downloadchef-390f6ce9f21e3fac52d6a91b42c847639efbc7a8.tar.gz
Merge pull request #10261 from chef/update-spellcheck-setup
Update spellcheck config with nice stuff from other repos.
-rw-r--r--tasks/spellcheck.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/tasks/spellcheck.rb b/tasks/spellcheck.rb
index 076173fa1d..7a3478c272 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 "bundler"
+ Bundler.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."