-
Notifications
You must be signed in to change notification settings - Fork 101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't testet it yet.
But code looks good so far 👌
// According to https://github.com/googlesamples/android-custom-lint-rules/tree/master/android-studio-3 | ||
// the lint version should match to the used Android Gradle Plugin by the formula "AGP Version X.Y.Z + 23.0.0" | ||
// E.g. "AGP Version 3.1.3 + 23.0.0 = Lint Version 26.1.3" | ||
lintVersion = '26.1.3' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also calculate this by ourselfs, right? 🤔
Just extract the AGP version and "add" the values to 23.0.0 ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can calculate this ourself. But I would prefer to change that still manually:
- It is stated "should" and so the actual version might differ from the formula
- Google recently just decoupled the Support Lib Versions and so it might be that this version gets uncoupled from the build tools version aswell
thirtyinch-lint/README.md
Outdated
@@ -0,0 +1 @@ | |||
# ThirtyInch - Lint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No one of our modules have its own README.
Even if this brings no value I prefer to remove it
thirtyinch-lint/build.gradle
Outdated
compileOnly "com.android.tools.lint:lint-api:$lintVersion" | ||
compileOnly "com.android.tools.lint:lint-checks:$lintVersion" | ||
|
||
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency is already implement as a implementation
dependency.
Because testImplementation
extends implementation
there is no need to declare it again
thirtyinch-lint/build.gradle
Outdated
|
||
sourceCompatibility = 1.6 | ||
|
||
defaultTasks 'assemble' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that really needed? 🤔
I prefer to remove it.
Running gradle without any specific task is not that common...
thirtyinch-lint/build.gradle
Outdated
} | ||
} | ||
|
||
sourceCompatibility = 1.6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this?
"com.pascalwelsch.compositeandroid.fragment.CompositeFragment" | ||
) | ||
|
||
class MissingViewInCompositeDetector : BaseMissingViewDetector() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if it make sense because we wanted to drop the support vor CompositeAndroid anyway, right @passsy?
But as long as it is implemented now and work we could leave it like it is...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, as long it is still present we should support it.
|
||
override fun applicableSuperClasses() = TI_CLASS_NAMES | ||
|
||
override val issue: Issue; get() = ISSUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is here an semicolon?
Should be removed. See also this style guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This semicolon is needed to keep it all in one line. But I removed the getter overriding completely.
companion object { | ||
val ISSUE = MissingView.asLintIssue( | ||
MissingViewInThirtyInchDetector::class.java, | ||
"When using ThirtyInch, a class extending TiActivity, TiFragment or CompositeActivity " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue don't catch the issues for the CompositeActivity.
Please adjust the comment
@StefMa I addressed all your comments. Would be great if you could have another look on this PR. :) |
Hey, sure. |
private const val PROVIDE_VIEW_METHOD = "provideView" | ||
private val TI_CLASS_NAMES = listOf( | ||
"net.grandcentrix.thirtyinch.TiActivity", | ||
"net.grandcentrix.thirtyinch.TiFragment" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a TiDialogFragment
which will not be noticed as issue.
Please add it 👍
What does not work:
No Lint issue will be shown :( |
from(configurations.lintChecks) { | ||
rename { String fileName -> 'lint.jar' } | ||
} | ||
into 'build/intermediates/lint/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it common to move the lint check into the final AAR? 🤔
What about to publish a separate jar/artifact and make this optional? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having custom lint checks for a library is only really possible since AGP v3.0. Before you had to manually copy a lint.jar to specific folder and so on.
So not a lot libs ship their own lint checks with the AAR atm.
But in my view it is way more convenient if you have them out-of-the-box. If you do not want them, you could deactivate them in the Android Studio preferences anyway.
Other than that it looks great 🎉 |
Thanks for the extensive tests! 😃 |
OK, wasn't that hard than expected. This scenario should also be covered now. |
All done. |
Issue created as discussed. Thank you @jreehuis 🤘 |
Description
This implementation adopts and updates #111.
Fixes #100
The updates include:
TiIssue
is now a sealed classHow to Test
Play with the following scenarios:
implements HelloWorldView
in theHelloWorldActivity
of the sample appimplements HelloWorldView
but overrideprovideView()
in theHelloWorldActivity
of the sample app0.9.1-SNAPSHOT
of this branch in another project and have an TiActivity which does not implement the givenTiView
subclass