Question

I configured a Jenkins job to run foodcritic's analysis as was recomended by official site. When i run this job, all results was presented as follow:

foodcritic report on jenkins

As show the previous table, the code base have a "Chef List Warning" referenced by official site as FC017. The original code for postgredb.rb it is:

# Support whyrun
require 'chef/mixin/shell_out'

require 'chef/mixin/language'
include Chef::Mixin::ShellOut

def whyrun_supported?
   true
end

action :install do
  version = @new_resource.version
  options = @new_resource.options
  e = execute "sudo apt-get install postgresql-#{version} #{options}"
  @new_resource.updated_by_last_action(e.updated_by_last_action?)
end

# Now, it just changes the default password to postgres.
action :unistall do
  converge_by "Unistall postgresql--#{@new_resource.version}" do
     e = execute "sudo apt-get purge postgresql--#{@new_resource.version}" do
       #not_if { "dpkg --get-selections | grep postgresql-#{@new_resource.version}" }
     end
  end
end

...

The FC017 warning was for line 10 because "LWRP does not notify when updated occur":

 @new_resource.updated_by_last_action(e.updated_by_last_action?)

Then I try to solve problem changing line for this:

 @new_resource.updated_by_last_action(true)

But this problem persisted on line 10.

Does anyone know what is the problem? why this warning don't was eliminated if parameter it's set to be true?

Était-ce utile?

La solution

remove the @ symbol from before new_resource

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top