Skip to content

Commit

Permalink
Merge pull request #423 from derekprior/dp-dependency-violation-messages
Browse files Browse the repository at this point in the history
Clarify dependency violation message
  • Loading branch information
gmcgibbon authored Jan 23, 2025
2 parents ab53e75 + bedddc2 commit 3c6b354
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions TROUBLESHOOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ See: [USAGE.md - Enforcing dependency boundary](USAGE.md#Enforcing-dependency-bo

> /Users/JaneDoe/src/github.com/sample-project/billing/app/jobs/document_processing_job.rb:48:6
> Dependency violation: ::Edi::Source belongs to 'edi', but 'billing' does not specify a dependency on 'edi'.
> Are we missing an abstraction?
> Is the code making the reference, and the referenced constant, in the right packages?
> Are the constant and its references in the right packages?
>
> Inference details: 'Edi::Source' refers to ::Edi::Source which seems to be defined in edi/app/models/edi/source.rb.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ def message(reference)

<<~EOS
Dependency violation: #{const_name} belongs to '#{const_package}', but '#{ref_package}' does not specify a dependency on '#{const_package}'.
Are we missing an abstraction?
Is the code making the reference, and the referenced constant, in the right packages?
Are the constant and its references in the right packages?
#{standard_help_message(reference)}
EOS
Expand Down
3 changes: 1 addition & 2 deletions test/unit/packwerk/reference_offense_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class ReferenceOffenseTest < Minitest::Test

expected = <<~EXPECTED
Dependency violation: ::SomeName belongs to 'destination_package', but 'components/source' does not specify a dependency on 'destination_package'.
Are we missing an abstraction?
Is the code making the reference, and the referenced constant, in the right packages?
Are the constant and its references in the right packages?
Inference details: this is a reference to ::SomeName which seems to be defined in some/location.rb.
To receive help interpreting or resolving this error message, see: https://github.com/Shopify/packwerk/blob/main/TROUBLESHOOT.md#Troubleshooting-violations
Expand Down

0 comments on commit 3c6b354

Please sign in to comment.