Skip to content

Commit

Permalink
Fix yaml load error for ruby 3.1 (#220)
Browse files Browse the repository at this point in the history
* Fix yaml load error for ruby 3.1
* update ruby versions
* fix rspec mocks for hash with keywords in ruby 3.0+
* add simplecov to ignore word list
---------

Signed-off-by: Corey Hemminger <[email protected]>
Signed-off-by: Vikram Karve <[email protected]>
Co-authored-by: Vikram Karve <[email protected]>
  • Loading branch information
Stromweld and vkarve-chef authored Apr 25, 2023
1 parent 80d7206 commit b0f946a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 23 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,34 @@ jobs:
env:
BUNDLE_WITHOUT: ruby_shadow:omnibus_package
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.1
bundler-cache: true
- uses: r7kamura/rubocop-problem-matchers-action@v1 # this shows the failures in the PR
- run: bundle exec chefstyle

spellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: carlosperate/download-file-action@v1.0.3
- uses: actions/checkout@v3
- uses: carlosperate/download-file-action@v2.0.0
id: download-custom-dictionary
with:
file-url: 'https://raw.githubusercontent.com/chef/chef_dictionary/main/chef.txt'
file-name: 'chef_dictionary.txt'
- uses: zwaldowski/cspell-action@v1
with:
config: cspell.json
paths: "**/*"
- uses: streetsidesoftware/[email protected]

coverage-test:
name: Coverage
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up ruby 2.7
- uses: actions/checkout@v3
- name: Set up ruby 3.1
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.1
bundler-cache: true
- name: run specs
run: bundle exec rake spec --trace
Expand All @@ -52,4 +49,4 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
failedThreshold: 90
resultPath: coverage/.last_run.json
resultPath: coverage/.last_run.json
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.5
0.9.5
16 changes: 11 additions & 5 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// 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 @@ -54,7 +54,13 @@
"Alnum",
"succ",
"proto",
"installp"
"installp",
"Qube",
"objc",
"kamura",
"carlosperate",
"Simplecov",
"simplecov"
],
// flagWords - list of words to be always considered incorrect
// This is useful for offensive words and common spelling errors.
Expand Down
2 changes: 1 addition & 1 deletion lib/chef_apply/text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def self._error_table
# error metadata.
path = File.join(_translation_path, "errors", "en.yml")
raw_yaml = File.read(path)
@error_table ||= YAML.load(raw_yaml, _translation_path, symbolize_names: true)[:errors]
@error_table ||= YAML.load(raw_yaml, filename: _translation_path, symbolize_names: true)[:errors]
end

def self._translation_path
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@
it "gets an action via GenerateTempCookbook.from_options and executes it " do
expect(ChefApply::Action::GenerateTempCookbook)
.to receive(:from_options)
.with(resource_type: "user",
resource_name: "test", resource_properties: {})
.with({ resource_type: "user",
resource_name: "test", resource_properties: {} })
.and_return(action)
expect(action).to receive(:run)
expect(subject.generate_temp_cookbook(%w{user test}, nil)).to eq temp_cookbook
Expand All @@ -237,7 +237,7 @@
it "gets an action via GenerateTempCookbook.from_options and executes it" do
expect(ChefApply::Action::GenerateTempCookbook)
.to receive(:from_options)
.with(recipe_spec: "mycookbook::default", cookbook_repo_paths: "/tmp")
.with({ recipe_spec: "mycookbook::default", cookbook_repo_paths: "/tmp" })
.and_return(action)
expect(action).to receive(:run)
subject.generate_temp_cookbook(["mycookbook::default"], nil)
Expand Down

0 comments on commit b0f946a

Please sign in to comment.