Skip to content

Commit

Permalink
chore: Use the chef_dictionary directly. (chef#13467)
Browse files Browse the repository at this point in the history
`cspell` and `cspell-action` now support fetching remote dictionaries.

Note: the file format `version` is now "0.2".

Signed-off-by: Jason Dent <[email protected]>
  • Loading branch information
Jason3S authored Feb 28, 2023
1 parent 35af355 commit 4f0c312
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 31 deletions.
13 changes: 5 additions & 8 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// cSpell Settings
{
// Version of the setting file. Always 0.1
"version": "0.1",
"version": "0.2",
// language - current active spelling language
"language": "en",
"dictionaryDefinitions": [
{
"name": "chef",
"file": "./chef_dictionary.txt",
"description": "Custom Chef Dictionary"
"name": "chef",
"path": "https://raw.githubusercontent.com/chef/chef_dictionary/main/chef.txt",
"description": "Custom Chef Dictionary"
}
],
"dictionaries": ["chef"],
Expand Down Expand Up @@ -1556,9 +1555,7 @@
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
"flagWords": [
"hte"
],
"flagWords": ["hte"],
"ignorePaths": [
"CHEF_MVPS.md",
"CHANGELOG.md",
Expand Down
24 changes: 1 addition & 23 deletions tasks/spellcheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,11 @@
sh 'cspell lint --no-progress "**/*"'
end

task prereqs: %i{curl_check cspell_check config_check fetch_common}

task :curl_check do
curl_version = begin
`curl --version`
rescue
nil
end

curl_version.is_a?(String) || abort(<<~INSTALL_CURL)
curl is not available, cannot download chef_dictionary.txt
INSTALL_CURL
end

task :fetch_common do
sh "curl -s https://raw.githubusercontent.com/chef/chef_dictionary/main/chef.txt -o chef_dictionary.txt"
end
task prereqs: %i{cspell_check config_check}

task :config_check do
require "json"

chef_dictionary = "chef_dictionary.txt"

unless File.readable?(chef_dictionary)
abort "Dictionary file '#{chef_dictionary}' not found, skipping spellcheck"
end

config_file = "cspell.json"

unless File.readable?(config_file)
Expand Down

0 comments on commit 4f0c312

Please sign in to comment.