apache / jmeter

Apache JMeter open-source load testing tool for analyzing and measuring the performance of a variety of services
https://jmeter.apache.org/
Apache License 2.0
8.08k stars 2.05k forks source link

CI: Add Auto-Format GitHub Actions for Java files #6161

Closed SaptarshiSarkar12 closed 7 months ago

SaptarshiSarkar12 commented 7 months ago

Use case

This project has a code style available in the config/checkstyle directory. Checking whether the code in the Pull Requests or branches follows the project's code style and applying fixes accordingly is a tedious work.

Possible solution

A GitHub Action can be set up to check for checkstyle violations and automatically format those files according to the checkstyle configuration. The changes will be automatically pushed to the branch and PR's source branch. I would like to work on this issue.

Possible workarounds

No response

JMeter Version

5.6.1

Java Version

java 20.0.2 2023-07-18

OS Version

Ubuntu 23.10

vlsi commented 7 months ago

"Checkstyle" is already configured, and I suggest we do not increase its verifications as Checkstyle produces hard to understand failure messages.

Do you think you could try integrating Openrewrite? See https://github.com/pgjdbc/pgjdbc/pull/2979

vlsi commented 7 months ago

We use Autostyle for some of the automatic fixes: https://github.com/autostyle/autostyle

SaptarshiSarkar12 commented 7 months ago

@vlsi Yes, I just learned how to integrate Openrewrite in my Open-Source Java project - Drifty and it is very good at its work. You can see that the last commit to that repo is about the Java files being formatted. image I will do two things -

So, can I work on this issue?

vlsi commented 7 months ago

I'm -0.5 for pushing formats from GitHub Actions. I am afraid it would violate the Apache Software Foundation rules. I would rather start with making PRs fail if there are unformatted changes. WDYT?

SaptarshiSarkar12 commented 7 months ago

@vlsi I am not sure if it would violate Apache Software Foundation Rules. But, automating the formatting of files is just saving time a bit - which I think helps developers to concentrate more on the logic and also helps in faster review. It also gives a great experience for other contributors - they don't have to check for failure in code style themselves (let's think if there are huge changes made and multiple checkstyle violations have occurred).

vlsi commented 7 months ago

I am not sure if it would violate Apache Software Foundation Rules.

@SaptarshiSarkar12 , please show us the relevant issue at https://issues.apache.org/jira/browse/LEGAL or https://lists.apache.org/list.html?legal-discuss@apache.org that concludes that "robots are fine to commit formatting changes to the main branches". Otherwise, I am not going to discuss and merge such an Action.

SaptarshiSarkar12 commented 7 months ago

@vlsi Sorry, I couldn't find any relevant issue. Might be because it is a rule. I am closing this issue then.

SaptarshiSarkar12 commented 7 months ago

@vlsi I have one question. Does Apache v2 license explicitly specify any such rules?

vlsi commented 7 months ago

Apache 2 license does not forbid that. However, there are certain rules within the Apache Software Foundation.

You might raise an issue at LEGAL or start a discussion to get clarification. However, I doubt they would allow such bots.

SaptarshiSarkar12 commented 7 months ago

@vlsi Okay. I understood. No, its fine - Apache can make rules. No problem in that. I just wanted to know if apache license mentions any kind of this statement as it is used by my project :sweat_smile:.