Skip to content

Use glob patterns compatible with Packwerk and engines #1476

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

Merged
merged 1 commit into from
May 17, 2025

Conversation

tdeo
Copy link
Contributor

@tdeo tdeo commented May 5, 2025

Replace this text with a summary of the changes in your PR.
The more detailed you are, the better.

Update glob patterns used in this repo to be compatible with Engine or Packwerk usage. Fixes #234


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

@tdeo tdeo force-pushed the packwerk_globs branch from 870ec5f to abfeb13 Compare May 5, 2025 10:39
@tdeo tdeo marked this pull request as ready for review May 5, 2025 10:39
@@ -0,0 +1 @@
* [#234](https://github.com/rubocop/rubocop-rails/issues/234): Use packwerk-compatible globs. ([@tdeo][])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add a note about Engine? e.g.,

Suggested change
* [#234](https://github.com/rubocop/rubocop-rails/issues/234): Use packwerk-compatible globs. ([@tdeo][])
* [#234](https://github.com/rubocop/rubocop-rails/issues/234): Use globs that are compatible with Engine or Packwerk. ([@tdeo][])

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you start the filename with change_ instead of new_?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did fix those 2 things

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no new changelog file, so it may not have been added with git add.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for missing that 🤦

@tdeo tdeo force-pushed the packwerk_globs branch from abfeb13 to 135e6aa Compare May 6, 2025 07:16
@tdeo tdeo changed the title Use packwerk-compatible globs Use glob patterns compatible with Packwerk and engines May 6, 2025
@tdeo tdeo force-pushed the packwerk_globs branch 2 times, most recently from 04a7636 to caae7b2 Compare May 12, 2025 11:07
@tdeo tdeo force-pushed the packwerk_globs branch from caae7b2 to 1126d68 Compare May 12, 2025 11:08
@tdeo
Copy link
Contributor Author

tdeo commented May 12, 2025

@koic I believe this should now be ready

@tdeo tdeo requested a review from koic May 13, 2025 21:42
@koic koic merged commit d848db1 into rubocop:master May 17, 2025
16 checks passed
@koic
Copy link
Member

koic commented May 17, 2025

Thanks!

@s2-cdd
Copy link

s2-cdd commented May 19, 2025

Hello, I've noticed some additional rubocop rules applying to files because of this change. The glob pattern applies when a parent folder is named app that contains a rails project: app/rails_project_name/app/

For example I get these errors in spec/rails_helper (the full path name would be app/rails_project_name/spec/rails_helper.rb)

spec/rails_helper.rb:7:3: C: [Correctable] Rails/Output: Do not write to stdout. Use Rails's logger if you want to log.
spec/rails_helper.rb:8:3: C: Rails/Exit: Do not use exit in Rails applications.

By renaming that base folder (which is not part of the rails project), they are excluded again. However, for my current project I can't rename that folder. Is this pattern matching intentional? If so, is there a way to avoid this?

@tdeo tdeo deleted the packwerk_globs branch May 20, 2025 08:27
@tdeo
Copy link
Contributor Author

tdeo commented May 20, 2025

Hi @s2-cdd I hadn't anticipated that rubocop would compare paths going above project root, I'll try to have a deeper look at why that happens

@Aqualon
Copy link

Aqualon commented Jul 22, 2025

@tdeo could you figure anything out about this?

@koic I wonder if this PR should stay in the gem as is or it disturbs others using docker or running rubocop on CI (see #1487) more than it benefits the people that use engines/packwerk?

@tdeo
Copy link
Contributor Author

tdeo commented Jul 22, 2025

@Aqualon I joined the conversation in #1487 so that we keep everything in one place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable non-default locations of checked files
4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy