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

Remove lint warnings #337

Merged
merged 1 commit into from
Jul 11, 2022
Merged

Remove lint warnings #337

merged 1 commit into from
Jul 11, 2022

Conversation

hannesa2
Copy link
Collaborator

I followed the suggestion from lint

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2022

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 87.07%. Comparing base (9b18315) to head (c972329).
Report is 250 commits behind head on master.

Files with missing lines Patch % Lines
...java/org/matomo/sdk/dispatcher/EventDiskCache.java 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #337      +/-   ##
============================================
+ Coverage     86.78%   87.07%   +0.28%     
- Complexity      371      372       +1     
============================================
  Files            33       32       -1     
  Lines          1415     1408       -7     
  Branches        165      164       -1     
============================================
- Hits           1228     1226       -2     
+ Misses          117      114       -3     
+ Partials         70       68       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@d4rken d4rken left a comment

Choose a reason for hiding this comment

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

Some of the changes affect the public API that devs might be using (see comment), the rest looks good, thanks for the cleanup 👍

@@ -30,9 +30,8 @@ public TrackMe(TrackMe trackMe) {
/**
* Adds TrackMe to this TrackMe, overriding values if necessary.
*/
public TrackMe putAll(@NonNull TrackMe trackMe) {
public void putAll(@NonNull TrackMe trackMe) {
Copy link
Member

Choose a reason for hiding this comment

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

This changes the public API.
It returns itself so devs can chain calls.
e.g. TrackMe().putAll(...).trySet(...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fine, but the sample is anyhow to outdated and too simple #338

Copy link
Member

Choose a reason for hiding this comment

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

Do you mean extending the sample app so the linter no longer marks this as unused?

I don't think the sample app has to include all and every API call the SDK has, I'm not opposed to anyone making the sample app better either 😄)

We just have to be a bit careful with refactoring.
The linter doesn't know it's an SDK and code is used outside the project 😁

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I as a customer will only use stuff I find in sample app. It's just a note.

The linter doesn't know it's an SDK and code is used outside the project

yes, maybe annotate it with "ignore warning" is a way to go

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Till now, I ignored my wish to kotlize it.
Kotlin has some wonderful mechanism for a sdk, e.g internal

*/
public synchronized TrackMe trySet(@NonNull QueryParams key, int value) {
return trySet(key, String.valueOf(value));
public synchronized void trySet(@NonNull QueryParams key, int value) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API, see above.

*/
public synchronized TrackMe trySet(@NonNull QueryParams key, float value) {
return trySet(key, String.valueOf(value));
public synchronized void trySet(@NonNull QueryParams key, float value) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API, see above.

}

public synchronized TrackMe trySet(@NonNull QueryParams key, long value) {
return trySet(key, String.valueOf(value));
public synchronized void trySet(@NonNull QueryParams key, long value) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API, see above.

*/
public synchronized TrackMe trySet(@NonNull QueryParams key, String value) {
public synchronized void trySet(@NonNull QueryParams key, String value) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API, see above.

@@ -43,9 +43,8 @@ public int getSiteId() {
/**
* A unique name for this Tracker. Used to store Tracker settings independent of URL and id changes.
*/
public TrackerBuilder setTrackerName(String name) {
public void setTrackerName(String name) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API (chaining calls on a builder object Builder().doA().doB()

@@ -58,9 +57,8 @@ public String getTrackerName() {
*
* @param domain your-domain.com
*/
public TrackerBuilder setApplicationBaseUrl(String domain) {
public void setApplicationBaseUrl(String domain) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API

@@ -70,9 +70,8 @@ public CustomVariables(@Nullable String json) {
}
}

public CustomVariables putAll(CustomVariables customVariables) {
public void putAll(CustomVariables customVariables) {
Copy link
Member

Choose a reason for hiding this comment

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

Changes public API

Comment on lines 94 to 96
abstract class Custom implements Extra {
}

Copy link
Member

Choose a reason for hiding this comment

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

I agree, this is kind of superfluos, but it's part of the public API and some devs might have extended this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Keeping this unused stuff is a kind of collect a lot waste in your base ground.

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 remove it, but then with a major version bump and a little note about migration in the changelog (e.g. don't extend Custom, just implement Extra).

@hannesa2 hannesa2 force-pushed the LintWarnings branch 2 times, most recently from 8b21ffa to c972329 Compare July 11, 2022 09:27
Copy link
Member

@d4rken d4rken left a comment

Choose a reason for hiding this comment

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

Thank you!

@d4rken
Copy link
Member

d4rken commented Jul 11, 2022

Till now, I ignored my wish to kotlize it.
Kotlin has some wonderful mechanism for a sdk, e.g internal

You could do a Kotlin rewrite if you want :).
Would probably looks very nice.
Requires a major version bump and some taking care that the APIs do not totally break for people using this with Java still.

@d4rken d4rken merged commit a36429f into master Jul 11, 2022
@d4rken d4rken deleted the LintWarnings branch July 11, 2022 12:17
@hannesa2
Copy link
Collaborator Author

Nice, we come closer
image

@hannesa2
Copy link
Collaborator Author

Would probably looks very nice.
Requires a major version bump and some taking care that the APIs do not totally break for people using this with Java still.

In an ideal world, the api is done by interfaces and anything behind will be done internal. As long as you don't change the interface you can convert without any doubt what you want.

This keeping unused classes because someone could use it, is an afford without benefit.

@hannesa2
Copy link
Collaborator Author

But this interface way isn't done

image

@d4rken
Copy link
Member

d4rken commented Jul 11, 2022

This keeping unused classes because someone could use it, is an afford without benefit.

Why do you keep coming back to this? 😄
I know it's not great, I probably just forgot about that class. I had no one to review my code.
It's out there now and we shouldn't break the users app "just because it's not clean".
Sorry for not writing the perfect SDK? 🤔

But this interface way isn't done

Not everything needs to be a firebase-level SDK with shovels of abstraction.
This is volunteer work and the SDK worked fine for my use-cases, so at that time: Why make things more complicated if there is no requirement?
A rewrite to Kotlin wasn't on the horizon at that point.

Interfaces can still be introduced now if desired. As said, you can make a v5, with everything new and better if you want to 👍.

@hannesa2
Copy link
Collaborator Author

Sorry, those were just a few thoughts on the Kotlin transformation.
You are right, house holding of our time is also important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants