Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ThreadSafety::DirChdir rubocop issue #175

Merged

Conversation

viralpraxis
Copy link
Contributor

@viralpraxis viralpraxis commented Sep 17, 2024

I've recently implemented ThreadSafety::DirChdir cop (ref) to track Dir.chdir calls. While it's completely safe in gemspec, it can be fixed easily by adopting state-of-art gemspec template (ref)

Dir.chdir(File.expand_path(__dir__)) { %x(git ls-files -z lib).split("\x0") } == IO.popen(%w[git ls-files -z lib], chdir: __dir__, err: IO::NULL) { |ls| ls.readlines("\x0", chomp: true) }
=> true

Copy link
Owner

@sunny sunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion and the cop, although not an issue here I was not aware that Dir.chdir was not thread-safe.

I’ll have a look at rubocop-thread_safety!

service_actor.gemspec Outdated Show resolved Hide resolved
Co-authored-by: Sunny Ripert <[email protected]>
@sunny sunny merged commit 0ccf033 into sunny:main Sep 25, 2024
7 checks passed
sunny added a commit that referenced this pull request Sep 25, 2024
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.

2 participants