-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from Shopify/yuta/simplify-orchestration
Refactor - simplify orchestration layer - Extract checkers into its own namespace / module. - Decouple reference extraction from offence checks.
- Loading branch information
Showing
20 changed files
with
300 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
module Packwerk | ||
module ReferenceChecking | ||
module Checkers | ||
module Checker | ||
extend T::Sig | ||
extend T::Helpers | ||
|
||
interface! | ||
|
||
sig { returns(ViolationType).abstract } | ||
def violation_type; end | ||
|
||
sig { params(reference: Reference).returns(T::Boolean).abstract } | ||
def invalid_reference?(reference); end | ||
end | ||
end | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
lib/packwerk/reference_checking/checkers/dependency_checker.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
module Packwerk | ||
module ReferenceChecking | ||
module Checkers | ||
class DependencyChecker | ||
extend T::Sig | ||
include Checker | ||
|
||
sig { override.returns(ViolationType) } | ||
def violation_type | ||
ViolationType::Dependency | ||
end | ||
|
||
sig do | ||
override | ||
.params(reference: Packwerk::Reference) | ||
.returns(T::Boolean) | ||
end | ||
def invalid_reference?(reference) | ||
return false unless reference.source_package | ||
return false unless reference.source_package.enforce_dependencies? | ||
return false if reference.source_package.dependency?(reference.constant.package) | ||
true | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.