diff --git a/.rubocop.yml b/.rubocop.yml index b326b2acb9..b4a2899790 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -77,13 +77,24 @@ Style/RegexpLiteral: Style/MethodCallWithArgsParentheses: IgnoredMethods: + - assert + - assert_equal + - assert_includes + - assert_nil + - assert_raises + - assert_requested # from Webmock + - puts + - raise + - refute + - refute_empty + - refute_nil - require - - require_relative - require_dependency + - require_relative - yield - - raise - - puts - - assert_equal - - assert - - refute - - assert_requested # from Webmock + +Layout/TrailingWhitespace: + Exclude: + - 'ext/shopify-cli/extconf.rb' # unsure if safe to remove + - 'lib/project_types/extension/messages/messages.rb' # unsure if safe to remove + - 'test/project_types/extension/extension_test_helpers/stubs/argo_script.rb' # unsure if save to remove diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index aa32244831..a39a9412a8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,36 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2020-11-24 18:00:45 UTC using RuboCop version 1.4.1. +# on 2020-12-01 16:33:09 UTC using RuboCop version 1.4.1. # 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: 12 -# Cop supports --auto-correct. -# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines. -Layout/EmptyLineBetweenDefs: - Exclude: - - 'lib/project_types/script/errors.rb' - - 'lib/project_types/script/layers/domain/errors.rb' - - 'lib/project_types/script/layers/infrastructure/errors.rb' - -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: AllowInHeredoc. -Layout/TrailingWhitespace: - Exclude: - - 'ext/shopify-cli/extconf.rb' - - 'lib/project_types/extension/messages/messages.rb' - - 'test/project_types/extension/extension_test_helpers/stubs/argo_script.rb' - # Offense count: 30 Minitest/MultipleAssertions: Max: 9 - -# Offense count: 74 -# Cop supports --auto-correct. -# Configuration parameters: IgnoreMacros, IgnoredMethods, IgnoredPatterns, IncludedMacros, AllowParenthesesInMultilineCall, AllowParenthesesInChaining, AllowParenthesesInCamelCaseMethod, EnforcedStyle. -# SupportedStyles: require_parentheses, omit_parentheses -Style/MethodCallWithArgsParentheses: - Enabled: false diff --git a/lib/project_types/script/errors.rb b/lib/project_types/script/errors.rb index f4bf66a1fb..32c71d4165 100644 --- a/lib/project_types/script/errors.rb +++ b/lib/project_types/script/errors.rb @@ -6,6 +6,7 @@ class InvalidContextError < ScriptProjectError; end class InvalidScriptNameError < ScriptProjectError; end class NoExistingAppsError < ScriptProjectError; end class NoExistingOrganizationsError < ScriptProjectError; end + class NoExistingStoresError < ScriptProjectError attr_reader :organization_id def initialize(organization_id) @@ -13,8 +14,10 @@ def initialize(organization_id) @organization_id = organization_id end end + class ScriptProjectAlreadyExistsError < ScriptProjectError; end class InvalidConfigProps < ScriptProjectError; end + class InvalidConfigYAMLError < ScriptProjectError attr_reader :config_file def initialize(config_file) diff --git a/lib/project_types/script/layers/domain/errors.rb b/lib/project_types/script/layers/domain/errors.rb index ffb5472fbb..0196fc9c73 100644 --- a/lib/project_types/script/layers/domain/errors.rb +++ b/lib/project_types/script/layers/domain/errors.rb @@ -5,6 +5,7 @@ module Layers module Domain module Errors class PushPackageNotFoundError < ScriptProjectError; end + class InvalidExtensionPointError < ScriptProjectError attr_reader :type def initialize(type) @@ -12,6 +13,7 @@ def initialize(type) @type = type end end + class ScriptNotFoundError < ScriptProjectError attr_reader :script_name, :extension_point_type def initialize(extension_point_type, script_name) @@ -20,6 +22,7 @@ def initialize(extension_point_type, script_name) @extension_point_type = extension_point_type end end + class ServiceFailureError < ScriptProjectError; end end end diff --git a/lib/project_types/script/layers/infrastructure/errors.rb b/lib/project_types/script/layers/infrastructure/errors.rb index b7fad73679..33d1d42e6d 100644 --- a/lib/project_types/script/layers/infrastructure/errors.rb +++ b/lib/project_types/script/layers/infrastructure/errors.rb @@ -10,6 +10,7 @@ class AppScriptUndefinedError < ScriptProjectError; end class BuildError < ScriptProjectError; end class DependencyInstallError < ScriptProjectError; end class ForbiddenError < ScriptProjectError; end + class GraphqlError < ScriptProjectError attr_reader :errors def initialize(errors) @@ -17,7 +18,9 @@ def initialize(errors) super("GraphQL failed with errors: #{errors}") end end + class ProjectCreatorNotFoundError < ScriptProjectError; end + class ScriptRepushError < ScriptProjectError attr_reader :api_key def initialize(api_key) @@ -25,15 +28,18 @@ def initialize(api_key) @api_key = api_key end end + class ScriptServiceUserError < ScriptProjectError def initialize(query_name, errors) super("Failed performing #{query_name}. Errors: #{errors}.") end end + class ShopAuthenticationError < ScriptProjectError; end class ShopScriptConflictError < ScriptProjectError; end class ShopScriptUndefinedError < ScriptProjectError; end class TaskRunnerNotFoundError < ScriptProjectError; end + class PackagesOutdatedError < ScriptProjectError attr_reader :outdated_packages def initialize(outdated_packages) diff --git a/lib/shopify-cli/process_supervision.rb b/lib/shopify-cli/process_supervision.rb index 9cfb7b9737..5b917f2a00 100644 --- a/lib/shopify-cli/process_supervision.rb +++ b/lib/shopify-cli/process_supervision.rb @@ -206,7 +206,7 @@ def kill(id) unless ctx.windows? Process.kill('TERM', id) 50.times do - sleep 0.1 + sleep(0.1) break unless stat(id) end end