Skip to content

Add step to forbid module imports#2690

Merged
nedtwigg merged 6 commits into
diffplug:mainfrom
Plunts:forbidModuleImports
Nov 18, 2025
Merged

Add step to forbid module imports#2690
nedtwigg merged 6 commits into
diffplug:mainfrom
Plunts:forbidModuleImports

Conversation

@Plunts

@Plunts Plunts commented Oct 18, 2025

Copy link
Copy Markdown
Contributor

As per #2679, I added a formatter to forbid module imports.

@Pankraz76 Pankraz76 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice feature thanks.

Might include this documentation fixup as well. Should consider to automate this by an annotation or something @nedtwigg, this is kind of easy to oversee (error-prone).

@Plunts

Plunts commented Oct 18, 2025

Copy link
Copy Markdown
Contributor Author

If you want to fix other things: the test-case for forbidWildcardImports is still called removeWildCardImports 😉 Just say a word and I'll change it together with the documentation, I just wasn't sure how clean you like your PRs 😀

@Pankraz76

Copy link
Copy Markdown

thanks for update and kind offer, for me both fine, it seems tiny.

Let ned or someone else make the call, my opinion obsolete.

@nedtwigg

Copy link
Copy Markdown
Member

the test-case for forbidWildcardImports is still called removeWildCardImports

it would be great to fix that in this PR also, thanks for the offer! An update to the README would be great too.

One smell here is that this is a very small change but our standard protocols make it require a ton of code churn. I'm happy to merge this one, but I don't want to merge a ton of forbidXXX steps that are just verbose wrappers around the forbidRegex step. It's a smell that we need some kind of system for adding a registry of forbidXXX regexes, perhaps even just a central COMMON_REGEX.md where people can share regexes they have found useful in their codebases.

@Pankraz76

Pankraz76 commented Nov 1, 2025

Copy link
Copy Markdown

@nedtwigg

nedtwigg commented Nov 2, 2025

Copy link
Copy Markdown
Member

@claude merge main, and then run ./gradlew rewriteRun. Try to fix any issues, commit and push.

@nedtwigg

nedtwigg commented Nov 3, 2025

Copy link
Copy Markdown
Member

@claude merge main, and then run ./gradlew rewriteRun. Try to fix any issues, commit and push.

@nedtwigg nedtwigg merged commit 57eb3d5 into diffplug:main Nov 18, 2025
20 checks passed
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.

3 participants