Skip to content

Conversation

@jiangzho
Copy link
Contributor

@jiangzho jiangzho commented Apr 21, 2024

What changes were proposed in this pull request?

This is a breakdown PR from #2 - setting up common build Java tasks and corresponding plugins.

Why are the changes needed?

This PR includes checkstyle, pmd, spotbugs. Also includes jacoco for coverage analysis, spotless for formatting. These tasks can help to enhance the quality of future Java contributions. They can also be referred in CI tasks for automation.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Tested manually.

Was this patch authored or co-authored using generative AI tooling?

no

build.gradle Outdated
}
}

assert JavaVersion.current().isJava11Compatible(): "Java 11 or newer is required"
Copy link
Member

Choose a reason for hiding this comment

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

Please enforce Java 17 or newer

build.gradle Outdated
endWithNewline()
googleJavaFormat('1.17.0')
importOrder(
'java',
Copy link
Member

Choose a reason for hiding this comment

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

indentation?

-->

<module name="Checker">
Copy link
Member

Choose a reason for hiding this comment

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

This is a copy of the following, isn't it? May I ask what is the difference and why you change that, @jiangzho ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is taken from Spark repo. The major difference is to

  • Remove checkstyle-suppressions.xml as there's no expected SuppressionFilter expected for this repository yet.
  • Style difference for line length / indent .etc

-->

<module name="Checker">
<property name="charset" value="UTF-8"/>
Copy link
Member

Choose a reason for hiding this comment

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

Although I know that this 4-space indentation inherits from Apache Spark's file, shall we use 2-space indentation because this is a new repository?

# See the License for the specific language governing permissions and
# limitations under the License.
#
#
Copy link
Member

Choose a reason for hiding this comment

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

Shall we remove this line?

checkstyleVersion=10.15.0
pmdVersion=6.55.0
spotBugsGradlePluginVersion=6.0.12
spotBugsVersion=4.8.3
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 make it sure that this PR proposes all latest versions? If there is non-latest versions, could you explain the reason?

-->

<ruleset name="pmd ruleset">
<description>
Copy link
Member

Choose a reason for hiding this comment

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

ditto. Please use 2-space indentation.

build.gradle Outdated
configurations.all {
resolutionStrategy {
force "org.slf4j:slf4j-api:$slf4jVersion"
force "io.fabric8:kubernetes-model-core:$fabric8Version"
Copy link
Member

Choose a reason for hiding this comment

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

I believe these two lines are irrelevant to Static Analysis. Please remove the irrelevant ones.

config.stopBubbling = true
lombok.addLombokGeneratedAnnotation = true
lombok.extern.findbugs.addSuppressFBWarnings = true
lombok.anyConstructor.addConstructorProperties = true
Copy link
Member

Choose a reason for hiding this comment

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

  1. This file doesn't have ASF License.
  2. Can we eliminate this Lombok dependency completely?

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

I review the first round review.

  • Please address the review comments.
  • Please respect the Apache Spark PR template like the following.

@jiangzho
Copy link
Contributor Author

Thanks @dongjoon-hyun for the review!

yes, we target latest versions as possible

Checkstyle latest 10.15.0
pmd latest 7.0.0 - it's a major version released on Mar 22, 2024, with another minor version 7.1.0 expected on Apr 26. Thus we started with latest released 6.x version in this PR while evaluating v7.
Spotbugs plugin latest version 6.0.12
spotbugs latest version 4.8.4
Spotless plugin latest version 6.25.0

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-47929]Setup Static Analysis for Operator [SPARK-47929] Setup Static Analysis for Operator Apr 23, 2024
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you, @jiangzho .
Merged to main.

@dongjoon-hyun dongjoon-hyun mentioned this pull request Apr 23, 2024
@jiangzho jiangzho deleted the builder_task branch July 23, 2024 23:05
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.

2 participants