Exclude link-checker config from the packaged gem (STF-557)#190
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the gemspec to exclude configuration and lock files like .gitignore, lychee.toml, mise.lock, and mise.toml from the packaged gem. The reviewer suggested a best-practice improvement to use git ls-files instead of Dir['**/*'] to avoid packaging untracked local files.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| Gem::Specification.new do |s| | ||
| s.authors = ['William Storey'] | ||
| s.files = Dir['**/*'].difference(Dir['.github/**/*', 'dev-bin/**/*', 'test/**/*', 'CLAUDE.md', 'Gemfile*', 'Rakefile', '*.gemspec', 'README.dev.md']) | ||
| s.files = Dir['**/*'].difference(Dir['.github/**/*', '.gitignore', 'lychee.toml', 'mise.lock', 'mise.toml', 'dev-bin/**/*', 'test/**/*', 'CLAUDE.md', 'Gemfile*', 'Rakefile', '*.gemspec', 'README.dev.md']) |
There was a problem hiding this comment.
Using Dir['**/*'] to determine the files to package in the gem is risky because it will include any untracked local files, temporary test databases, or potentially sensitive credentials/configuration files present in the working directory when gem build is run.
Using git ls-files is the standard best practice for Ruby gems. It ensures only tracked files are packaged, while falling back to Dir['**/*'] if git is unavailable (e.g., when building from a source tarball).
s.files = begin
IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL, &:read).split("\x0")
rescue StandardError
Dir['**/*']
end.difference(Dir['.github/**/*', '.gitignore', 'lychee.toml', 'mise.lock', 'mise.toml', 'dev-bin/**/*', 'test/**/*', 'CLAUDE.md', 'Gemfile*', 'Rakefile', '*.gemspec', 'README.dev.md'])
91c2726 to
f653708
Compare
The gemspec packages Dir['**/*'] minus an exclusion list, which didn't cover the link-checking config added in this PR, so lychee.toml/mise.toml/mise.lock (and .gitignore) would ship in the published gem. Add them to the exclusion. Part of STF-557. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
f653708 to
4396ba3
Compare
Follow-up to the merged STF-557 PR: the gemspec packages
Dir['**/*']minus an exclusion list that didn't cover the link-checking config added in that PR, solychee.toml/mise.toml/mise.lock(and.gitignore) were shipping in the published gem. Add them to the exclusion list.This addresses @horgh's review note; the original STF-557 PR had already merged, so this is a separate PR.
Part of STF-557.
🤖 Generated with Claude Code