ktee icon indicating copy to clipboard operation
ktee copied to clipboard

No-Op Implementation

Open rtsketo opened this issue 5 years ago • 9 comments

Edit:

With this PR, two artifacts will be published, ktee and ktee-noop. As the name suggests, ktee-noop has no internal functionality and it can be used in production environment with no overhead.

~~With this PR, the user can enable or disable logging and printing by setting KTee.debug variable true or false.~~

~~This can be automated depending your build, for example in Android the user can set the variable as KTee.debug = BuildConfig.DEBUG at the start of his app.~~

~~By default is set to true.~~

PS. I think this was suggested by someone in Reddit.

rtsketo avatar Jul 13 '20 14:07 rtsketo

Fixed the second issue.

rtsketo avatar Jul 16 '20 21:07 rtsketo

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Jul 16 '20 21:07 sonarqubecloud[bot]

Can we look at alternative like a No-Op interface just like slf4j. That way dependency can be swapped at build/compile time without having to change code. in no-op impl all the methods essentially do not output anything. We can produce two artifacts ktee and ktee-noop?

kdabir avatar Jul 21 '20 17:07 kdabir

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Dec 15 '21 21:12 sonarqubecloud[bot]

@kdabir, coming from the "Android world" where build types and flavors are a thing in Gradle, I can't be so sure I implemented the No-Op artifact publication in the best way possible. Please, let me know if there's something that can be improved.

rtsketo avatar Dec 15 '21 21:12 rtsketo

apologies for the delay in responding. The changes are looking good. For no-op project, we could go with a multi-module approach rather than additional source set. However, I don't necessarily see problem with current approach too. Let me review this and provide more specific feedback. Thanks for incorporating the feedback.

kdabir avatar Jun 06 '22 12:06 kdabir

Of course, I'm up for giving a try to any better solution. Could you please give me more info on how to approach a multi-module solution and what are the advantages compared to the current?

rtsketo avatar Jul 03 '22 06:07 rtsketo

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Nov 19 '22 15:11 sonarqubecloud[bot]

If someone is looking for this feature, I released a modified version here. Using a noop implementation in production does make reverse engineering slightly harder, thus I recommend it unconditionally in any non server-side code.

rtsketo avatar Nov 19 '22 15:11 rtsketo