Skip to content

pks silently extracts no references from some ERB files #42

Description

@iMacTia

pks reports no constant references at all from a small number of .erb files. The file is walked and parsed as far as pks is concerned, it just yields nothing, so any boundary violation in it goes unreported.

On one of ours:

$ pks list-included-files | grep -c external_worker_statuses/show.html.erb
1
$ pks -p check 2>&1 | grep external_worker_statuses/show.html.erb
Started processing [...]/external_worker_statuses/show.html.erb
Finished processing [...]/external_worker_statuses/show.html.erb
$ pks check --ignore-recorded-violations [that file]
No violations detected!

packwerk check finds three violations in it.

How many

Appending a known cross-pack private constant reference to every .erb file in our app and re-running check, 8 of 735 fail to report it. The other 727 are fine.

What it isn't

I could not isolate the construct. Ruled out on the file above:

  • multi-line <% %> tags, and multi-line <%# %> comments
  • <%= ... do |f| %> block tags
  • ERB whose generated Ruby doesn't parse, since 225 of our files are in that state and are still checked correctly

Appending a plain single-line reference to an affected file is also not detected, so whatever it is takes out the whole file rather than particular expressions in it.

Why it's worth fixing

It is silent. A clean pks check doesn't distinguish "no violations here" from "this file was never read", and nothing in the output points at the affected files. We only noticed because pks update proposed deleting todo entries that packwerk still detects.

I can share one of the affected files privately if that helps; they are application views I can't post as-is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions