Class: RuboCop::Cop::DiscourseCops::NoChdir
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::DiscourseCops::NoChdir
- Defined in:
- lib/rubocop/cop/discourse_cops.rb
Overview
Avoid using chdir - it is not thread safe.
Instead, you may be able to use: Discourse::Utils.execute_command(chdir: ‘test’) do |runner|
runner.exec('pwd')
end
Constant Summary collapse
- MSG =
'Chdir is not thread safe.'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
27 28 29 30 |
# File 'lib/rubocop/cop/discourse_cops.rb', line 27 def on_send(node) return if !(using_dir_chdir?(node) || using_fileutils_cd?(node)) add_offense(node, message: MSG) end |