foodcritic 16.1.1 → 16.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ rule "FC040", "Execute resource used to run git commands" do
5
5
  find_resources(ast, type: "execute").select do |cmd|
6
6
  cmd_str = (resource_attribute(cmd, "command") || resource_name(cmd)).to_s
7
7
 
8
- actual_git_commands = cmd_str.scan(/git ([a-z]+)/).map { |c| c.first }
8
+ actual_git_commands = cmd_str.scan(/git ([a-z]+)/).map(&:first)
9
9
  (possible_git_commands & actual_git_commands).any?
10
10
  end
11
11
  end
@@ -1,22 +1,18 @@
1
1
  rule "FC044", "Avoid bare attribute keys" do
2
2
  tags %w{style}
3
3
  attributes do |ast|
4
- declared = ast.xpath("//descendant::var_field/ident/@value").map do |v|
5
- v.to_s
6
- end
4
+ declared = ast.xpath("//descendant::var_field/ident/@value").map(&:to_s)
7
5
 
8
6
  ast.xpath('//assign/*[self::vcall or self::var_ref]
9
7
  [count(child::kw) = 0]/ident').select do |v|
10
8
 
11
- local_declared = v.xpath("ancestor::*[self::brace_block or self::do_block]
12
- /block_var/descendant::ident/@value").map do |val|
13
- val.to_s
14
- end
9
+ local_declared = v.xpath("ancestor::*[self::brace_block or self::do_block]
10
+ /block_var/descendant::ident/@value").map(&:to_s)
15
11
 
16
- (v["value"] != "secure_password") &&
17
- !(declared + local_declared).uniq.include?(v["value"]) &&
18
- !v.xpath("ancestor::*[self::brace_block or self::do_block]/block_var/
19
- descendant::ident/@value='#{v['value']}'")
20
- end
12
+ (v["value"] != "secure_password") &&
13
+ !(declared + local_declared).uniq.include?(v["value"]) &&
14
+ !v.xpath("ancestor::*[self::brace_block or self::do_block]/block_var/
15
+ descendant::ident/@value='#{v["value"]}'")
16
+ end
21
17
  end
22
18
  end
@@ -7,6 +7,7 @@ rule "FC048", "Prefer shell_out helper method to shelling out with Ruby" do
7
7
  ast.xpath('//*[self::command or self::fcall]/ident[@value="system"]').select do |x|
8
8
  resource_name = x.xpath("ancestor::do_block/preceding-sibling::command/ident/@value")
9
9
  next false if resource_name.any? && resource_name.all? { |r| resource_attribute?(r.to_s, "system") }
10
+
10
11
  next x.xpath('count(following-sibling::args_add_block/descendant::kw[@value="true" or @value="false"]) = 0')
11
12
  end
12
13
  end
@@ -5,10 +5,11 @@ rule "FC123", "Content of a cookbook file is larger than 1MB" do
5
5
  files_path = File.join(path, "files")
6
6
  if File.exist?(files_path)
7
7
  Dir.foreach(files_path) do |file|
8
- next if ['.', '..'].member?(file)
9
- size = File.size(File.join(files_path,file))
10
- if size > 1024*1024 # 1 megabyte
11
- values += [file_match(File.join(files_path,file))]
8
+ next if [".", ".."].member?(file)
9
+
10
+ size = File.size(File.join(files_path, file))
11
+ if size > 1024 * 1024 # 1 megabyte
12
+ values += [file_match(File.join(files_path, file))]
12
13
  end
13
14
  end
14
15
  end
@@ -20,14 +20,11 @@ module FoodCritic
20
20
  end
21
21
  end
22
22
 
23
- def add_text(src, text)
24
- end
23
+ def add_text(src, text); end
25
24
 
26
- def add_preamble(codebuf)
27
- end
25
+ def add_preamble(codebuf); end
28
26
 
29
- def add_postamble(codebuf)
30
- end
27
+ def add_postamble(codebuf); end
31
28
 
32
29
  def add_stmt(src, code)
33
30
  @expressions << { type: :statement, code: code.strip }
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = "16.1.1".freeze
3
+ VERSION = "16.2.0".freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foodcritic
3
3
  version: !ruby/object:Gem::Version
4
- version: 16.1.1
4
+ version: 16.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-03 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-core
@@ -172,8 +172,8 @@ files:
172
172
  - Gemfile
173
173
  - LICENSE
174
174
  - bin/foodcritic
175
- - chef_dsl_metadata/chef_14.12.9.json
176
- - chef_dsl_metadata/chef_15.1.36.json
175
+ - chef_dsl_metadata/chef_14.14.29.json
176
+ - chef_dsl_metadata/chef_15.4.45.json
177
177
  - foodcritic.gemspec
178
178
  - lib/foodcritic.rb
179
179
  - lib/foodcritic/api.rb
@@ -325,5 +325,5 @@ requirements: []
325
325
  rubygems_version: 3.0.3
326
326
  signing_key:
327
327
  specification_version: 4
328
- summary: foodcritic-16.1.1
328
+ summary: foodcritic-16.2.0
329
329
  test_files: []