Skip to content

Automatically format code after codegen and validate with a github action#4468

Merged
jlerbsc merged 2 commits intojavaparser:masterfrom
johannescoetzee:johannes/verify-style
Jun 12, 2024
Merged

Automatically format code after codegen and validate with a github action#4468
jlerbsc merged 2 commits intojavaparser:masterfrom
johannescoetzee:johannes/verify-style

Conversation

@johannescoetzee
Copy link
Copy Markdown
Collaborator

@johannescoetzee johannescoetzee commented Jun 12, 2024

This is the final PR related to #4408

This PR includes 2 changes:

  • run the code formatter automatically after code generation. This should make it more immediately obvious what changed during codegen without the mandatory manual step of running the formatter
  • add a github action which runs the code generators and formatter and fails if the diff from this is non-empty. This will ensure that nothing in the PR will be overwritten by code generators later on and that everything which needs to be generated was (avoiding a situation where contributors manually implement "generated" methods)

I tested this in johannescoetzee#1. Some of the later commits are missing since I cleaned up the branch for this PR, but the relevant github jobs were:
Working run
https://github.com/johannescoetzee/javaparser/actions/runs/9485459827/job/26137443518?pr=1

Incorrect formatting
https://github.com/johannescoetzee/javaparser/actions/runs/9485678529/job/26138198159?pr=1

Fixed again
https://github.com/johannescoetzee/javaparser/actions/runs/9485811857/job/26138677223?pr=1

Missing generated code
https://github.com/johannescoetzee/javaparser/actions/runs/9485852607/job/26138825304?pr=1

We could potentially remove the checkstyle job, but I'm not sure whether that checks anything not covered by spotless. I'll do a bit of research on that.

@jlerbsc
Copy link
Copy Markdown
Collaborator

jlerbsc commented Jun 12, 2024

I'm not a specialist in github shares, but it looks fine to me. Thanks for the work.

@jlerbsc jlerbsc merged commit 19afecc into javaparser:master Jun 12, 2024
@jlerbsc jlerbsc added this to the next release milestone Jun 12, 2024
@jlerbsc jlerbsc added the PR: Development A PR that affects only JavaParser developers (e.g. build / deploy infrastructure) label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Development A PR that affects only JavaParser developers (e.g. build / deploy infrastructure)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants