Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,20 @@
<error-prone.version>2.24.0</error-prone.version>
<error-prone-support.version>0.14.0</error-prone-support.version>
<doxia.version>1.12.0</doxia.version>
<error-prone.configuration-args>
<!-- Reason at https://github.com/checkstyle/checkstyle/issues/8252. -->
-Xep:JUnitClassModifiers:OFF
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-Xep:JUnitClassModifiers:OFF
<!-- until https://github.com/checkstyle/checkstyle/issues/8252 -->
-Xep:JUnitClassModifiers:OFF

Copy link
Member

Choose a reason for hiding this comment

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

We need to close this issue, we are not going to follow this style for now, may be in future we will, but I don't see much reason.

Copy link
Member

Choose a reason for hiding this comment

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

Issue is closed.
Please make comment <!-- reason at https://github.com/checkstyle/checkstyle/issues/8252 -->

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to close this issue, we are not going to follow this style for now, may be in future we will, but I don't see much reason.

Reasoning is sound: we do not want to allow/encourage sharing of test methods across test classes.

Copy link
Member

Choose a reason for hiding this comment

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

Changing visibility does not protect again reuse, we are open for any reuse of public method, usually it is nonsense and not possible to have any reason.

<!-- Reason at https://github.com/checkstyle/checkstyle/issues/8252. -->
-Xep:JUnitMethodDeclaration:OFF
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-Xep:JUnitMethodDeclaration:OFF
<!-- until https://github.com/checkstyle/checkstyle/issues/8252 -->
-Xep:JUnitMethodDeclaration:OFF

<!-- We prefer different style of writing tests. -->
-Xep:JUnitValueSource:OFF
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not activate this pattern?

Copy link
Member

Choose a reason for hiding this comment

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

https://error-prone.picnic.tech/bugpatterns/JUnitValueSource/

We do not use this pattern of test design, we eliminating all tests that are unit tests, we do all tests by full checkstyle execution.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I added: <!-- We prefer different style of writing tests. -->.

Let me know if you prefer something else.

A quick search showed me that in the project there are only 2 parameterized tests, both use @ValueSource.

<!-- Until https://github.com/checkstyle/checkstyle/issues/14194. -->
-Xep:LexicographicalAnnotationListing:OFF
Copy link
Member

Choose a reason for hiding this comment

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

in issue I see

please activate:
LexicographicalAnnotationAttributeListing

please share a reason.

Copy link
Contributor Author

@rickie rickie Dec 27, 2023

Choose a reason for hiding this comment

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

You are correct. Note the slight difference, we want to enable LexicographicalAnnotationAttributeListing, but here I disabled the LexicographicalAnnotationListing. That check simply sorts annotations lexicographically, which is not that desirable in most cases.

Copy link
Member

Choose a reason for hiding this comment

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

@rnveach , @nrmancuso , do we want to try sorting of annotations?
I do think we have much of them, 1-2 is max on method I think

Copy link
Member

Choose a reason for hiding this comment

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

We can disable it for now, and enable it in separate PR.
This is not a blocker to merge this PR

Copy link
Member

Choose a reason for hiding this comment

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

When we introduce new tools, we usually suppress all one by one , explicitly and in next PRs, enable one by one.

Copy link
Member

@romani romani Dec 27, 2023

Choose a reason for hiding this comment

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

In next PRs we can reuse https://github.com/checkstyle/checkstyle/tree/master/config/error-prone-suppressions to activate rule and simply put all/controversial violations to suppression and deal with them separately. At least nobody will merge a code to introduce more violations, there are a lot concurrent PRs now.

I just try to share a way to move quick and not be blocked by complicated cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

As for annotation sorting, I prefer to have simple @Blah above all annotations like @Blah(value={x, y, x}), I do not care so much about lexicographical order.

Copy link
Member

Choose a reason for hiding this comment

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

Ordering usually becomes matter, if there are numerous annotations.

@nrmancuso , do you mean you like piramid style of annotations? The most parametrized the bottom

Copy link
Contributor

Choose a reason for hiding this comment

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

"Pyramid"

Yes! This is a good way to describe it. I feel like the basic @Blah annotations sort of get lost, especially in Spring Boot applications.

Copy link
Member

@romani romani Dec 27, 2023

Choose a reason for hiding this comment

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

Ok, good to know, but this discussion should not block this PR, please review PR to let us unleash disablement of some rules. We can reconsider disablement in separate PR.

Piramid annotation check sound like good idea to discuss in separate issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-Xep:LexicographicalAnnotationListing:OFF
<!-- until https://github.com/checkstyle/checkstyle/issues/14194 -->
-Xep:LexicographicalAnnotationListing:OFF

<!-- This check is not finalized. -->
-Xep:MethodReferenceUsage:OFF
Copy link
Contributor

@nrmancuso nrmancuso Dec 28, 2023

Choose a reason for hiding this comment

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

We shouldn't have many (any?) violations on this one, since we have an IDEA inspection for this, can we activate this pattern?

For reference: https://error-prone.picnic.tech/bugpatterns/MethodReferenceUsage/#methodreferenceusage

Copy link
Member

Choose a reason for hiding this comment

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

If no violations present now, let's activate.
If there are some let's add it to #14137 and we can use comment until https://github.com/checkstyle/checkstyle/issues/14137

I highly recommend to merge basic suppression sooner and deal with all activations in separate PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only problem is that this is the only rule in Error Prone Support that is not ready for use yet. For historical reasons this check is already "available" like this, but it's better for now to disable it. We also disabled it internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now I added this: <!-- This check is not finalized. -->. Is this okay?

<!-- We prefer to qualify all static method calls with class name. -->
-Xep:StaticImport:OFF
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
-Xep:StaticImport:OFF
<!-- we prefer to qualify all static method calls with class name -->
-Xep:StaticImport:OFF

Copy link
Member

@romani romani Dec 28, 2023

Choose a reason for hiding this comment

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

Yes, We do most of code review in phone browsers, no ide, so code must be explicit.

</error-prone.configuration-args>
</properties>

<dependencies>
Expand Down Expand Up @@ -2380,7 +2394,7 @@
<arg>-Xpkginfo:always</arg>
<arg>-XDcompilePolicy=simple</arg>
<arg>
-Xplugin:ErrorProne
-Xplugin:ErrorProne ${error-prone.configuration-args}
</arg>
</compilerArgs>
<annotationProcessorPaths>
Expand Down Expand Up @@ -2438,7 +2452,8 @@
<arg>-XDcompilePolicy=simple</arg>
<arg>
-Xplugin:ErrorProne \
-XepExcludedPaths:.*[\\/]resources[\\/].*
-XepExcludedPaths:.*[\\/]resources[\\/].* \
${error-prone.configuration-args}
</arg>
</compilerArgs>
<annotationProcessorPaths>
Expand All @@ -2451,7 +2466,7 @@
<groupId>tech.picnic.error-prone-support</groupId>
<artifactId>error-prone-contrib</artifactId>
<version>${error-prone-support.version}</version>
</path>b
</path>
</annotationProcessorPaths>
</configuration>
</execution>
Expand Down