Skip to content

Fix low-severity bugs, stale docs, and repo housekeeping - #143

Open
tas50 wants to merge 1 commit into
chef:mainfrom
tas50:fix-low-severity-issues
Open

tas50 wants to merge 1 commit into
chef:mainfrom
tas50:fix-low-severity-issues

Conversation

@tas50

@tas50 tas50 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

A batch of small fixes found while reviewing the project.

Library

  • List/hash methods without a block — apple with no block raised NoMethodError: undefined method 'arity' for nil. It now raises ArgumentError: apple requires a block to configure the new apple.
  • Case-insensitive extensions — from_file("config.YML") evaluated the YAML as Ruby. Extensions are now matched case-insensitively.
  • File.read instead of IO.read — on Ruby 3.x, IO.read runs a shell command when the filename starts with | (for example "|cmd #.yml"). Ruby 4.0 removed this, but the gem still supports 3.1.
  • respond_to_missing? — respond_to?(:foo) now returns true for a value set without a configurable, matching what method_missing handles. It stays false for keys that were never set, so duck-typing checks such as to_ary are unaffected.
  • Documented default caching — reading an option with a static default stores a copy of that default, so mutable defaults can be modified in place. Afterwards the option appears in save even though it still holds its default. The save doc now says so.
  • Dead code and stale comments — removed the unused private to_dotted_hash, replaced writes_with() with config_attr_writer() in the strict mode docs, fixed the save example (Mixlib::Config is a module you extend, not a class to inherit from), reworded the stale "remove this in 3.0" note on hash_dup, and fixed a truncated sentence and a typo.

Specs

  • Replaced the deprecated expect(lambda { ... }) form with expect { ... }. The suite printed 15 deprecation warnings before this change and prints none now.
  • Specs now stub File.read. Removed stubs of File.exists? (removed in Ruby 3.2) and File.readable?, which from_file never calls.

Repo

  • rake style now fails when cookstyle is missing. It used to print a message and exit 0.
  • lint.yml: removed a dictionary download nothing used (cspell loads the dictionary from its URL) and a BUNDLE_WITHOUT naming groups that don't exist in this Gemfile.
  • Restored the bug report template's emoji, which had been saved as U+FFFD replacement characters.
  • CONTRIBUTING.md now links chef/chef's main branch.
  • .gitignore no longer ignores the tracked .rspec file, and a duplicate .yardoc entry is gone.
  • Fixed typos in the Rakefile and the Expeditor scripts.
  • Added vkey and yardopts to the cspell word list. Spellcheck only checks changed files, and both words were already present in files this PR touches.

Merge notes

This PR edits some of the same lines as #140 (the list/hash accessor methods) and #142 (from_yaml/from_json). Whichever merges second will need a small rebase.

Tests

Added specs for the no-block errors, the uppercase extension, and respond_to?. The updated File.read stubs failed against IO.read. The full suite passes (161 examples) with no deprecation warnings, and cookstyle and cspell are clean.

Library:
- Raise a clear ArgumentError when a config_context_list or
  config_context_hash singular method is called without a block,
  instead of NoMethodError on nil
- Match config file extensions case-insensitively, so config.YML is
  parsed as YAML rather than evaluated as Ruby
- Read config files with File.read instead of IO.read, which runs a
  command for a filename starting with "|" on Ruby 3.x
- Add respond_to_missing? for values set without a configurable
- Document that reading a static default stores it, so it appears in
  save
- Remove the unused private to_dotted_hash method
- Fix doc comments: writes_with() -> config_attr_writer(), the save
  example's class syntax, the stale hash_dup removal note, and typos

Specs:
- Replace the deprecated implicit block expectation syntax
  (expect(lambda { ... })) with expect { ... }
- Stub File.read, and drop stubs of File.exists? (removed in Ruby 3.2)
  and File.readable?, which from_file never calls

Repo:
- Make the style rake task fail when cookstyle is not installed
- Remove an unused dictionary download and nonexistent bundler groups
  from the lint workflow
- Restore the bug report template's emoji
- Point CONTRIBUTING.md at chef/chef's main branch
- Stop ignoring the tracked .rspec file and drop a duplicate .yardoc
  entry in .gitignore
- Fix typos in the Rakefile and Expeditor scripts

Signed-off-by: Tim Smith <tsmith84@proton.me>
@tas50
tas50 force-pushed the fix-low-severity-issues branch from 86ab4cd to 22a8f2e Compare September 28, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant