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 Report

Merging #337 (ecab9c7) into master (37d78d7) will increase coverage by 0.30%.
The diff coverage is 90.00%.

@@             Coverage Diff              @@
##             master     #337      +/-   ##
============================================
+ Coverage     86.78%   87.09%   +0.30%     
  Complexity      371      371              
============================================
  Files            33       32       -1     
  Lines          1415     1410       -5     
  Branches        165      164       -1     
============================================
  Hits           1228     1228              
+ Misses          117      113       -4     
+ Partials         70       69       -1     
Impacted Files Coverage Δ
tracker/src/main/java/org/matomo/sdk/Matomo.java 86.84% <ø> (ø)
...r/src/main/java/org/matomo/sdk/TrackerBuilder.java 79.31% <ø> (ø)
...java/org/matomo/sdk/dispatcher/EventDiskCache.java 73.07% <0.00%> (ø)
...ain/java/org/matomo/sdk/extra/CustomVariables.java 94.87% <ø> (ø)
...a/org/matomo/sdk/extra/MatomoExceptionHandler.java 83.33% <ø> (ø)
...main/java/org/matomo/sdk/LegacySettingsPorter.java 100.00% <100.00%> (ø)
tracker/src/main/java/org/matomo/sdk/TrackMe.java 100.00% <100.00%> (ø)
...org/matomo/sdk/dispatcher/DefaultPacketSender.java 68.57% <100.00%> (+0.51%) ⬆️
...ain/java/org/matomo/sdk/extra/DownloadTracker.java 75.00% <100.00%> (+2.02%) ⬆️
...r/src/main/java/org/matomo/sdk/tools/Checksum.java 95.45% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37d78d7...ecab9c7. Read the comment docs.

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.

None yet

3 participants