Shopify / Shopify/packwerk

Group offenses together

Open
#8 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Ruby
Stars
1.9k
Forks
121
Avg merge
2m
Merged PRs (30d)
1

Description

We currently can dump a lot of information at the user:

/Some/path/foo.rb:136:8
Privacy violation: '::Foo::Bar' is private to 'foo' but referenced from 'path'.
Is there a public entrypoint in 'foo/app/public/' that you can use instead?
Inference details: 'Foo::Bar' refers to ::Foo::Bar which seems to be defined in foo/app/foo/models/bar.rb.

/Some/path/foo.rb:151:8
Privacy violation: '::Foo::Spam' is private to 'foo' but referenced from 'path'.
Is there a public entrypoint in 'foo/app/public/' that you can use instead?
Inference details: 'Foo::Spam' refers to ::Foo::Spam which seems to be defined in foo/app/models/foo/spam.rb.

/Some/path/foo.rb:161:8
Privacy violation: '::Foo::Eggs' is private to 'foo' but referenced from 'path'.
Is there a public entrypoint in 'foo/app/public/' that you can use instead?
Inference details: 'Foo::Eggs' refers to ::Foo::Eggs which seems to be defined in foo/app/models/foo/eggs.rb.

There's a huge amount of repetition in there, and that's mostly because we were trying to fit the rubocop mold. Let's investigate grouping these together in a more concise and informative way.

Here's one idea:

# Privacy violations

These references appear to reference a private constant in relevant packages. You should look for a publicly accessible constant (<link> to learn more).

- /Some/path/foo.rb:136:8 references `Foo::Bar` in package 'foo'
- /Some/path/foo.rb:151:8 references `Foo::Spam` in package 'foo'
- /Some/path/foo.rb:161:8 references 'Foo::Eggs' in package 'foo'

# Dependency violations

...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by locating the current privacy-offense formatting and RuboCop-compatible reporting path, then compare its output with the proposed grouped format; done means related offenses are reported concisely while retaining their file locations and references.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.