foodcritic 10.2.2 → 10.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -2
  3. data/Gemfile +2 -1
  4. data/README.md +7 -1
  5. data/Rakefile +55 -35
  6. data/bin/foodcritic +1 -7
  7. data/features/024_check_for_missing_platforms.feature +3 -4
  8. data/features/continuous_integration_support.feature +2 -2
  9. data/features/step_definitions/cookbook_steps.rb +24 -285
  10. data/features/support/command_helpers.rb +3 -0
  11. data/foodcritic.gemspec +12 -6
  12. data/lib/foodcritic/api.rb +14 -2
  13. data/lib/foodcritic/command_line.rb +8 -0
  14. data/lib/foodcritic/linter.rb +1 -1
  15. data/lib/foodcritic/output.rb +17 -3
  16. data/lib/foodcritic/rules/fc008.rb +8 -6
  17. data/lib/foodcritic/rules/fc024.rb +1 -1
  18. data/lib/foodcritic/rules/fc045.rb +1 -8
  19. data/lib/foodcritic/rules/fc068.rb +1 -1
  20. data/lib/foodcritic/rules/fc069.rb +365 -0
  21. data/lib/foodcritic/rules/fc070.rb +63 -0
  22. data/lib/foodcritic/rules/fc071.rb +6 -0
  23. data/lib/foodcritic/rules/fc072.rb +6 -0
  24. data/lib/foodcritic/rules/fc073.rb +17 -0
  25. data/lib/foodcritic/rules/fc074.rb +10 -0
  26. data/lib/foodcritic/rules/fc075.rb +9 -0
  27. data/lib/foodcritic/version.rb +1 -1
  28. data/spec/functional/fc001_spec.rb +67 -0
  29. data/spec/functional/fc008_spec.rb +33 -0
  30. data/spec/functional/fc011_spec.rb +20 -0
  31. data/spec/functional/fc012_spec.rb +20 -0
  32. data/spec/functional/fc016_spec.rb +48 -0
  33. data/spec/functional/fc028_spec.rb +48 -0
  34. data/spec/functional/fc029_spec.rb +33 -0
  35. data/spec/functional/fc031_spec.rb +14 -0
  36. data/spec/functional/fc042_spec.rb +13 -0
  37. data/spec/functional/fc045_spec.rb +18 -0
  38. data/spec/functional/fc052_spec.rb +13 -0
  39. data/spec/functional/fc053_spec.rb +13 -0
  40. data/spec/functional/fc055_spec.rb +18 -0
  41. data/spec/functional/fc056_spec.rb +18 -0
  42. data/spec/functional/fc061_spec.rb +48 -0
  43. data/spec/functional/fc062_spec.rb +13 -0
  44. data/spec/functional/fc063_spec.rb +18 -0
  45. data/spec/functional/fc064_spec.rb +13 -0
  46. data/spec/functional/fc065_spec.rb +13 -0
  47. data/spec/functional/fc066_spec.rb +13 -0
  48. data/spec/functional/fc067_spec.rb +13 -0
  49. data/spec/functional/fc068_spec.rb +13 -0
  50. data/spec/functional/fc069_spec.rb +23 -0
  51. data/spec/functional/fc070_spec.rb +38 -0
  52. data/spec/functional/fc071_spec.rb +14 -0
  53. data/spec/functional/fc072_spec.rb +13 -0
  54. data/spec/functional/fc073_spec.rb +56 -0
  55. data/spec/functional/fc074_spec.rb +39 -0
  56. data/spec/functional/fc075_spec.rb +41 -0
  57. data/spec/functional/root_aliases_spec.rb +13 -0
  58. data/spec/regression/cookbooks.txt +0 -2
  59. data/spec/regression/expected/activemq.txt +5 -0
  60. data/spec/regression/expected/apparmor.txt +8 -0
  61. data/spec/regression/expected/apt.txt +12 -0
  62. data/spec/regression/expected/aws.txt +13 -0
  63. data/spec/regression/expected/bluepill.txt +6 -0
  64. data/spec/regression/expected/boost.txt +6 -0
  65. data/spec/regression/expected/build-essential.txt +6 -0
  66. data/spec/regression/expected/chef-client.txt +13 -0
  67. data/spec/regression/expected/chef-server.txt +12 -0
  68. data/spec/regression/expected/chef.txt +36 -0
  69. data/spec/regression/expected/chef_handler.txt +7 -0
  70. data/spec/regression/expected/cron.txt +7 -0
  71. data/spec/regression/expected/database.txt +13 -0
  72. data/spec/regression/expected/dmg.txt +12 -0
  73. data/spec/regression/expected/drbd.txt +25 -0
  74. data/spec/regression/expected/dynect.txt +29 -0
  75. data/spec/regression/expected/erlang.txt +4 -0
  76. data/spec/regression/expected/fail2ban.txt +4 -0
  77. data/spec/regression/expected/firewall.txt +12 -0
  78. data/spec/regression/expected/gecode.txt +8 -0
  79. data/spec/regression/expected/gems.txt +31 -0
  80. data/spec/regression/expected/gunicorn.txt +9 -0
  81. data/spec/regression/expected/heartbeat.txt +8 -0
  82. data/spec/regression/expected/homebrew.txt +8 -0
  83. data/spec/regression/expected/iis.txt +30 -0
  84. data/spec/regression/expected/iptables.txt +8 -0
  85. data/spec/regression/expected/jetty.txt +11 -0
  86. data/spec/regression/expected/jpackage.txt +8 -0
  87. data/spec/regression/expected/keepalived.txt +4 -0
  88. data/spec/regression/expected/kickstart.txt +14 -0
  89. data/spec/regression/expected/logwatch.txt +4 -0
  90. data/spec/regression/expected/lvm.txt +12 -0
  91. data/spec/regression/expected/maradns.txt +13 -0
  92. data/spec/regression/expected/maven.txt +9 -0
  93. data/spec/regression/expected/memcached.txt +30 -0
  94. data/spec/regression/expected/motd-tail.txt +4 -0
  95. data/spec/regression/expected/mysql.txt +12 -0
  96. data/spec/regression/expected/ohai.txt +6 -0
  97. data/spec/regression/expected/openldap.txt +10 -0
  98. data/spec/regression/expected/openssh.txt +4 -0
  99. data/spec/regression/expected/openssl.txt +5 -0
  100. data/spec/regression/expected/partial_search.txt +5 -0
  101. data/spec/regression/expected/passenger_apache2.txt +29 -0
  102. data/spec/regression/expected/perl.txt +11 -0
  103. data/spec/regression/expected/php.txt +9 -0
  104. data/spec/regression/expected/postfix.txt +6 -0
  105. data/spec/regression/expected/powershell.txt +8 -0
  106. data/spec/regression/expected/resolver.txt +6 -0
  107. data/spec/regression/expected/rsync.txt +10 -0
  108. data/spec/regression/expected/rsyslog.txt +8 -0
  109. data/spec/regression/expected/sql_server.txt +4 -0
  110. data/spec/regression/expected/sqlite.txt +4 -0
  111. data/spec/regression/expected/ssh_known_hosts.txt +5 -0
  112. data/spec/regression/expected/stompserver.txt +5 -0
  113. data/spec/regression/expected/subversion.txt +5 -0
  114. data/spec/regression/expected/sudo.txt +8 -0
  115. data/spec/regression/expected/tftp.txt +5 -0
  116. data/spec/regression/expected/tomcat.txt +8 -0
  117. data/spec/regression/expected/transmission.txt +10 -0
  118. data/spec/regression/expected/ubuntu.txt +4 -0
  119. data/spec/regression/expected/ufw.txt +9 -0
  120. data/spec/regression/expected/unicorn.txt +6 -0
  121. data/spec/regression/expected/users.txt +7 -0
  122. data/spec/regression/expected/vim.txt +6 -0
  123. data/spec/regression/expected/webpi.txt +7 -0
  124. data/spec/regression/expected/whitelist-node-attrs.txt +6 -0
  125. data/spec/regression/expected/windows.txt +57 -0
  126. data/spec/regression/expected/wix.txt +4 -0
  127. data/spec/regression/expected/xfs.txt +4 -0
  128. data/spec/regression/expected/xml.txt +4 -0
  129. data/spec/regression/expected/yum.txt +17 -0
  130. data/spec/regression/expected/zlib.txt +4 -0
  131. data/spec/regression/expected/zsh.txt +4 -0
  132. data/spec/regression/regression_spec.rb +16 -10
  133. data/spec/spec_helper.rb +115 -10
  134. data/spec/{foodcritic → unit}/api_spec.rb +549 -593
  135. data/spec/{foodcritic → unit}/chef_spec.rb +15 -15
  136. data/spec/unit/command_line_spec.rb +122 -0
  137. data/spec/{foodcritic → unit}/domain_spec.rb +12 -12
  138. data/spec/{foodcritic → unit}/linter_spec.rb +20 -35
  139. data/spec/{foodcritic → unit}/template_spec.rb +13 -13
  140. metadata +161 -33
  141. data/features/001_check_node_access.feature +0 -60
  142. data/features/008_check_for_boilerplate_metadata.feature +0 -25
  143. data/features/011_check_for_markdown_readme.feature +0 -20
  144. data/features/012_check_for_deprecated_readme_format.feature +0 -20
  145. data/features/016_check_for_no_lwrp_default_action.feature +0 -25
  146. data/features/028_check_for_incorrect_platform_method.feature +0 -20
  147. data/features/029_check_for_no_leading_cookbook_name.feature +0 -18
  148. data/features/031_check_for_metadata_existence.feature +0 -15
  149. data/features/042_check_for_deprecated_require_recipe.feature +0 -15
  150. data/features/045_check_for_cookbook_name_in_metadata.feature +0 -20
  151. data/features/052_check_for_metadata_using_suggests_keyword.feature +0 -15
  152. data/features/053_check_for_metadata_using_recommends_keyword.feature +0 -15
  153. data/features/055_check_for_no_maintainer.feature +0 -25
  154. data/features/056_check_for_no_maintainer_email.feature +0 -25
  155. data/features/061_valid_cookbook_version_should_be_defined.feature +0 -55
  156. data/features/062_cookbook_should_have_cookbook_version.feature +0 -50
  157. data/features/063_cookbook_incorrectly_depends_on_itself.feature +0 -15
  158. data/features/064_check_for_no_issues_url.feature +0 -25
  159. data/features/065_check_for_no_source_url.feature +0 -25
  160. data/features/066_check_for_no_chef_version_metadata.feature +0 -20
  161. data/features/067_check_for_no_supports_metadata.feature +0 -20
  162. data/features/068_check_for_no_license_metadata.feature +0 -20
  163. data/spec/foodcritic/command_line_spec.rb +0 -74
  164. data/spec/regression/expected-output.txt +0 -355
  165. data/spec/regression_helpers.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcbbb15acbc25d0fdec9a129d629d5a45c08ef3a
4
- data.tar.gz: 7982dfc208b2c1a15466aead18c67964dbd87335
3
+ metadata.gz: 51965965410c5bca11ae0c137067c1a431fec90d
4
+ data.tar.gz: 61d4b6217f52adad76a864d344f32e723de36c79
5
5
  SHA512:
6
- metadata.gz: a4a3b4dbbfd73ba79d6a41d4b518a2b911836ded03b1d686266a0529ec0e952c0846622cba28bb513be8e4fc8952f014744c3752ddacb124f0accc50754dd772
7
- data.tar.gz: 5804dbecb771cdff66df4f4be7c67a082b9ac6029c0706aa6b02217d91a281c8e10c85de8a1680ba124f75a4a21639b6a8eb6e581a9d46d093610cc0644cfb2f
6
+ metadata.gz: b633d70600b84b66af81dc39647cd129bc951a09c381b861a6aa11317376479d08e388c3bb5439993949629afb1b8bc4912f5ff4d00d91bd9004bf27d3f15342
7
+ data.tar.gz: c7d934d01cc45d6e528be29d5125c1475803d31e9511c0e54c5b27cc520d6642c3320b611b2cdb8a731ad1b30643d9fdb7648b041bcf4852552f8e9ce497d148
data/CHANGELOG.md CHANGED
@@ -1,13 +1,34 @@
1
1
  # Foodcritic Changelog:
2
2
 
3
- ## [10.2.2](https://github.com/acrmp/foodcritic/tree/10.2.2) (2017-03-31)
4
- [Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.2.1...10.2.2)
3
+ ## [10.3.0](https://github.com/acrmp/foodcritic/tree/v10.3.0) (2017-04-10)
4
+
5
+ [Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.2.2...v10.3.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Added `FC069` to ensure standardized licenses are defined in metadata
10
+ - Added `FC070` to detect invalid platform supports in metadata
11
+ - Added `FC071` to ensure a LICENSE file is included with the cookbook
12
+ - Added `FC072` to detect attributes defined in metadata
13
+ - Added `FC073` to detect root alias collisions with non-root alias files
14
+ - Added `FC074` to detect setting the default_action in a LWRP without using the default_action DSL
15
+ - Added `FC075` to detect node.save usage
16
+ - Updated `FC008` to fail if the ChefDK generated boilerplate is included
17
+ - Updated `FC024` to not recommend adding amazon as an equivalent platform to Redhat as Amazon is its own platform family in Chef 13
18
+ - Updated `FC045` to no longer fail if metadata.rb cannot be found
19
+ - Added support for the Chef 13 root alias cookbook structure changes defined in <https://github.com/chef/chef-rfc/blob/master/rfc033-root-aliases.md>
20
+ - Testing has been completed reworked to simplify testing and allow for far more robust functional tests. Minitest unit tests have been converted to rspec and a new functional testing framework has been added utilizing rspec. Tests for a large number of the existing rules have been converted to this new framework. The new testing framework allows for simple all-in-one tests that are easier to read and much simpler to write. Additionally the regression tests have been reworked, and are now enabled in Travis CI, which will require regeneration of the expected output if new tests are added using `rake regen_regression`. See the readme for additional details on running tests.
21
+
22
+ ## [10.2.2](https://github.com/acrmp/foodcritic/tree/v10.2.2) (2017-03-31)
23
+
24
+ [Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.2.1...v10.2.2)
5
25
 
6
26
  **Implemented enhancements:**
7
27
 
8
28
  - Align rake setup better with CLI options to resolve bugs with tags in Rake [\#533](https://github.com/acrmp/foodcritic/pull/533) ([tas50](https://github.com/tas50))
9
29
 
10
30
  ## [v10.2.1](https://github.com/acrmp/foodcritic/tree/v10.2.1) (2017-03-31)
31
+
11
32
  [Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.2.0...v10.2.1)
12
33
 
13
34
  **Implemented enhancements:**
@@ -15,6 +36,7 @@
15
36
  - Add supermarket tag to FC067 and FC068 [\#532](https://github.com/acrmp/foodcritic/pull/532) ([tas50](https://github.com/tas50))
16
37
 
17
38
  ## [v10.2.0](https://github.com/acrmp/foodcritic/tree/v10.2.0) (2017-03-30)
39
+
18
40
  [Full Changelog](https://github.com/acrmp/foodcritic/compare/v10.1.1...v10.2.0)
19
41
 
20
42
  **Implemented enhancements:**
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "foodcritic", :path => "."
3
+ gemspec
4
4
 
5
5
  group :test do
6
6
  gem "aruba", "~> 0.5"
@@ -13,6 +13,7 @@ end
13
13
 
14
14
  group :development do
15
15
  gem "ronn", "~> 0.7"
16
+ gem "pry"
16
17
  end
17
18
 
18
19
  group :changelog do
data/README.md CHANGED
@@ -33,7 +33,7 @@ Foodcritic includes rspec tests of the application itself and cucumber tests for
33
33
  Running rspec tests:
34
34
 
35
35
  ```
36
- $ bundle exec rake test
36
+ $ bundle exec rake spec
37
37
  ```
38
38
 
39
39
  Running cucumber tests:
@@ -42,6 +42,12 @@ Running cucumber tests:
42
42
  $ bundle exec rake features
43
43
  ```
44
44
 
45
+ Running regression tests:
46
+
47
+ ```
48
+ $ bundle exec rake 'spec[regression]'
49
+ ```
50
+
45
51
  ## License
46
52
 
47
53
  MIT - see the accompanying [LICENSE](https://github.com/acrmp/foodcritic/blob/master/LICENSE) file for details.
data/Rakefile CHANGED
@@ -1,49 +1,42 @@
1
- require "foodcritic/version"
2
- require "bundler"
3
- require "rake/testtask"
1
+ require "bundler/setup"
2
+ require "mixlib/shellout"
4
3
 
5
- task :default => [:man, :install, :test, :features, :rubocop]
4
+ require "bundler/gem_tasks"
6
5
 
7
- Bundler.setup
8
- Bundler::GemHelper.install_tasks
9
-
10
- Rake::TestTask.new do |t|
11
- t.pattern = "spec/foodcritic/*_spec.rb"
12
- end
13
-
14
- Rake::TestTask.new do |t|
15
- t.name = "regressions"
16
- t.pattern = "spec/regression/*_spec.rb"
6
+ require "rspec/core/rake_task"
7
+ RSpec::Core::RakeTask.new(:spec, :tag) do |t, args|
8
+ t.rspec_opts = [].tap do |a|
9
+ a << "--color"
10
+ a << "--format #{ENV['CI'] ? 'documentation' : 'Fuubar'}"
11
+ a << "--backtrace" if ENV["DEBUG"]
12
+ a << "--seed #{ENV['SEED']}" if ENV["SEED"]
13
+ a << "--tag ~regression" unless ENV["CI"] || args[:tag] == "regression"
14
+ a << "--tag #{args[:tag]}" if args[:tag]
15
+ end.join(" ")
17
16
  end
18
17
 
19
- begin
20
- require "cucumber"
21
- require "cucumber/rake/task"
22
- Cucumber::Rake::Task.new(:features) do |t|
23
- t.cucumber_opts = ["-f", "progress", "--strict"]
24
- unless ENV.has_key?("FC_FORK_PROCESS") && ENV["FC_FORK_PROCESS"] == true.to_s
25
- t.cucumber_opts += ["-t", "~@build"]
26
- t.cucumber_opts += ["-t", "~@context"]
27
- end
28
- t.cucumber_opts += ["features"]
18
+ require "cucumber"
19
+ require "cucumber/rake/task"
20
+ Cucumber::Rake::Task.new(:features) do |t|
21
+ t.cucumber_opts = %w{--strict}
22
+ t.cucumber_opts += %w{-f progress} unless ENV["CI"]
23
+ unless ENV.has_key?("FC_FORK_PROCESS") && ENV["FC_FORK_PROCESS"] == "true"
24
+ t.cucumber_opts += ["-t", "~@build"]
25
+ t.cucumber_opts += ["-t", "~@context"]
29
26
  end
30
- rescue LoadError
31
- puts "cucumber is not available. gem install cucumber to get 'rake features' to work"
27
+ t.cucumber_opts += ["features"]
32
28
  end
33
29
 
34
- begin
35
- require "chefstyle"
36
- require "rubocop/rake_task"
37
- desc "Run Chefstyle (rubocop)"
38
- RuboCop::RakeTask.new do |task|
39
- task.options << "--display-cop-names"
40
- end
41
- rescue LoadError
42
- puts "chefstyle gem is not available. gem install chefstyle to get rake rubocop to work"
30
+ require "chefstyle"
31
+ require "rubocop/rake_task"
32
+ desc "Run Chefstyle (rubocop)"
33
+ RuboCop::RakeTask.new do |task|
34
+ task.options << "--display-cop-names"
43
35
  end
44
36
 
45
37
  begin
46
38
  require "github_changelog_generator/task"
39
+ require_relative "../lib/foodcritic/version"
47
40
 
48
41
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
49
42
  config.header = "# Foodcritic Changelog:"
@@ -61,3 +54,30 @@ desc "Build the manpage"
61
54
  task(:man) do
62
55
  sh "ronn -w --roff man/*.ronn"
63
56
  end
57
+
58
+ task :default => [:man, :test, :rubocop]
59
+
60
+ desc "Run all tests"
61
+ task :test => [:spec, :features]
62
+
63
+ desc "Regenerate regression test data"
64
+ task :regen_regression do
65
+ in_path = File.expand_path("../spec/regression/cookbooks.txt", __FILE__)
66
+ cookbooks = IO.readlines(in_path)
67
+ cookbooks.each_with_index do |line, i|
68
+ name, ref = line.strip.split(":")
69
+ puts "Regenerating output for #{name} (#{i + 1}/#{cookbooks.size})"
70
+ Dir.mktmpdir do |temp|
71
+ clone_cmd = Mixlib::ShellOut.new("git", "clone", "https://github.com/chef-cookbooks/#{name}.git", ".", cwd: temp)
72
+ clone_cmd.run_command
73
+ clone_cmd.error!
74
+ checkout_cmd = Mixlib::ShellOut.new("git", "checkout", ref, cwd: temp)
75
+ checkout_cmd.run_command
76
+ checkout_cmd.error!
77
+ fc_cmd = Mixlib::ShellOut.new(File.expand_path("../bin/foodcritic", __FILE__), "--no-progress", ".", cwd: temp)
78
+ fc_cmd.run_command
79
+ out_path = File.expand_path("../spec/regression/expected/#{name}.txt", __FILE__)
80
+ IO.write(out_path, fc_cmd.stdout)
81
+ end
82
+ end
83
+ end
data/bin/foodcritic CHANGED
@@ -1,9 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative "../lib/foodcritic"
3
- module FoodCritic
4
- cmd_line = CommandLine.new(ARGV)
5
- review, status = Linter.run(cmd_line)
6
- printer = cmd_line.show_context? ? ContextOutput.new : SummaryOutput.new
7
- printer.output(review)
8
- exit status.to_i
9
- end
3
+ exit FoodCritic::CommandLine.main
@@ -14,9 +14,8 @@ Feature: Check for missing platforms
14
14
  | type | supports | flavours | warning |
15
15
  | case | | chalk,cheese | should not be shown |
16
16
  | case | | debian,ubuntu | should not be shown |
17
- | case | | amazon,centos,redhat,scientific,oracle | should not be shown |
18
- | case | | centos,redhat,amazon,scientific,oracle | should not be shown |
19
- | case | | centos,debian,fedora,redhat,amazon,scientific,oracle | should not be shown |
17
+ | case | | centos,redhat,scientific,oracle | should not be shown |
18
+ | case | | centos,debian,fedora,redhat,scientific,oracle | should not be shown |
20
19
  | case | | redhat | should not be shown |
21
20
  | case | | centos,redhat | should be shown |
22
21
  | case | centos,redhat | centos,redhat | should not be shown |
@@ -25,7 +24,7 @@ Feature: Check for missing platforms
25
24
  | case | centos,debian,scientific | centos,scientific | should not be shown |
26
25
  | case | centos,redhat,scientific | redhat,scientific | should be shown |
27
26
  | case | debian,redhat,centos,fedora | redhat,centos,fedora | should not be shown |
28
- | platform? | | centos,redhat,amazon,scientific,oracle | should not be shown |
27
+ | platform? | | centos,redhat,scientific,oracle | should not be shown |
29
28
  | platform? | | redhat | should not be shown |
30
29
  | platform? | | redhat,scientific | should be shown |
31
30
  | platform? | redhat,scientific | redhat,scientific | should not be shown |
@@ -26,10 +26,10 @@ Feature: Continuous Integration Support
26
26
  | FC002,FC005 | -f ~any | FC002,FC005 | successful |
27
27
  | FC002,FC005 | -f any -f ~FC014 | FC002,FC005 | failed |
28
28
  | FC002,FC005 | -f any,~FC014 | FC002,FC005 | failed |
29
- | FC002 | -f ~FC002 -f ~metadata | FC002 | successful |
29
+ | FC002 | -f ~FC002 -f ~metadata | FC002 | failed |
30
30
  | FC002,FC005 | -f ~FC002 | FC002,FC005 | failed |
31
31
  | FC002,FC005 | -f any -f ~FC002 | FC002,FC005 | failed |
32
32
  | FC002 | -f any,~FC002 | FC002 | failed |
33
- | FC002 | -f any -f ~FC002 -f ~metadata | FC002 | successful |
33
+ | FC002 | -f any -f ~FC002 -f ~metadata | FC002 | failed |
34
34
  | FC002,FC005 | -f any,~FC002 | FC002,FC005 | failed |
35
35
  | FC002,FC005 | -f ~FC002 -f ~FC004 | FC002,FC005 | failed |
@@ -978,22 +978,6 @@ Given "a cookbook that contains a LWRP with multiple notifications" do
978
978
  })
979
979
  end
980
980
 
981
- Given /^a cookbook that contains a LWRP with (no|a) default action( defined via a constructor)?$/ do |has_default_action, no_dsl|
982
- default_action = if has_default_action == "no"
983
- :no_default_action
984
- elsif no_dsl.nil?
985
- :dsl_default_action
986
- else
987
- :ruby_default_action
988
- end
989
- cookbook_with_lwrp({ :default_action => default_action,
990
- :notifies => :does_notify })
991
- end
992
-
993
- Given "a cookbook that contains a custom resource with no default action" do
994
- cookbook_with_custom_resource
995
- end
996
-
997
981
  Given "a cookbook that contains no ruby blocks" do
998
982
  write_recipe %q{
999
983
  package "tar" do
@@ -1013,12 +997,6 @@ Given /^a cookbook that does not contain a definition and has (no|a) definitions
1013
997
  }
1014
998
  end
1015
999
 
1016
- Given "a cookbook that does not have a README at all" do
1017
- write_recipe %q{
1018
- log "Use the source luke"
1019
- }
1020
- end
1021
-
1022
1000
  Given "a cookbook that does not have defined metadata" do
1023
1001
  write_recipe %q{
1024
1002
  include_recipe "foo::default"
@@ -1043,33 +1021,6 @@ Given /^a cookbook that has ([^ ]+) problems$/ do |problems|
1043
1021
  )
1044
1022
  end
1045
1023
 
1046
- Given "a cookbook that has a README in markdown format" do
1047
- write_recipe %q{
1048
- log "Hello"
1049
- }
1050
- write_file "cookbooks/example/README.md", %q{
1051
- Description
1052
- ===========
1053
-
1054
- Hi. This is markdown.
1055
- }
1056
- end
1057
-
1058
- Given "a cookbook that has a README in RDoc format" do
1059
- write_recipe %q{
1060
- log "Hello"
1061
- }
1062
- write_file "cookbooks/example/README.rdoc", %q{
1063
- = DESCRIPTION:
1064
-
1065
- I used to be the preferred format but not any more (sniff).
1066
- }
1067
- end
1068
-
1069
- Given /^a cookbook that has maintainer metadata set to (.*) and ([^ ]+)$/ do |name, email|
1070
- cookbook_with_maintainer(nil_if_unspecified(name), nil_if_unspecified(email))
1071
- end
1072
-
1073
1024
  Given "a cookbook that has the default boilerplate metadata generated by knife" do
1074
1025
  cookbook_with_maintainer("YOUR_COMPANY_NAME", "YOUR_EMAIL")
1075
1026
  end
@@ -1335,51 +1286,6 @@ Given "a cookbook with five recipes" do
1335
1286
 
1336
1287
  end
1337
1288
 
1338
- Given /^a cookbook with metadata that declares a recipe with (.*)$/ do |declaration|
1339
- write_metadata declaration
1340
- write_recipe ""
1341
- end
1342
-
1343
- Given /^a cookbook with metadata that (specifies|does not specify) the cookbook name$/ do |specifies|
1344
- write_metadata %Q{
1345
- #{"name 'example'" if specifies == 'specifies'}
1346
- }
1347
- end
1348
-
1349
- Given /^a cookbook with metadata that (includes|does not include) a maintainer keyword$/ do |includes|
1350
- write_metadata %Q{
1351
- #{"maintainer 'A Maintainer'" if includes == 'includes'}
1352
- }
1353
- end
1354
-
1355
- Given /^a cookbook with metadata that (includes|does not include) a maintainer email$/ do |includes|
1356
- write_metadata %Q{
1357
- #{"maintainer_email 'maintainer@example.com'" if includes == 'includes'}
1358
- }
1359
- end
1360
-
1361
- Given "a cookbook with metadata that includes a maintainer expression" do
1362
- write_metadata "maintainer an(expression)"
1363
- end
1364
-
1365
- Given "a cookbook with metadata that includes a maintainer email expression" do
1366
- write_metadata "maintainer_email an(expression)"
1367
- end
1368
-
1369
- Given /^a cookbook with metadata that (includes|does not include) a recommends keyword$/ do |includes|
1370
- write_metadata %Q{
1371
- depends "bar"
1372
- #{"recommends 'foo'" if includes == 'includes'}
1373
- }
1374
- end
1375
-
1376
- Given /^a cookbook with metadata that (includes|does not include) a suggests keyword$/ do |includes|
1377
- write_metadata %Q{
1378
- depends "bar"
1379
- #{"suggests 'foo'" if includes == 'includes'}
1380
- }
1381
- end
1382
-
1383
1289
  Given /^a directory that contains a role file ([^ ]+) in (json|ruby) that defines role name (.*)$/ do |file_name, format, role_name|
1384
1290
  role(:role_name => %Q{"#{role_name}"}, :file_name => file_name, :format => format.to_sym)
1385
1291
  end
@@ -1776,18 +1682,6 @@ Given "a recipe that tries to mask a systemd service" do
1776
1682
  }
1777
1683
  end
1778
1684
 
1779
- Given /^a recipe that uses require_recipe$/ do
1780
- write_recipe %Q{
1781
- require_recipe "foo::default"
1782
- }
1783
- end
1784
-
1785
- Given /^a recipe that uses include_recipe$/ do
1786
- write_recipe %Q{
1787
- include_recipe "foo::default"
1788
- }
1789
- end
1790
-
1791
1685
  Given /^a ruby environment file that defines an environment with name (.*)$/ do |env_name|
1792
1686
  environment(:environment_name => %Q{"#{env_name}"}, :file_name => "production.rb")
1793
1687
  end
@@ -1864,22 +1758,24 @@ When /^I check the cookbook specifying ([^ ]+) as the Chef version$/ do |version
1864
1758
  cd "." do
1865
1759
  options = ["-I", "rules/test.rb"] + options if Dir.exist?("rules")
1866
1760
  end
1761
+ options += %w{--no-progress}
1867
1762
  run_lint(options)
1868
1763
  end
1869
1764
 
1870
1765
  When /^I check the cookbook( tree)?(?: specifying tags(.*))?(, specifying that context should be shown)?$/ do |whole_tree, tags, context|
1871
1766
  options = tags.nil? ? [] : tags.split(" ")
1872
1767
  options += ["-C"] unless context.nil?
1768
+ options += %w{--no-progress}
1873
1769
  run_lint(options + ["cookbooks/#{whole_tree.nil? ? 'example' : ''}"])
1874
1770
  end
1875
1771
 
1876
1772
  Given /^the cookbook directory has a \.foodcritic file specifying tags (.*)$/ do |tags|
1877
1773
  write_file "cookbooks/example/.foodcritic", tags
1878
- run_lint(["cookbooks/example"])
1774
+ run_lint(["--no-progress", "cookbooks/example"])
1879
1775
  end
1880
1776
 
1881
1777
  When "I check both cookbooks specified as arguments" do
1882
- run_lint(["cookbooks/another_example", "cookbooks/example"])
1778
+ run_lint(["--no-progress", "cookbooks/another_example", "cookbooks/example"])
1883
1779
  end
1884
1780
 
1885
1781
  When /^I check both cookbooks with the command-line (.*)$/ do |command_line|
@@ -1890,15 +1786,16 @@ When /^I check both cookbooks with the command-line (.*)$/ do |command_line|
1890
1786
  c
1891
1787
  end
1892
1788
  end
1893
- run_lint(cmds)
1789
+ run_lint(%w{--no-progress} + cmds)
1894
1790
  end
1895
1791
 
1896
1792
  When "I check both roles directories" do
1897
- run_lint ["-R", "roles1", "-R", "roles2"]
1793
+ run_lint ["--no-progress", "-R", "roles1", "-R", "roles2"]
1898
1794
  end
1899
1795
 
1900
1796
  When "I check the cookbooks, role and environment together" do
1901
1797
  run_lint([
1798
+ "--no-progress",
1902
1799
  "-B", "cookbooks/another_example", "-B", "cookbooks/example",
1903
1800
  "-E", "environments",
1904
1801
  "-R", "roles"
@@ -1906,24 +1803,24 @@ When "I check the cookbooks, role and environment together" do
1906
1803
  end
1907
1804
 
1908
1805
  When "I check the cookbook without specifying a Chef version" do
1909
- run_lint(["-I", "rules/test.rb", "cookbooks/example"])
1806
+ run_lint(["--no-progress", "-I", "rules/test.rb", "cookbooks/example"])
1910
1807
  end
1911
1808
 
1912
1809
  When "I check the environment directory" do
1913
- run_lint ["-E", "environments"]
1810
+ run_lint ["--no-progress", "-E", "environments"]
1914
1811
  end
1915
1812
 
1916
1813
  When "I check the eu environment file only" do
1917
- run_lint ["-E", "environments/production_eu.rb"]
1814
+ run_lint ["--no-progress", "-E", "environments/production_eu.rb"]
1918
1815
  end
1919
1816
 
1920
1817
  When /^I check the cookbook( without)? excluding the ([^ ]+) directory$/ do |no_exclude, dir|
1921
1818
  options = no_exclude.nil? ? ["-X", dir] : []
1922
- run_lint(options + ["cookbooks/example"])
1819
+ run_lint(options + ["--no-progress", "cookbooks/example"])
1923
1820
  end
1924
1821
 
1925
1822
  When "I check the recipe" do
1926
- run_lint(["cookbooks/example/recipes/default.rb"])
1823
+ run_lint(["--no-progress", "cookbooks/example/recipes/default.rb"])
1927
1824
  end
1928
1825
 
1929
1826
  When "I compare the man page options against the usage options" do
@@ -1931,20 +1828,20 @@ When "I compare the man page options against the usage options" do
1931
1828
  end
1932
1829
 
1933
1830
  When "I check the role directory" do
1934
- run_lint ["-R", "roles"]
1831
+ run_lint ["--no-progress", "-R", "roles"]
1935
1832
  end
1936
1833
 
1937
1834
  When /^I check the role directory as a (default|cookbook|role) path$/ do |path_type|
1938
1835
  options = case path_type
1939
- when "default" then ["roles"]
1940
- when "cookbook" then ["-B", "roles"]
1941
- when "role" then ["-R", "roles"]
1836
+ when "default" then ["--no-progress", "roles"]
1837
+ when "cookbook" then ["--no-progress", "-B", "roles"]
1838
+ when "role" then ["--no-progress", "-R", "roles"]
1942
1839
  end
1943
1840
  run_lint(options)
1944
1841
  end
1945
1842
 
1946
1843
  When "I check the webserver role only" do
1947
- run_lint ["-R", "roles/webserver.rb"]
1844
+ run_lint ["--no-progress", "-R", "roles/webserver.rb"]
1948
1845
  end
1949
1846
 
1950
1847
  When "I list the available build tasks" do
@@ -1960,7 +1857,7 @@ When /^I run it on the command line including a custom rule (file|directory) con
1960
1857
  end
1961
1858
  end
1962
1859
  }
1963
- run_lint(["-I",
1860
+ run_lint(["--no-progress", "-I",
1964
1861
  path_type == "file" ? "rules/custom_rules.rb" : "rules",
1965
1862
  "cookbooks/example"])
1966
1863
  end
@@ -1968,25 +1865,25 @@ end
1968
1865
  When /^I run it on the command line including a file which does not contain Ruby code$/ do
1969
1866
  write_file "rules/invalid_rules.rb", 'echo "not ruby"'
1970
1867
  capture_error do
1971
- run_lint(["-I", "rules/invalid_rules.rb", "cookbooks/example"])
1868
+ run_lint(["--no-progress", "-I", "rules/invalid_rules.rb", "cookbooks/example"])
1972
1869
  end
1973
1870
  end
1974
1871
 
1975
1872
  When /^I run it on the command line including a missing custom rule file$/ do
1976
1873
  capture_error do
1977
- run_lint(["-I", "rules/missing_rules.rb", "cookbooks/example"])
1874
+ run_lint(["--no-progress", "-I", "rules/missing_rules.rb", "cookbooks/example"])
1978
1875
  end
1979
1876
  end
1980
1877
 
1981
1878
  When "I run it on the command line specifying a cookbook that does not exist" do
1982
- run_lint(["no-such-cookbook"])
1879
+ run_lint(["--no-progress", "no-such-cookbook"])
1983
1880
  end
1984
1881
 
1985
1882
  When /^I run it on the command line specifying a( role|n environment) directory that does not exist$/ do |type|
1986
1883
  if type.include?("role")
1987
- run_lint(["-R", "no-such-role-dir"])
1884
+ run_lint(["--no-progress", "-R", "no-such-role-dir"])
1988
1885
  else
1989
- run_lint(["-E", "no-such-environment-dir"])
1886
+ run_lint(["--no-progress", "-E", "no-such-environment-dir"])
1990
1887
  end
1991
1888
  end
1992
1889
 
@@ -2154,14 +2051,6 @@ Then /^the attribute consistency warning 019 should be (shown|not shown)$/ do |s
2154
2051
  expect_warning("FC019", :line => nil, :expect_warning => show_warning == "shown")
2155
2052
  end
2156
2053
 
2157
- Then /^the boilerplate metadata warning 008 should warn on lines (.*)$/ do |lines_to_warn|
2158
- if lines_to_warn.strip == ""
2159
- expect_no_warning("FC008")
2160
- else
2161
- lines_to_warn.split(",").each { |line| expect_warning("FC008", :line => line, :file => "metadata.rb") }
2162
- end
2163
- end
2164
-
2165
2054
  Then /the build status should be (successful|failed)$/ do |build_outcome|
2166
2055
  build_outcome == "successful" ? assert_no_error_occurred : assert_error_occurred
2167
2056
  end
@@ -2225,24 +2114,6 @@ Then "the missing template warning 033 should not be displayed against the templ
2225
2114
  expect_warning("FC033", :line => 3, :expect_warning => false)
2226
2115
  end
2227
2116
 
2228
- Then /^the no leading cookbook name warning 029 should be (not )?shown$/ do |should_not|
2229
- expect_warning("FC029", :line => 1, :expect_warning => should_not.nil?, :file => "metadata.rb")
2230
- end
2231
-
2232
- Then "the node access warning 001 should be displayed for each match" do
2233
- expect_warning("FC001", :line => 1)
2234
- expect_warning("FC001", :line => 2)
2235
- end
2236
-
2237
- Then "the node access warning 001 should be displayed against the variables" do
2238
- expect_warning("FC001", :line => 4)
2239
- expect_warning("FC001", :line => 5)
2240
- end
2241
-
2242
- Then "the node access warning 001 should be displayed twice for the same line" do
2243
- expect_warning("FC001", :line => 1, :num_occurrences => 2)
2244
- end
2245
-
2246
2117
  Then "the node access warning 001 should warn on lines 2 and 10 in that order" do
2247
2118
  expected_warnings = [2, 10].map do |line|
2248
2119
  "FC001: Use strings in preference to symbols to access node attributes: cookbooks/example/recipes/default.rb:#{line}"
@@ -2250,14 +2121,6 @@ Then "the node access warning 001 should warn on lines 2 and 10 in that order" d
2250
2121
  expect_output(expected_warnings.join("\n"))
2251
2122
  end
2252
2123
 
2253
- Then "the node access warning 001 should be displayed for the recipe" do
2254
- expect_warning("FC001")
2255
- end
2256
-
2257
- Then "the node access warning 001 should not be displayed for the attributes" do
2258
- expect_warning("FC001", :file_type => :attributes, :line => 1, :expect_warning => false)
2259
- end
2260
-
2261
2124
  Then "the prefer chef_gem to manual install warning 025 should be shown" do
2262
2125
  expect_warning("FC025", :line => nil)
2263
2126
  end
@@ -2338,7 +2201,7 @@ When /^I check the cookbook specifying a search grammar that (does not exist|is
2338
2201
  when "is a valid treetop grammar"
2339
2202
  write_file("search.treetop", IO.read(FoodCritic::Chef::Search.new.chef_search_grammars.first))
2340
2203
  end
2341
- run_lint(["--search-grammar", "search.treetop", "cookbooks/example"])
2204
+ run_lint(["--no-progress", "--search-grammar", "search.treetop", "cookbooks/example"])
2342
2205
  end
2343
2206
 
2344
2207
  Then /^the check should abort with an error$/ do
@@ -2452,127 +2315,3 @@ Given /^a cookbook that contains a library resource$/ do
2452
2315
  }
2453
2316
  write_library("lib", library_file)
2454
2317
  end
2455
-
2456
- Given "a cookbook with metadata that includes the version keyword and a valid version string" do
2457
- write_metadata %q{version '1.2.3'}
2458
- end
2459
-
2460
- Given "a cookbook with metadata that includes the version keyword and a valid version string with double quotes" do
2461
- write_metadata %q{version '1.2.3'}
2462
- end
2463
-
2464
- Given "a cookbook with metadata that includes the version keyword and a valid x.y version string" do
2465
- write_metadata %q{version '1.2'}
2466
- end
2467
-
2468
- Given "a cookbook with metadata that does not include a version keyword" do
2469
- write_metadata %Q{
2470
- name 'test'
2471
- }
2472
- end
2473
-
2474
- Given "a cookbook with metadata that includes the version keyword and an invalid version string" do
2475
- write_metadata %q{version '1.a.3'}
2476
- end
2477
-
2478
- Given "a cookbook with metadata that includes the version keyword and an invalid single digit version string" do
2479
- write_metadata %q{version '1'}
2480
- end
2481
-
2482
- Given "a cookbook with metadata that includes the version keyword and an invalid 4 digit version string" do
2483
- write_metadata %q{version '1.2.3.4'}
2484
- end
2485
-
2486
- Given "a cookbook with a metadata version that uses string interpolation" do
2487
- write_metadata %q{
2488
- patch = 3
2489
- version "1.2.#{patch}"
2490
- }
2491
- end
2492
-
2493
- Given "a cookbook with a metadata version that is not a string literal" do
2494
- write_metadata %q{
2495
- v = "1.2.3"
2496
- version v
2497
- }
2498
- end
2499
-
2500
- Given "a cookbook with a metadata version that is a method call" do
2501
- write_metadata %q{
2502
- version magic_version_generator('and its args')
2503
- }
2504
- end
2505
-
2506
- Given(/^a cookbook with metadata that (includes|does not include) a self dependency$/) do |includes|
2507
- write_metadata %Q{
2508
- name 'bar'
2509
- depends 'baz'
2510
- #{"depends 'bar'" if includes == 'includes'}
2511
- }
2512
- end
2513
-
2514
- Then(/^the metadata with self dependency warning 063 should be (shown|not shown) against the metadata file$/) do |show_warning|
2515
- if show_warning == "shown"
2516
- expect_warning("FC063", :file => "metadata.rb", :line => 3, :expect_warning => true)
2517
- else
2518
- expect_warning("FC063", :file => "metadata.rb", :expect_warning => false)
2519
- end
2520
- end
2521
-
2522
- Given(/^a cookbook with metadata that (includes|does not include) a issues_url keyword$/) do |includes|
2523
- write_metadata %Q{
2524
- #{"issues_url 'http://github.com/foo/bar_cookbook/issues'" if includes == 'includes'}
2525
- }
2526
- end
2527
-
2528
- Given(/^a cookbook with metadata that includes a issues_url expression$/) do
2529
- write_metadata "issues_url an(expression)"
2530
- end
2531
-
2532
- Then(/^the metadata missing issues_url warning 064 should be (shown|not shown) against the metadata file$/) do |show_warning|
2533
- expect_warning("FC064", :file => "metadata.rb", :expect_warning => show_warning == "shown")
2534
- end
2535
-
2536
- Given(/^a cookbook with metadata that (includes|does not include) a source_url keyword$/) do |includes|
2537
- write_metadata %Q{
2538
- #{"source_url 'http://github.com/foo/bar_cookbook/'" if includes == 'includes'}
2539
- }
2540
- end
2541
-
2542
- Then(/^the metadata missing source_url warning 065 should be (shown|not shown) against the metadata file$/) do |show_warning|
2543
- expect_warning("FC065", :file => "metadata.rb", :expect_warning => show_warning == "shown")
2544
- end
2545
-
2546
- Given(/^a cookbook with metadata that includes a source_url expression$/) do
2547
- write_metadata "source_url an(expression)"
2548
- end
2549
-
2550
- Given(/^a cookbook with metadata that (includes|does not include) a chef_version keyword$/) do |includes|
2551
- write_metadata %Q{
2552
- #{"chef_version '> 12.6'" if includes == 'includes'}
2553
- }
2554
- end
2555
-
2556
- Then(/^the metadata missing chef_version warning 066 should be (shown|not shown) against the metadata file$/) do |show_warning|
2557
- expect_warning("FC066", :file => "metadata.rb", :expect_warning => show_warning == "shown")
2558
- end
2559
-
2560
- Given(/^a cookbook with metadata that (includes|does not include) a supports keyword$/) do |includes|
2561
- write_metadata %Q{
2562
- #{"supports 'debian'" if includes == 'includes'}
2563
- }
2564
- end
2565
-
2566
- Then(/^the metadata missing supports warning 067 should be (shown|not shown) against the metadata file$/) do |show_warning|
2567
- expect_warning("FC067", :file => "metadata.rb", :expect_warning => show_warning == "shown")
2568
- end
2569
-
2570
- Given(/^a cookbook with metadata that (includes|does not include) a license keyword$/) do |includes|
2571
- write_metadata %Q{
2572
- #{"license 'Apache-2.0'" if includes == 'includes'}
2573
- }
2574
- end
2575
-
2576
- Then(/^the metadata missing license warning 068 should be (shown|not shown) against the metadata file$/) do |show_warning|
2577
- expect_warning("FC068", :file => "metadata.rb", :expect_warning => show_warning == "shown")
2578
- end