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

increase severity of multiple errorprone checks #6800

Merged
merged 3 commits into from May 12, 2023

Conversation

XN137
Copy link
Contributor

@XN137 XN137 commented May 11, 2023

note that we fix DifferentNameButSame with a minimal diff, but
not make it uniform across all files

@XN137 XN137 force-pushed the more-errorprone-errors branch 7 times, most recently from f121915 to 09c1871 Compare May 11, 2023 12:18
@snazy
Copy link
Member

snazy commented May 11, 2023

Running ./gradlew compileAll locally could be more efficient than force-pushing?

note that we fix DifferentNameButSame with a minimal diff, but
not make it uniform across all files
@XN137 XN137 marked this pull request as ready for review May 11, 2023 13:41
@@ -51,7 +50,7 @@ public Status status() {

public abstract String filePath();

public abstract StructType partitionType();
public abstract Types.StructType partitionType();
Copy link
Member

Choose a reason for hiding this comment

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

Why do we sometimes import the inner class name, and sometime qualify it with its parent class name?

In this particular case, the inner class name seems to be non-ambiguous, so why do we change it to be qualified by the parent type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as stated in the PR description we resolve DifferentNameButSame violations by doing the minimal amount of changes... so this file uses more Types.StructType than StructType right now, we we prefer to use the former for the fix.

if we can come up with a uniform convention on how to handle these things, we can also apply that kind of fix.

imo the first step is making things uniform on a per file basis, wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

IMHO, shorter type references (i.e. importing the most specific name possible) are preferable over smaller PR diff.

I'm open to other opinions too.

Copy link
Member

Choose a reason for hiding this comment

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

I prefer shorter names as well, as long as they're not "common" names (there's already an errorprone check for common names like Builder).

@@ -1440,7 +1439,8 @@ public void fetchEntriesByNamelessReference() throws BaseNessieClientServerExcep
.operation(Put.of(b, tb))
.commitMeta(CommitMeta.fromMessage("commit 1"))
.commit();
List<Entry> entries = api().getEntries().hashOnRef(branch.getHash()).get().getEntries();
List<EntriesResponse.Entry> entries =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is Entry too generic same as Builder i would have guessed yes, so using the more qualified name

Copy link
Member

Choose a reason for hiding this comment

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

In the context of Nessie API (implied by this class), I think Entry has a specific meaning. I'd prefer keeping the import for it.

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned, errorprone's BadImport rule applies.

@@ -34,14 +34,13 @@
import org.projectnessie.versioned.persist.adapter.RefLog;
import org.projectnessie.versioned.persist.adapter.RepoDescription;
import org.projectnessie.versioned.persist.serialize.AdapterTypes;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

all types in this file go through AdapterTypes it feels wrong to use the shorter variant only for RepoProps

Copy link
Member

Choose a reason for hiding this comment

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

SGTM

@@ -1673,7 +1672,7 @@ private RefLogEntry writeRefLogEntry(
NamedRef ref,
RefLogHead refLogHead,
Hash commitHash,
Operation operation,
RefLogEntry.Operation operation,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should we prefer Operation in this file instead?

Copy link
Member

Choose a reason for hiding this comment

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

I think in this particular case using the longer name is justified to identify this as belonging to the deprecated ref log functionality.

Copy link
Member

@dimas-b dimas-b left a comment

Choose a reason for hiding this comment

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

LGTM, if @snazy is ok with these changes. Thanks for you effort, @XN137! :)

@XN137 XN137 merged commit 46a3d76 into projectnessie:main May 12, 2023
24 checks passed
@XN137 XN137 deleted the more-errorprone-errors branch May 12, 2023 19:04
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.

None yet

3 participants