Skip to content

Commit 29cf22a

Browse files
committed
adding error template overrides description
1 parent 0cc4540 commit 29cf22a

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Instructions:
8282
- Confirm the output of `git diff` is empty
8383
- Please file an issue if it's not!
8484

85+
8586
# New to Rust?
8687
Me too! This is my first Rust project, so I'd love to have feedback, advice, and contributions!
8788

@@ -155,6 +156,32 @@ enforcement_globs_ignore:
155156
reason: "The other dependency violations are fine as those packs will be absorbed into this one."
156157
```
157158
159+
## "check" error messages
160+
The error messages resulting from running `pks check` can be customized with mustache-style interpolation. The available
161+
variables are:
162+
- violation_name
163+
- referencing_pack_name
164+
- defining_pack_name
165+
- constant_name
166+
- reference_location
167+
- referencing_pack_relative_yml
168+
169+
Layer violations also have
170+
- defining_layer
171+
- referencing_layer
172+
173+
Example:
174+
packwerk.yml
175+
```yml
176+
checker_overrides:
177+
folder_privacy_error_template: "{{reference_location}} {{violation_name}} / Product Service Privacy Violation: `{{constant_name}}` belongs to the `{{defining_pack_name}}` product service, which is not visible to `{{referencing_pack_name}}` as it is a different product service. See https://go/pks-folder-privacy"
178+
layer_error_template: "{{reference_location}}Layer violation: `{{constant_name}}` belongs to `{{defining_pack_name}}` (whose layer is `{{defining_layer}}`) cannot be accessed from `{{referencing_pack_name}}` (whose layer is `{{referencing_layer}}`). See https://go/pks-layer"
179+
visibility_error_template: "{{reference_location}}Visibility violation: `{{constant_name}}` belongs to `{{defining_pack_name}}`, which is not visible to `{{referencing_pack_name}}`. See https://go/pks-visibility"
180+
privacy_error_template: "{{reference_location}}Privacy violation: `{{constant_name}}` is private to `{{defining_pack_name}}`, but referenced from `{{referencing_pack_name}}`. See https://go/pks-privacy"
181+
dependency_error_template: "{{reference_location}}Dependency violation: `{{constant_name}}` belongs to `{{defining_pack_name}}`, but `{{referencing_pack_relative_yml}}` does not specify a dependency on `{{defining_pack_name}}`. See https://go/pks-dependency"
182+
```
183+
184+
158185
# Benchmarks
159186
See [BENCHMARKS.md](https://github.com/rubyatscale/pks/blob/main/BENCHMARKS.md)
160187

0 commit comments

Comments
 (0)