tools:ignore ignores the outcome, but still processed the file
This caused a bug as it found a duplicate key in an ignored file
and flagged it as an error on the non-ignored file
DuplicateCrowdInStrings applies to only the /values/ folder
But there are other files in the values folder aside from translatable
strings (resources, constants, etc...)
As lint does not currently have a good way to exclude files from linting
So instead we use `tools:ignore` to do this
* lint-rules: include kotlinMigration-lint
changes from `AnkiDroid/kotlinMigration`:
* remove `android { }` wrapper around `ktlint { }`
Due to this change, we use a new file
We use the -lint suffix to imply to reviewers that this is a different
file type
* lint-rules: remove ANDROID_TEST from kotlinMigration
spacing changes were produced automatically using the new version on the
command line with `-F` argument to auto-fix spacing to conform with new
version of the tool
Simply for the sake of consistency. It will ensure that when searching for a
method, function or variable name, I have a single word to look for
This was done by a simple search and replace in .java and .kt files, preserving
case.
The only exception being org.junit.rules.TemporaryFolder and its method
`newFolder`, which obviously was not renamed.
Note that `folder` can't be entirely renamed to `directory` either because of
the class `DirectoryStream`. It seems even Java is not consistent between Folder
and directory
Adds lint to help with Kotlin migration
This removes some needs for `!!` in the code:
`assertNotNull(x)` -> `x` is now known to be non-null.
This will break lint on the "rename" commit in a Kotlin migration,
I feel this is worthwhile as otherwise the lint check would
not be viable
https://kotlinlang.org/api/latest/kotlin.test/kotlin.test.junit/-j-unit-asserter/
Issue 10427
AAPT displayed these issues as build as warnings, but CI passed
Add lint to make sure this is caught.
We take AAPT's C++ code and convert it to Kotlin.
Tested on commit d392498050
Errors looks like:
AnkiDroid\src\main\res\values\04-network.xml:84:
Multiple substitutions specified in non-positional format.
Convert "%s" to "%1$s"
[NonPositionalFormatSubstitutions from com.ichi2.anki.lint]
Fixes 10347
The Java -> Kotlin migration converts <...> into html tags
if the comment is /** instead of /*
This often catches the copyright header of files, which is bad
as it corrupts the emails in the copyright.
Pickup the email `<http:></http:>` and report this
We want to move away from AOSP naming for Kotlin
As it makes getters and primary constructors less useful
as the naming conflicts with other policies we want to enforce
AOSP naming is also against Google suggestions
Fixes 9377
Fix errors which were introduced:
* api is now required
* Unicode Handling changed
* Compilation errors from missing imports were introduced
* a2d0a4ca4d
Bumps `lint_version` from 27.2.2 to 30.0.0.
Updates `lint-api` from 27.2.2 to 30.0.0
Updates `lint` from 27.2.2 to 30.0.0
Updates `lint-tests` from 27.2.2 to 30.0.0
---
updated-dependencies:
- dependency-name: com.android.tools.lint:lint-api
dependency-type: direct:production
update-type: version-update:semver-major
- dependency-name: com.android.tools.lint:lint
dependency-type: direct:production
update-type: version-update:semver-major
- dependency-name: com.android.tools.lint:lint-tests
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
`ConstantFieldName` lint was triggered by auto-generated Kotlin
companion objects named "Companion" (expected: COMPANION)
As these are auto-generated, allow constants called "Companion"
Fixes 9223
* Bump lint-api from 27.2.0 to 27.2.1
* Bump lint-tests from 27.2.0 to 27.2.1
* Bump gradle from 4.2.0 to 4.2.1
* Bump lint from 27.2.0 to 27.2.1
* Bump jackson-databind from 2.12.0 to 2.12.3
* Bump protobuf-java from 3.15.8 to 3.17.0
- remove jcenter (deprecated, thankfully no longer needed)
- remove r8 workaround for previous issue, AGP 4.2.0 has fix built-in
- bump Triple-T / Play Publisher plugin to match AGP 4.2.0
- remove java 1_8 source/target compat annotation, it is default in 4.2
- add noinspection for commons-compress - has to wait until API26
- lint to 27.2.0
- fragment to 1.2.3
- API publishing needed a complete overhaul, tested locally, works
- JCenter is still needed for AnkiDroid as noted unfortunately...couple months to go
- Some artifact resolution performance complaints but local testing shows every single thing works
* Added lint rule for use of UIUtils.showSnackbar instead of Snackbar.make
* Fixed the lint errors related to Snackbar.make
* Fixed inconsistent spacing
Co-authored-by: David Allison <62114487+david-allison-1@users.noreply.github.com>
Bumps lint-api from 27.1.2 to 27.1.3.
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Bump lint-tests from 27.1.2 to 27.1.3
Bumps lint-tests from 27.1.2 to 27.1.3.
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Bump lint from 27.1.2 to 27.1.3 (#303)
* Bump lint from 27.1.2 to 27.1.3
Bumps lint from 27.1.2 to 27.1.3.
Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
* Update lint-rules/build.gradle
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Mike Hardy <github@mikehardy.net>