Skip to content

Conversation

@Anmol202005
Copy link
Collaborator

Fixes: #25

Added header recipe: Adds headers to Java source files when missing.

@romani
Copy link
Member

romani commented Jul 3, 2025

Please put reference to issue to commit message .
Please always do it.

@Anmol202005 Anmol202005 force-pushed the header branch 3 times, most recently from 2f41b01 to 7d777e3 Compare July 4, 2025 22:28
@Anmol202005
Copy link
Collaborator Author

@rdiachenko kindly review.

@rdiachenko rdiachenko self-assigned this Jul 5, 2025
Copy link
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

@Anmol202005 its a lot of issues here becuase you mixed different logic. Please split this PR into the following:

  1. PR for header recipe implementation only, no integration with config and parent recipe
  2. PR for loading checkstyle config given config file uri
  3. PR for using header recipe with config

Please prioritise smaller PRs with independet changes rather than putting everything into one PR to minimise review time and iteration

@Anmol202005
Copy link
Collaborator Author

@rdiachenko
Done.
This PR now deals with header recipe implementation only.

@rdiachenko
Copy link
Member

@Anmol202005 the check has fileExtensions and in this recipe we only fix java files. We can't fix all files that OpenRewrite can't parse, could you check this? If yes, we should mark this recipe as "partially covered" in the readme

@Anmol202005 Anmol202005 force-pushed the header branch 2 times, most recently from 6368840 to e090327 Compare July 6, 2025 14:58
@Anmol202005
Copy link
Collaborator Author

@rdiachenko kindly review :)

Comment on lines +39 to +42
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
import com.puppycrawl.tools.checkstyle.api.Configuration;
Copy link
Member

Choose a reason for hiding this comment

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

I think we should replace these Checkstyle specific objects with our own like we did with CheckstyleViolation. This will help to avoid Checkstyle dependencies to be spread all around the recipes and have control over needed fields. To not overcomplicate this PR, I'm ok to fix it as part of the PR, which introduces configuration. @Anmol202005 please make a note in the issue to address this point

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done. updated issue: #36

@Anmol202005
Copy link
Collaborator Author

@rdiachenko done.

@Anmol202005
Copy link
Collaborator Author

Anmol202005 commented Jul 7, 2025

@rdiachenko done.

@Anmol202005
Copy link
Collaborator Author

@rdiachenko Done.

Copy link
Collaborator

@timurt timurt left a comment

Choose a reason for hiding this comment

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

LGTM @Anmol202005 thanks for your work!

Copy link
Member

@rdiachenko rdiachenko left a comment

Choose a reason for hiding this comment

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

This PR is not ideal but already took a lot of time and effort.

Ok to merge after this comment got responed #35 (comment)

@rdiachenko rdiachenko merged commit 5660708 into checkstyle:main Jul 17, 2025
3 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.

Implement recipe for HeaderCheck

4 participants