Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lint checks #561

Merged
merged 5 commits into from
Mar 25, 2022
Merged

Add lint checks #561

merged 5 commits into from
Mar 25, 2022

Conversation

poovamraj
Copy link
Contributor

Context

We have added Lint checks to ensure consistent coding style across our repository

Changes

  • Made necessary changes to provide consistent code format
  • We have used Google code style with little modifications to suit our style and need
  • We have added avoiding System.out.println as a seperate rule
  • We have made all the changes requested in linter.
  • Any error in this check will throw an error in our CI with details in the console

References

https://checkstyle.sourceforge.io/

Testing

  • Tested whether the failure of Lint check fails the CI
  • Existing test cases pass
  • No change in code, just changes in formatting

@poovamraj poovamraj requested a review from a team as a code owner March 23, 2022 15:58
@poovamraj poovamraj requested a review from panga March 23, 2022 17:54
@poovamraj poovamraj added this to the v4-Beta milestone Mar 23, 2022
@poovamraj poovamraj removed the request for review from panga March 23, 2022 19:06
@poovamraj poovamraj requested a review from panga March 23, 2022 19:18

/**
* Contains the claim name for all Public claims.
*/
public interface PublicClaims {
Copy link

Choose a reason for hiding this comment

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

Any reason for this class to be in the impl (internal package) ?
I see some other classes using public in this package, this is something to consider change in future.
This package should also be removed from module-info (java 9+).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My assumption on this class being internal is to provide less API surface area for the consumer. But as you mentioned having it as public negates the effort and we don't have any other option currently since the package structure is that way.

For Java 9+, if the project is using the module feature, then they won't be able to import this package as it can be seen here - https://github.com/auth0/java-jwt/blob/v4-dev/lib/src/main/java/module-info.java.

Copy link

Choose a reason for hiding this comment

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

The next major version is a big opportunity to remove public from interfaces/classes in impl package.
Module system is under utilized in Java, even if you using latest Java 18 everyone still relying on classloader.
Lets make sure this get reviewed before release, ideally should have none.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree @panga, I have created an internal ticket [SDK-3226] to assigned it to this major. Since @jimmyjames has more context over this library, we should decide on this once he is back.


checkstyle {
toolVersion '10.0'
checkstyleTest.enabled = false //We are disabling lint checks for tests
Copy link

Choose a reason for hiding this comment

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

Why disabling tests? what's the side-effect on enabling there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are disabling this for tests since there 500+ errors in our test code base as well. I thought we could refactor it in a later release. What would be your suggestion?

Copy link

Choose a reason for hiding this comment

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

Makes sense 👍

@poovamraj poovamraj merged commit 75833e6 into v4-dev Mar 25, 2022
@poovamraj poovamraj modified the milestones: v4-Beta, 4.0.0-beta.0 May 6, 2022
@evansims evansims deleted the add-lint-checks branch July 5, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants