Skip to main content

FileMode

All Cookstyle Cops


The department is: Chef/Style

The full name of the cop is: Chef/Style/FileMode


Enabled by defaultSupports autocorrectionTarget Chef Version
EnabledYesAll Versions

Use strings to represent file modes to avoid confusion between octal and base 10 integer formats.

Examples

incorrect

remote_directory '/etc/my.conf' do
  content 'some content'
  mode 0600
  action :create
end

remote_directory 'handler' do
  source 'handlers'
  recursive true
  files_mode 644
  action :create
end

correct

remote_directory '/etc/my.conf' do
  content 'some content'
  mode '600'
  action :create
end

remote_directory 'handler' do
  source 'handlers'
  recursive true
  files_mode '644'
  action :create
end

Configurable attributes

NameDefault valueConfigurable values
Version Added5.0.0String
Exclude
  • **/attributes/*
  • **/metadata.rb
  • **/Berksfile
Array

Was this page helpful?