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 static analysis gradle plugins (spotless + palantir, errorprone + nullaway) #2

Merged
merged 6 commits into from
Oct 21, 2024

Conversation

NathanQingyangXu
Copy link
Contributor

https://jira.mongodb.org/browse/HIBERNATE-5

The following static analysis gradle plugins are integrated:

  1. code style checking: spotless (including palantir component for Java language)
  2. code quality checking: errorprone (including nullaway as a component)

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
copyright.txt Outdated Show resolved Hide resolved
build.gradle.kts Outdated Show resolved Hide resolved
1. update .editorconfig to align with palantir
2. remove usage of jspecify (mongo's nullness annotations suffice)
3. remove unnecessary comments
@jyemin
Copy link
Collaborator

jyemin commented Oct 14, 2024

remove usage of jspecify (mongo's nullness annotations suffice)

I don't think we should do this, as the driver's null-related annotations are not intended to be part of the driver API. They are just an implementation detail.

@NathanQingyangXu
Copy link
Contributor Author

remove usage of jspecify (mongo's nullness annotations suffice)

I don't think we should do this, as the driver's null-related annotations are not intended to be part of the driver API. They are just an implementation detail.

reverted back

@jyemin jyemin requested a review from rozza October 18, 2024 17:58
Copy link
Collaborator

@jyemin jyemin left a comment

Choose a reason for hiding this comment

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

LGTM, but added @rozza for a second set of eyes

Copy link
Member

@rozza rozza left a comment

Choose a reason for hiding this comment

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

LGTM!

Out of interest was the .editorconfig change a manual change or automatic based on the formatting plugins?

@@ -29,6 +33,11 @@ dependencies {
testImplementation(libs.junit.jupiter)

testRuntimeOnly("org.junit.platform:junit-platform-launcher")

errorprone(libs.nullaway)
api(libs.jspecify)
Copy link
Member

Choose a reason for hiding this comment

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

Even though this is documented as right, it seems wrong to have this as an api dependency - as its really for compile time only. 🤷

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 found the following statement at https://jspecify.dev/docs/using/

Screenshot 2024-10-21 at 9 56 50 AM

So let us stick to api scope for now and always keep it in mind to switch to lower visibility. Currently given almost zero experience on real usage, let us trust the doc. The switch cost should be minor in the future, if needed.

@NathanQingyangXu
Copy link
Contributor Author

NathanQingyangXu commented Oct 21, 2024 via email

@NathanQingyangXu
Copy link
Contributor Author

NathanQingyangXu commented Oct 21, 2024 via email

@NathanQingyangXu NathanQingyangXu merged commit c5a61b7 into main Oct 21, 2024
@NathanQingyangXu NathanQingyangXu deleted the HIBERNATE-5 branch October 21, 2024 14:00
NathanQingyangXu added a commit that referenced this pull request Nov 4, 2024
NathanQingyangXu added a commit to NathanQingyangXu/mongo-hibernate that referenced this pull request Nov 7, 2024
NathanQingyangXu added a commit that referenced this pull request Nov 14, 2024
* implement ConnectionProvider

* change minimal MongoDB version to 6

* Update src/test/resources/hibernate.properties

Co-authored-by: Jeff Yemin <[email protected]>

* remove package-info.java in test folder;
add copyright to package-info.java in main folder

* improve Javadoc for MongoConnectionProvider per review comments

* remove unnecessary codec setting stuff

* simplify the dummy implementation of the three methods irrelevant to our usage

* simplify MongoConnectionProvider per code review comments

* remove exception package and move ConfigurationException to cfg package

* add missing Javadocs for MongoDialect

* add MQL acronym expansion in Javadoc

* round #2 code review comments

* change mininum mongodb version to v6.3

* use HibernateException instead of ConfigurationException.java

* switch MongoDialect minimum db version to 6.0

* Update src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java

Co-authored-by: Jeff Yemin <[email protected]>

* deleted unused constructors in MongoDialect

* add Javadoc for the root package-info.java

* make more exception messages begin with uppercase

* update various gradle plugin to latest versions

* add sl4j logging dependencies and logback-test.xml config

* fix a static check issue

* change default constructor of MongoDialect to end up with null value; override getMinimumSupportedVersion()

* some minor improvements

* change as per Valentin's excellent code review comments

* update SessionFactoryTests as per code review comments

* update MongoDialect as per code review comments

* update MongoConnectionProvider as per code review comments

* delete .editorconfig file and move it to another separate PR

* fix a static check style issue

* resolve some code review comments

* fix style checking issue

* minor changes to improve Dialect min version usage

* improve mentioning of MongoDB Java Driver in MongoDialect's Javadoc

* add transient keyword to MongoClient in MongoConnectionProvider

* Update src/main/java/com/mongodb/hibernate/jdbc/MongoConnectionProvider.java

Co-authored-by: Valentin Kovalenko <[email protected]>

* change as per code review comments

* remove database checking logic

* fix import style issue

* change per some code review comments

* add missing 'compileJava' gradle task in evergreen's static-check.sh

---------

Co-authored-by: Jeff Yemin <[email protected]>
Co-authored-by: Valentin Kovalenko <[email protected]>
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.

3 participants