diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-11-24 19:38:39 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-11-24 21:38:00 -0800 |
commit | d77cb2108dfbe0f6ece03bae77859883526e1bcc (patch) | |
tree | 6c9a7b13f56c48ef3267e9a6e94f1391c2699e1a | |
parent | 3d7728a6ae3f7baed8c3d6bd4f1612607f6bce74 (diff) | |
download | chefstyle_fixes.tar.gz |
Resolve new spacing offenses in RuboCop 1.4chefstyle_fixes
If we really care we can turn this off, but it seems fine
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | Gemfile.lock | 10 | ||||
-rw-r--r-- | chef-config/lib/chef-config/exceptions.rb | 2 | ||||
-rw-r--r-- | lib/chef/cookbook_manifest.rb | 1 | ||||
-rw-r--r-- | lib/chef/encrypted_data_bag_item/assertions.rb | 2 | ||||
-rw-r--r-- | lib/chef/event_loggers/base.rb | 1 | ||||
-rw-r--r-- | lib/chef/exceptions.rb | 100 | ||||
-rw-r--r-- | lib/chef/provider/git.rb | 10 | ||||
-rw-r--r-- | lib/chef/provider/package/yum/rpm_utils.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/template.rb | 4 | ||||
-rw-r--r-- | lib/chef/resource_collection/resource_set.rb | 2 | ||||
-rw-r--r-- | lib/chef/win32/api/file.rb | 4 | ||||
-rw-r--r-- | omnibus/Gemfile.lock | 14 | ||||
-rw-r--r-- | spec/integration/recipes/recipe_dsl_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/http/authenticator_spec.rb | 1 | ||||
-rw-r--r-- | spec/unit/knife/core/node_editor_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/mixin/versioned_api_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/node_map_spec.rb | 3 | ||||
-rw-r--r-- | spec/unit/provider/mount/windows_spec.rb | 1 |
18 files changed, 140 insertions, 22 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index d8b74624d8..d92b3101c4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,10 @@ GIT remote: https://github.com/chef/chefstyle.git - revision: d2bfdf31b717a0009e15743ea6907f44537365be + revision: d64b97987cdda5e6af8c635f582054bd3c442950 branch: master specs: - chefstyle (1.5.2) - rubocop (= 1.3.1) + chefstyle (1.5.3) + rubocop (= 1.4.1) GIT remote: https://github.com/chef/ohai.git @@ -311,7 +311,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.10.0) rspec-support (3.10.0) - rubocop (1.3.1) + rubocop (1.4.1) parallel (~> 1.10) parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) @@ -320,7 +320,7 @@ GEM rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.1.1) + rubocop-ast (1.2.0) parser (>= 2.7.1.5) ruby-prof (1.2.0) ruby-progressbar (1.10.1) diff --git a/chef-config/lib/chef-config/exceptions.rb b/chef-config/lib/chef-config/exceptions.rb index 6d6609f574..a24e119136 100644 --- a/chef-config/lib/chef-config/exceptions.rb +++ b/chef-config/lib/chef-config/exceptions.rb @@ -21,7 +21,9 @@ require_relative "logger" module ChefConfig class ConfigurationError < ArgumentError; end + class InvalidPath < StandardError; end + class UnparsableConfigOption < StandardError; end end diff --git a/lib/chef/cookbook_manifest.rb b/lib/chef/cookbook_manifest.rb index 6e79a880e9..84b0c0d58c 100644 --- a/lib/chef/cookbook_manifest.rb +++ b/lib/chef/cookbook_manifest.rb @@ -317,6 +317,7 @@ class Chef end end + class CookbookManifestVersions extend Chef::Mixin::VersionedAPIFactory diff --git a/lib/chef/encrypted_data_bag_item/assertions.rb b/lib/chef/encrypted_data_bag_item/assertions.rb index 02baad2a2d..13ed0de050 100644 --- a/lib/chef/encrypted_data_bag_item/assertions.rb +++ b/lib/chef/encrypted_data_bag_item/assertions.rb @@ -30,7 +30,7 @@ class Chef::EncryptedDataBagItem unless format_version.is_a?(Integer) && format_version >= Chef::Config[:data_bag_decrypt_minimum_version] raise UnacceptableEncryptedDataBagItemFormat, "The encrypted data bag item has format version `#{format_version}', " + - "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'" + "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'" end end diff --git a/lib/chef/event_loggers/base.rb b/lib/chef/event_loggers/base.rb index 1ef7f7de6c..ad403e4230 100644 --- a/lib/chef/event_loggers/base.rb +++ b/lib/chef/event_loggers/base.rb @@ -21,6 +21,7 @@ require_relative "../event_dispatch/base" class Chef module EventLoggers class UnknownEventLogger < StandardError; end + class UnavailableEventLogger < StandardError; end def self.event_loggers_by_name diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb index e0b534c3d3..7f36f8d674 100644 --- a/lib/chef/exceptions.rb +++ b/lib/chef/exceptions.rb @@ -44,21 +44,37 @@ class Chef end class Application < RuntimeError; end + class SigInt < RuntimeError; end + class SigTerm < RuntimeError; end + class Cron < RuntimeError; end + class WindowsEnv < RuntimeError; end + class Exec < RuntimeError; end + class Execute < RuntimeError; end + class ErlCall < RuntimeError; end + class FileNotFound < RuntimeError; end + class Package < RuntimeError; end + class Service < RuntimeError; end + class Script < RuntimeError; end + class Route < RuntimeError; end + class SearchIndex < RuntimeError; end + class Override < RuntimeError; end + class UnsupportedAction < RuntimeError; end + class MissingLibrary < RuntimeError; end class CannotDetermineNodeName < RuntimeError @@ -68,64 +84,112 @@ class Chef end class User < RuntimeError; end + class Group < RuntimeError; end + class Link < RuntimeError; end + class Mount < RuntimeError; end + class Reboot < Exception; end # rubocop:disable Lint/InheritException + class RebootPending < Exception; end # rubocop:disable Lint/InheritException + class RebootFailed < Mixlib::ShellOut::ShellCommandFailed; end + class ClientUpgraded < Exception; end # rubocop:disable Lint/InheritException + class PrivateKeyMissing < RuntimeError; end + class CannotWritePrivateKey < RuntimeError; end + class RoleNotFound < RuntimeError; end + class DuplicateRole < RuntimeError; end + class ValidationFailed < ArgumentError; end + class CannotValidateStaticallyError < ArgumentError; end + class InvalidPrivateKey < ArgumentError; end + class MissingKeyAttribute < ArgumentError; end + class KeyCommandInputError < ArgumentError; end + class BootstrapCommandInputError < ArgumentError def initialize super "You cannot pass both --json-attributes and --json-attribute-file. Please pass one or none." end end + class InvalidKeyArgument < ArgumentError; end + class InvalidKeyAttribute < ArgumentError; end + class InvalidUserAttribute < ArgumentError; end + class InvalidClientAttribute < ArgumentError; end + class RedirectLimitExceeded < RuntimeError; end + class AmbiguousRunlistSpecification < ArgumentError; end + class CookbookFrozen < ArgumentError; end + class CookbookNotFound < RuntimeError; end + class OnlyApiVersion0SupportedForAction < RuntimeError; end + # Cookbook loader used to raise an argument error when cookbook not found. # for back compat, need to raise an error that inherits from ArgumentError class CookbookNotFoundInRepo < ArgumentError; end + class CookbookMergingError < RuntimeError; end + class RecipeNotFound < ArgumentError; end + # AttributeNotFound really means the attribute file could not be found class AttributeNotFound < RuntimeError; end + # NoSuchAttribute is raised on access by node.read!("foo", "bar") when node["foo"]["bar"] does not exist. class NoSuchAttribute < RuntimeError; end + # AttributeTypeMismatch is raised by node.write!("foo", "bar", "baz") when e.g. node["foo"] = "bar" (overwriting String with Hash) class AttributeTypeMismatch < RuntimeError; end + class MissingCookbookDependency < StandardError; end # CHEF-5120 + class InvalidCommandOption < RuntimeError; end + class CommandTimeout < RuntimeError; end + class RequestedUIDUnavailable < RuntimeError; end + class InvalidHomeDirectory < ArgumentError; end + class DsclCommandFailed < RuntimeError; end + class PlistUtilCommandFailed < RuntimeError; end + class UserIDNotFound < ArgumentError; end + class GroupIDNotFound < ArgumentError; end + class ConflictingMembersInGroup < ArgumentError; end + class InvalidResourceReference < RuntimeError; end + class ResourceNotFound < RuntimeError; end + class ProviderNotFound < RuntimeError; end NoProviderAvailable = ProviderNotFound class VerificationNotFound < RuntimeError; end + class InvalidEventType < ArgumentError; end + class MultipleIdentityError < RuntimeError; end + # Used in Resource::ActionClass#load_current_resource to denote that # the resource doesn't actually exist (for example, the file does not exist) class CurrentValueDoesNotExist < RuntimeError; end @@ -140,36 +204,56 @@ class Chef class InvalidPolicybuilderCall < ArgumentError; end class InvalidResourceSpecification < ArgumentError; end + class SolrConnectionError < RuntimeError; end + class IllegalChecksumRevert < RuntimeError; end + class CookbookVersionNameMismatch < ArgumentError; end + class MissingParentDirectory < RuntimeError; end + class UnresolvableGitReference < RuntimeError; end + class InvalidRemoteGitReference < RuntimeError; end + class InvalidEnvironmentRunListSpecification < ArgumentError; end + class InvalidDataBagItemID < ArgumentError; end + class InvalidDataBagName < ArgumentError; end + class EnclosingDirectoryDoesNotExist < ArgumentError; end + # Errors originating from calls to the Win32 API class Win32APIError < RuntimeError; end # Thrown when Win32 API layer binds to non-existent Win32 function. Occurs # when older versions of Windows don't support newer Win32 API functions. class Win32APIFunctionNotImplemented < NotImplementedError; end # rubocop:disable Lint/InheritException + # Attempting to run windows code on a not-windows node class Win32NotWindows < RuntimeError; end + class WindowsNotAdmin < RuntimeError; end + # Attempting to access a 64-bit only resource on a 32-bit Windows system class Win32ArchitectureIncorrect < RuntimeError; end + class ObsoleteDependencySyntax < ArgumentError; end + class InvalidDataBagPath < ArgumentError; end + class DuplicateDataBagItem < RuntimeError; end class PowershellCmdletException < RuntimeError; end + class LCMParser < RuntimeError; end class CannotDetermineHomebrewOwner < Package; end + class CannotDetermineWindowsInstallerType < Package; end + class NoWindowsPackageSource < Package; end # Can not create staging file during file deployment @@ -185,6 +269,7 @@ class Chef # does not follow X.Y.Z format. ArgumentError? class InvalidPlatformVersion < ArgumentError; end + class InvalidCookbookVersion < ArgumentError; end # version constraint should be a string or array, or it doesn't @@ -195,6 +280,7 @@ class Chef class IllegalVersionConstraint < NotImplementedError; end # rubocop:disable Lint/InheritException class MetadataNotValid < StandardError; end + class MetadataNotFound < StandardError attr_reader :install_path attr_reader :cookbook_name @@ -232,22 +318,34 @@ class Chef # Registry Helper throws the following errors class Win32RegArchitectureIncorrect < Win32ArchitectureIncorrect; end + class Win32RegHiveMissing < ArgumentError; end + class Win32RegKeyMissing < RuntimeError; end + class Win32RegValueMissing < RuntimeError; end + class Win32RegDataMissing < RuntimeError; end + class Win32RegValueExists < RuntimeError; end + class Win32RegNoRecursive < ArgumentError; end + class Win32RegTypeDoesNotExist < ArgumentError; end + class Win32RegBadType < ArgumentError; end + class Win32RegBadValueSize < ArgumentError; end + class Win32RegTypesMismatch < ArgumentError; end # incorrect input for registry_key create action throws following error class RegKeyValuesTypeMissing < ArgumentError; end + class RegKeyValuesDataMissing < ArgumentError; end class InvalidEnvironmentPath < ArgumentError; end + class EnvironmentNotFound < RuntimeError; end # File-like resource found a non-file (socket, pipe, directory, etc) at its destination @@ -283,6 +381,7 @@ class Chef end end + # Exception class for collecting multiple failures. Used when running # delayed notifications so that chef can process each delayed # notification even if chef client or other notifications fail. @@ -432,6 +531,7 @@ class Chef # Raised by Chef::JSONCompat class JSON class EncodeError < RuntimeError; end + class ParseError < RuntimeError; end end diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb index f1c8380307..c0f6f01c59 100644 --- a/lib/chef/provider/git.rb +++ b/lib/chef/provider/git.rb @@ -68,9 +68,9 @@ class Chef a.assertion { !(new_resource.revision =~ %r{^origin/}) } a.failure_message Chef::Exceptions::InvalidRemoteGitReference, "Deploying remote branches is not supported. " + - "Specify the remote branch as a local branch for " + - "the git repository you're deploying from " + - "(ie: '#{new_resource.revision.gsub("origin/", "")}' rather than '#{new_resource.revision}')." + "Specify the remote branch as a local branch for " + + "the git repository you're deploying from " + + "(ie: '#{new_resource.revision.gsub("origin/", "")}' rather than '#{new_resource.revision}')." end requirements.assert(:all_actions) do |a| @@ -80,8 +80,8 @@ class Chef a.assertion { !target_revision.nil? } a.failure_message Chef::Exceptions::UnresolvableGitReference, "Unable to parse SHA reference for '#{new_resource.revision}' in repository '#{new_resource.repository}'. " + - "Verify your (case-sensitive) repository URL and revision.\n" + - "`git ls-remote '#{new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}" + "Verify your (case-sensitive) repository URL and revision.\n" + + "`git ls-remote '#{new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}" end end diff --git a/lib/chef/provider/package/yum/rpm_utils.rb b/lib/chef/provider/package/yum/rpm_utils.rb index 7514d57bce..2932fc97dd 100644 --- a/lib/chef/provider/package/yum/rpm_utils.rb +++ b/lib/chef/provider/package/yum/rpm_utils.rb @@ -485,6 +485,7 @@ class Chef end class RPMProvide < RPMDependency; end + class RPMRequire < RPMDependency; end class RPMDbPackage < RPMPackage diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 88fde45a25..e3f266740d 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -169,8 +169,8 @@ class Chef elsif module_name.nil? raise Exceptions::ValidationFailed, "#helpers requires either a module name or inline module code as a block.\n" + - "e.g.: helpers do; helper_code; end;\n" + - "OR: helpers(MyHelpersModule)" + "e.g.: helpers do; helper_code; end;\n" + + "OR: helpers(MyHelpersModule)" else raise Exceptions::ValidationFailed, "Argument to #helpers must be a module. You gave #{module_name.inspect} (#{module_name.class})" diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb index db298afb63..26521010bd 100644 --- a/lib/chef/resource_collection/resource_set.rb +++ b/lib/chef/resource_collection/resource_set.rb @@ -131,7 +131,7 @@ class Chef else raise Chef::Exceptions::InvalidResourceSpecification, "The object `#{query_object.inspect}' is not valid for resource collection lookup. " + - "Use a String like `resource_type[resource_name]' or a Chef::Resource object" + "Use a String like `resource_type[resource_name]' or a Chef::Resource object" end end diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb index eb83e2487d..c18bc08e8b 100644 --- a/lib/chef/win32/api/file.rb +++ b/lib/chef/win32/api/file.rb @@ -316,6 +316,7 @@ typedef struct _REPARSE_DATA_BUFFER { string_pointer.read_wstring(self[:PrintNameLength] / 2) end end + class REPARSE_DATA_BUFFER_MOUNT_POINT < FFI::Struct layout :SubstituteNameOffset, :ushort, :SubstituteNameLength, :ushort, @@ -333,14 +334,17 @@ typedef struct _REPARSE_DATA_BUFFER { string_pointer.read_wstring(self[:PrintNameLength] / 2) end end + class REPARSE_DATA_BUFFER_GENERIC < FFI::Struct layout :DataBuffer, :uchar end + class REPARSE_DATA_BUFFER_UNION < FFI::Union layout :SymbolicLinkReparseBuffer, REPARSE_DATA_BUFFER_SYMBOLIC_LINK, :MountPointReparseBuffer, REPARSE_DATA_BUFFER_MOUNT_POINT, :GenericReparseBuffer, REPARSE_DATA_BUFFER_GENERIC end + class REPARSE_DATA_BUFFER < FFI::Struct layout :ReparseTag, :uint32, :ReparseDataLength, :ushort, diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock index c12cb7243a..a0ea86313d 100644 --- a/omnibus/Gemfile.lock +++ b/omnibus/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/chef/omnibus - revision: 5509689fbaaf30fe8d72c5a983d5edd588bf2a7f + revision: e8951da8c2b52524116a87af3cf632d9c799a435 branch: master specs: - omnibus (8.0.8) + omnibus (8.0.9) aws-sdk-s3 (~> 1) chef-cleanroom (~> 1.0) chef-utils (>= 15.4) @@ -18,11 +18,11 @@ GIT GIT remote: https://github.com/chef/omnibus-software - revision: ff47ef193f3ae3283b090e04c3006da7f4cc7a2a + revision: dada23e7f4237e9353aff0362f2dde964ee5abe0 branch: master specs: omnibus-software (4.0.0) - omnibus (>= 6.0.0) + omnibus (>= 8.0.0) GEM remote: https://rubygems.org/ @@ -32,7 +32,7 @@ GEM artifactory (3.0.15) awesome_print (1.8.0) aws-eventstream (1.1.0) - aws-partitions (1.398.0) + aws-partitions (1.399.0) aws-sdk-core (3.109.3) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.239.0) @@ -183,7 +183,7 @@ GEM ffi-yajl (2.3.4) libyajl2 (~> 1.2) fuzzyurl (0.9.0) - gssapi (1.3.0) + gssapi (1.3.1) ffi (>= 1.0.1) gyoku (1.3.1) builder (>= 2.1.2) @@ -251,7 +251,7 @@ GEM octokit (4.19.0) faraday (>= 0.9) sawyer (~> 0.8.0, >= 0.5.3) - ohai (16.7.18) + ohai (16.7.37) chef-config (>= 12.8, < 17) chef-utils (>= 16.0, < 17) ffi (~> 1.9) diff --git a/spec/integration/recipes/recipe_dsl_spec.rb b/spec/integration/recipes/recipe_dsl_spec.rb index 797e9ecb70..4234c54dc0 100644 --- a/spec/integration/recipes/recipe_dsl_spec.rb +++ b/spec/integration/recipes/recipe_dsl_spec.rb @@ -28,6 +28,7 @@ describe "Recipe DSL methods" do def provider Provider end + class Provider < Chef::Provider def load_current_resource; end @@ -41,6 +42,7 @@ describe "Recipe DSL methods" do # Modules to put stuff in module RecipeDSLSpecNamespace; end + module RecipeDSLSpecNamespace::Bar; end end diff --git a/spec/unit/http/authenticator_spec.rb b/spec/unit/http/authenticator_spec.rb index 4f43c19520..ee53f3d4c4 100644 --- a/spec/unit/http/authenticator_spec.rb +++ b/spec/unit/http/authenticator_spec.rb @@ -40,6 +40,7 @@ describe Chef::HTTP::Authenticator do context "when version_class is provided" do class V0Class; extend Chef::Mixin::VersionedAPI; minimum_api_version 0; end + class V2Class; extend Chef::Mixin::VersionedAPI; minimum_api_version 2; end class AuthFactoryClass diff --git a/spec/unit/knife/core/node_editor_spec.rb b/spec/unit/knife/core/node_editor_spec.rb index 4eac07c313..d8e5c86d2c 100644 --- a/spec/unit/knife/core/node_editor_spec.rb +++ b/spec/unit/knife/core/node_editor_spec.rb @@ -74,7 +74,7 @@ describe Chef::Knife::NodeEditor do expect(ui).to have_received(:warn) .with "Changing the name of a node results in a new node being " + - "created, test_node will not be modified or removed." + "created, test_node will not be modified or removed." expect(ui).to have_received(:confirm) .with("Proceed with creation of new node") diff --git a/spec/unit/mixin/versioned_api_spec.rb b/spec/unit/mixin/versioned_api_spec.rb index e97c920361..69e71e61b4 100644 --- a/spec/unit/mixin/versioned_api_spec.rb +++ b/spec/unit/mixin/versioned_api_spec.rb @@ -29,7 +29,9 @@ end describe Chef::Mixin::VersionedAPIFactory do class V1Class; extend Chef::Mixin::VersionedAPI; minimum_api_version 1; end + class V2Class; extend Chef::Mixin::VersionedAPI; minimum_api_version 2; end + class V3Class; extend Chef::Mixin::VersionedAPI; minimum_api_version 3; end let(:factory_class) { Class.new { extend Chef::Mixin::VersionedAPIFactory } } diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb index 91d203d6a2..9974da5d52 100644 --- a/spec/unit/node_map_spec.rb +++ b/spec/unit/node_map_spec.rb @@ -20,12 +20,15 @@ require "spec_helper" require "chef/node_map" class Foo; end + class Bar; end class FooResource < Chef::Resource; end + class BarResource < Chef::Resource; end class FooProvider < Chef::Provider; end + class BarProvider < Chef::Provider; end describe Chef::NodeMap do diff --git a/spec/unit/provider/mount/windows_spec.rb b/spec/unit/provider/mount/windows_spec.rb index aeff294347..3c2999e07e 100644 --- a/spec/unit/provider/mount/windows_spec.rb +++ b/spec/unit/provider/mount/windows_spec.rb @@ -23,6 +23,7 @@ class Chef class Windows class NetUse end + class Volume end end |