foodcritic 13.0.0 → 13.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 739fc9f5acc20cfab79ae4174106deb6a1826d49b0b9765f4637ef3fd2087f77
4
- data.tar.gz: aeccbfab2ce840a61664b2a9dd6057ba325a09b7c85938c32f6f803d5660e6d2
3
+ metadata.gz: 4043ba45f55c8b88b96eeb28ecb5111dd92e98ba45d1c74dc3ca86bc92c57cdc
4
+ data.tar.gz: 2f9bd70e42c3cbdec213e727c33b568d21ed72578dca8a173110f2944375d1e6
5
5
  SHA512:
6
- metadata.gz: d032449a47b49bb875c3ec04f693dfd7d88ef3575ea21842d50931592a6a3847568fc4ea55660f629d51c04380c3882e7a4159c8626c8e30cf7820151953b4cd
7
- data.tar.gz: 8c7e61eb1f449259f65ec08b72958089e92ccc8600071540c637c2f5415cb1361405f81d4e4008d75943c789edb35dc3d80f7f0172c5e002df97019464a40974
6
+ metadata.gz: d7d07e5748a0a19265b0d26d7347d07e90d79bd1aff1565c1c210501f1f29205e7d433cdeeea5646bdb2793e1517f78b76134639e2bab5add1433e161a65f2de
7
+ data.tar.gz: c17b5b064688c41d3a397202314df1938f549071dc07d1f368e730e5f795f73626d8e958524931bdf45b8d0523ce94f236c77814cd1196d5651f3d8edd3c5f85
@@ -1,5 +1,12 @@
1
1
  # Foodcritic Changelog:
2
2
 
3
+ ## [13.0.1](https://github.com/Foodcritic/foodcritic/tree/v13.0.1) (2018-04-11)
4
+
5
+ - Properly discover templates not in templates/default/. Templates in the root of the templates directory would be skipped previously
6
+ - Force encoding to UTF8 to prevent errors when encoding isn't set on the host
7
+ - Alert with the filename when an improperly encoded file is encountered instead of silently failing
8
+ - Removed the chef13 tag from FC085
9
+
3
10
  ## [13.0.0](https://github.com/Foodcritic/foodcritic/tree/v13.0.0) (2018-03-07)
4
11
 
5
12
  ### Chef 12 Support
@@ -1,3 +1,6 @@
1
+ Encoding.default_external = Encoding::UTF_8
2
+ Encoding.default_internal = Encoding::UTF_8
3
+
1
4
  require "pathname"
2
5
  require "cucumber/core"
3
6
  require "treetop"
@@ -557,7 +557,11 @@ module FoodCritic
557
557
  else
558
558
  File.read(file).encode("utf-8", "binary", :undef => :replace)
559
559
  end
560
- build_xml(Ripper::SexpBuilder.new(source).parse)
560
+ begin
561
+ build_xml(Ripper::SexpBuilder.new(source).parse)
562
+ rescue RuntimeError => e # this generally means bad encoding
563
+ raise "Could not parse the file at #{file}. #{e}"
564
+ end
561
565
  end
562
566
 
563
567
  # XPath custom function
@@ -242,8 +242,10 @@ module FoodCritic
242
242
  end
243
243
  end
244
244
 
245
- # Return the files within a cookbook tree that we are interested in trying
246
- # to match rules against.
245
+ # Return the files within a cookbook tree that we are interested in trying to match rules against.
246
+ #
247
+ # @param [Hash] paths - paths of interest: {:exclude=>[], :cookbook=>[], :role=>[], :environment=>[]}
248
+ # @return [Array] array of hashes for each file {:filename=>"./metadata.rb", :path_type=>:cookbook}
247
249
  def files_to_process(paths)
248
250
  paths.reject { |type, _| type == :exclude }.map do |path_type, dirs|
249
251
  dirs.map do |dir|
@@ -258,7 +260,7 @@ module FoodCritic
258
260
  if File.directory?(dir)
259
261
  glob = if path_type == :cookbook
260
262
  "{metadata.rb,attributes.rb,recipe.rb,{attributes,definitions,libraries,"\
261
- "providers,recipes,resources}/*.rb,templates/*/*.erb}"
263
+ "providers,recipes,resources}/*.rb,templates/**/*.erb}"
262
264
  else
263
265
  "*.rb"
264
266
  end
@@ -1,5 +1,5 @@
1
1
  rule "FC085", "Resource using new_resource.updated_by_last_action to converge resource" do
2
- tags %w{chef13 deprecated}
2
+ tags %w{correctness}
3
3
  def updated_by(ast)
4
4
  # we need to handle both @new_resource.updated_by_last_action(true) or new_resource.updated_by_last_action(true)
5
5
  # Here's the ast that xpath sees in all 3 possible scenarios from those two:
@@ -1,4 +1,4 @@
1
1
  module FoodCritic
2
2
  # The current version of foodcritic
3
- VERSION = "13.0.0"
3
+ VERSION = "13.0.1"
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: 13.0.0
4
+ version: 13.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Crump
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2018-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber-core
@@ -548,5 +548,5 @@ rubyforge_project:
548
548
  rubygems_version: 2.7.5
549
549
  signing_key:
550
550
  specification_version: 4
551
- summary: foodcritic-13.0.0
551
+ summary: foodcritic-13.0.1
552
552
  test_files: []