From: Tom Hughes Date: Mon, 9 Sep 2019 17:57:49 +0000 (+0100) Subject: Replace foodcritic and rubocop with cookstyle X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/57779fc16fc2ceb83e9b8d36bbdd23aaaa2c3291 Replace foodcritic and rubocop with cookstyle --- diff --git a/.rubocop.yml b/.rubocop.yml index f5d3d4c19..dfd51c01e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,5 @@ inherit_from: .rubocop_todo.yml -require: rubocop-performance - AllCops: TargetRubyVersion: 2.3 @@ -15,28 +13,33 @@ Layout/ExtraSpacing: Layout/IndentHeredoc: EnforcedStyle: squiggly -Naming/FileName: - Exclude: - - 'cookbooks/trac/files/default/trac-authenticate' - - 'cookbooks/planet/files/default/replication-bin/replicate-changesets' - - 'cookbooks/*/templates/*/*.erb' - - 'hooks/*' - - 'roles/*.rb' - Naming/UncommunicativeMethodParamName: Enabled: false -Style/FrozenStringLiteralComment: - EnforcedStyle: never - Style/HashSyntax: EnforcedStyle: hash_rockets Style/IfUnlessModifier: Enabled: false +Style/NumericPredicate: + EnforcedStyle: predicate + +Style/PercentLiteralDelimiters: + PreferredDelimiters: + '%i': '[]' + '%I': '[]' + '%w': '[]' + '%W': '[]' + Style/StringLiterals: EnforcedStyle: double_quotes Style/SymbolArray: EnforcedStyle: brackets + +Style/TrailingCommaInArrayLiteral: + Enabled: false + +Style/TrailingCommaInHashLiteral: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 3002b6a10..2e911812f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,77 +1,58 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2016-10-20 21:45:03 +0100 using RuboCop version 0.44.1. +# on 2019-09-09 18:59:09 +0100 using RuboCop version 0.72.0. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 22 -Metrics/AbcSize: - Max: 57 - -# Offense count: 27 -# Configuration parameters: CountComments. -Metrics/BlockLength: - Max: 372 - -Metrics/BlockNesting: - Max: 4 - -# Offense count: 3 -Metrics/CyclomaticComplexity: - Max: 8 - -# Offense count: 475 -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives. -# URISchemes: http, https -Metrics/LineLength: - Max: 704 - -# Offense count: 24 -# Configuration parameters: CountComments. -Metrics/MethodLength: - Max: 24 +# Offense count: 14 +ChefCorrectness/NodeNormal: + Exclude: + - '**/metadata.rb' + - 'cookbooks/dev/recipes/default.rb' + - 'cookbooks/mediawiki/resources/site.rb' + - 'cookbooks/networking/recipes/default.rb' + - 'cookbooks/openvpn/recipes/default.rb' + - 'cookbooks/web/recipes/backend.rb' + - 'cookbooks/wordpress/resources/site.rb' + +# Offense count: 12 +ChefCorrectness/NodeNormalUnless: + Exclude: + - '**/metadata.rb' + - 'cookbooks/mailman/recipes/default.rb' + - 'cookbooks/mediawiki/resources/site.rb' + - 'cookbooks/wordpress/resources/site.rb' -# Offense count: 1 -Metrics/PerceivedComplexity: - Max: 9 +# Offense count: 78 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: **/metadata.rb +ChefDeprecations/LongDescriptionMetadata: + Enabled: false -# Offense count: 13 -Style/Documentation: +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Include. +# Include: **/resources/*.rb, **/providers/*.rb +ChefModernize/IncludingMixinShelloutInResources: Exclude: - - 'spec/**/*' - - 'test/**/*' - - 'cookbooks/chef/libraries/compare_versions.rb' - - 'cookbooks/chef/libraries/edit_file.rb' - - 'cookbooks/chef/libraries/random_password.rb' - - 'cookbooks/chef/libraries/subversion.rb' - - 'cookbooks/hardware/libraries/sensors.rb' - - 'cookbooks/munin/libraries/expand.rb' - - 'cookbooks/mysql/libraries/mysql.rb' - - 'cookbooks/networking/libraries/interfaces.rb' - - 'cookbooks/networking/libraries/ipaddresses.rb' - - 'cookbooks/postgresql/libraries/postgresql.rb' - - 'cookbooks/tile/files/default/ruby/expire.rb' - - 'cookbooks/wordpress/libraries/wordpress.rb' + - 'cookbooks/nodejs/resources/package.rb' -# Offense count: 14 +# Offense count: 947 # Cop supports --auto-correct. -# Configuration parameters: MaxLineLength. -Style/IfUnlessModifier: - Exclude: - - 'cookbooks/accounts/recipes/default.rb' - - 'cookbooks/apache/providers/module.rb' - - 'cookbooks/chef/libraries/compare_versions.rb' - - 'cookbooks/exim/recipes/default.rb' - - 'cookbooks/hardware/attributes/default.rb' - - 'cookbooks/hardware/recipes/default.rb' - - 'cookbooks/munin/recipes/default.rb' - - 'cookbooks/nodejs/recipes/default.rb' - - 'cookbooks/tile/files/default/ruby/expire.rb' - - 'cookbooks/tools/recipes/default.rb' +# Configuration parameters: . +# SupportedStyles: strings, symbols +ChefStyle/AttributeKeys: + EnforcedStyle: symbols + +# Offense count: 297 +# Cop supports --auto-correct. +ChefStyle/CommentFormat: + Enabled: false -# Offense count: 37 +# Offense count: 466 # Cop supports --auto-correct. -Style/NumericLiterals: - MinDigits: 11 +ChefStyle/FileMode: + Enabled: false diff --git a/.travis.yml b/.travis.yml index afe9a2ceb..87e77d6c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,4 @@ sudo: false language: ruby cache: bundler script: - - bundle exec rubocop -f fuubar - - bundle exec foodcritic -f any cookbooks + - bundle exec cookstyle -f fuubar diff --git a/Gemfile b/Gemfile index 078ade7b2..ddf1c6b1c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,6 @@ source "https://rubygems.org" -gem "foodcritic" +gem "cookstyle" gem "kitchen-vagrant" -gem "rubocop" -gem "rubocop-performance" gem "serverspec" gem "test-kitchen" diff --git a/Gemfile.lock b/Gemfile.lock index 7dbaf4e58..87a88b2fe 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,30 +2,15 @@ GEM remote: https://rubygems.org/ specs: ast (2.4.0) - backports (3.15.0) bcrypt_pbkdf (1.0.1) builder (3.2.3) - cucumber-core (3.2.1) - backports (>= 3.8.0) - cucumber-tag_expressions (~> 1.1.0) - gherkin (~> 5.0) - cucumber-tag_expressions (1.1.1) + cookstyle (5.5.7) + rubocop (= 0.72.0) diff-lcs (1.3) ed25519 (1.2.4) equatable (0.6.1) erubis (2.7.0) ffi (1.11.1) - ffi-yajl (2.3.1) - libyajl2 (~> 1.2) - foodcritic (16.1.1) - cucumber-core (>= 1.3, < 4.0) - erubis - ffi-yajl (~> 2.0) - nokogiri (>= 1.5, < 2.0) - rake - rufus-lru (~> 1.0) - treetop (~> 1.4) - gherkin (5.1.0) gssapi (1.3.0) ffi (>= 1.0.1) gyoku (1.3.1) @@ -34,7 +19,6 @@ GEM jaro_winkler (1.5.3) kitchen-vagrant (1.6.0) test-kitchen (>= 1.4, < 3) - libyajl2 (1.2.0) license-acceptance (1.0.13) pastel (~> 0.7) tomlrb (~> 1.2) @@ -44,12 +28,11 @@ GEM logging (2.2.2) little-plugger (~> 1.1) multi_json (~> 1.10) - mini_portile2 (2.4.0) - mixlib-install (3.11.18) + mixlib-install (3.11.21) mixlib-shellout mixlib-versioning thor - mixlib-shellout (2.4.4) + mixlib-shellout (3.0.7) mixlib-versioning (1.2.7) multi_json (1.13.1) necromancer (0.5.0) @@ -59,18 +42,14 @@ GEM net-ssh-gateway (2.0.0) net-ssh (>= 4.0.0) net-telnet (0.1.1) - nokogiri (1.10.4) - mini_portile2 (~> 2.4.0) nori (2.6.0) parallel (1.17.0) - parser (2.6.3.0) + parser (2.6.4.0) ast (~> 2.4.0) pastel (0.7.3) equatable (~> 0.6) tty-color (~> 0.5) - polyglot (0.3.5) rainbow (3.0.0) - rake (12.3.3) rspec (3.8.0) rspec-core (~> 3.8.0) rspec-expectations (~> 3.8.0) @@ -87,19 +66,16 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.8.0) rspec-support (3.8.2) - rubocop (0.74.0) + rubocop (0.72.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) - rubocop-performance (1.4.1) - rubocop (>= 0.71.0) ruby-progressbar (1.10.1) rubyntlm (0.6.2) - rubyzip (1.2.3) - rufus-lru (1.1.0) + rubyzip (1.2.4) serverspec (2.41.5) multi_json rspec (~> 3.0) @@ -111,17 +87,17 @@ GEM net-ssh (>= 2.7) net-telnet (= 0.1.1) sfl - strings (0.1.5) + strings (0.1.6) strings-ansi (~> 0.1) unicode-display_width (~> 1.5) unicode_utils (~> 1.4) strings-ansi (0.1.0) - test-kitchen (2.2.5) + test-kitchen (2.3.2) bcrypt_pbkdf (~> 1.0) ed25519 (~> 1.2) license-acceptance (~> 1.0, >= 1.0.11) mixlib-install (~> 3.6) - mixlib-shellout (>= 1.2, < 3.0) + mixlib-shellout (>= 1.2, < 4.0) net-scp (>= 1.1, < 3.0) net-ssh (>= 2.9, < 6.0) net-ssh-gateway (>= 1.2, < 3.0) @@ -131,11 +107,9 @@ GEM winrm-fs (~> 1.1) thor (0.20.3) tomlrb (1.2.8) - treetop (1.6.10) - polyglot (~> 0.3) - tty-box (0.4.0) + tty-box (0.4.1) pastel (~> 0.7.2) - strings (~> 0.1.5) + strings (~> 0.1.6) tty-cursor (~> 0.7) tty-color (0.5.0) tty-cursor (0.7.0) @@ -173,10 +147,8 @@ PLATFORMS ruby DEPENDENCIES - foodcritic + cookstyle kitchen-vagrant - rubocop - rubocop-performance serverspec test-kitchen