Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
RuboCop fixes (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 authored Dec 1, 2020
1 parent 4311b83 commit d5c37d9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 34 deletions.
25 changes: 18 additions & 7 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
27 changes: 1 addition & 26 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions lib/project_types/script/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ 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)
super()
@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)
Expand Down
3 changes: 3 additions & 0 deletions lib/project_types/script/layers/domain/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ module Layers
module Domain
module Errors
class PushPackageNotFoundError < ScriptProjectError; end

class InvalidExtensionPointError < ScriptProjectError
attr_reader :type
def initialize(type)
super()
@type = type
end
end

class ScriptNotFoundError < ScriptProjectError
attr_reader :script_name, :extension_point_type
def initialize(extension_point_type, script_name)
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/project_types/script/layers/infrastructure/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,36 @@ 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)
@errors = errors
super("GraphQL failed with errors: #{errors}")
end
end

class ProjectCreatorNotFoundError < ScriptProjectError; end

class ScriptRepushError < ScriptProjectError
attr_reader :api_key
def initialize(api_key)
super()
@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)
Expand Down
2 changes: 1 addition & 1 deletion lib/shopify-cli/process_supervision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5c37d9

Please sign in to comment.