Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify dependency violation message #423

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading