Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] Add lint support #9318

Merged
merged 1 commit into from
Jul 21, 2017
Merged

[android] Add lint support #9318

merged 1 commit into from
Jul 21, 2017

Conversation

Guardiola31337
Copy link
Contributor

Fixes #8357

  • Adds lint using our current baseline as starting point

👀 @zugaldia @tobrun

@Guardiola31337 Guardiola31337 added Android Mapbox Maps SDK for Android in progress ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold labels Jun 21, 2017
@tobrun
Copy link
Member

tobrun commented Jun 21, 2017

This is great! Are these rules also enforced on CI? or is that one bridge too far?

@zugaldia
Copy link
Member

While I'm happy to merge this PR with the current baseline, by looking at the SDK file, it seems to me that there're many issues that are easily fixable (e.g. setting a default Locale during logging, or using @SuppressWarnings({"MissingPermission"}) when we're sure we don't need to check for a permission).

@Guardiola31337 Could you open a follow up ticket where we'll review the current baseline to make it as small as possible? This looks like a great starter task.

@Guardiola31337
Copy link
Contributor Author

@tobrun

Are these rules also enforced on CI?

Not yet, we should add a lint check step. I commented how in #8357 (comment) 👇

In order to accomplish this, we could add a lint check on CI. Run lint with Gradle.

@zugaldia

While I'm happy to merge this PR with the current baseline, by looking at the SDK file, it seems to me that there're many issues that are easily fixable (e.g. setting a default Locale during logging, or using @SuppressWarnings({"MissingPermission"}) when we're sure we don't need to check for a permission).

Could you open a follow up ticket where we'll review the current baseline to make it as small as possible? This looks like a great starter task.

Wasn't my intention, actually we could work here and in the meantime we could add lint on CI.
Cool?

@zugaldia
Copy link
Member

we could work here and in the meantime we could add lint on CI.

Yeah, let's add lint to CI now with the current baseline. We can then work (separate PR?) on reducing the baseline. That way lint doesn't have to wait for us to work on the baseline.

@tobrun
Copy link
Member

tobrun commented Jun 22, 2017

Executing lint from command line is something as:

./gradlew lint 

Though we could also expose a separate make target for it as we now do for checkstyle.

@Guardiola31337 Guardiola31337 force-pushed the pg-lint-support branch 4 times, most recently from dd2e640 to 171e454 Compare June 23, 2017 18:40
@Guardiola31337 Guardiola31337 added ✓ ready for review and removed in progress ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold labels Jun 23, 2017
@Guardiola31337
Copy link
Contributor Author

👀 ready for review @tobrun @zugaldia

@@ -0,0 +1,2 @@
lint-baseline.xml
lint/lint-baseline-local.xml
Copy link
Member

Choose a reason for hiding this comment

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

@Guardiola31337 Why do we have different baselines for local dev and for CI? Shouldn't they both be the same?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zugaldia they should, but in practice baselines include absolute paths (pointing to the files containing an error) which are different in local and in CI, so we need to keep both 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zugaldia at the moment, if you run this locally and remove any error, you'll get a warning from the command line advising you to remove it from the baseline. If you removed it you should remove it too from the CI baseline (which is the only one included in the repo). Eventually, it'll be removed (when we remove all current lint errors included).

Copy link
Member

Choose a reason for hiding this comment

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

@Guardiola31337 Thanks for the explanation 👍 . Could we add a big note to the XML lint files saying that? Something like "remember to update file XXXX.XML as well if you make any changes to this file".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zugaldia I've added the following comment

<!-- REMEMBER! First you run Lint locally you'll need to move the lint-baseline.xml file
    generated into the lint folder and called it lint-baseline-local.xml
    If you remove any error when running Lint locally, you'll get a warning from the command
    line advising you to remove it from the baseline. If you remove it (remember to remove it
    from lint-baseline-local.xml file) you should remove it too from
    lint-baseline-ci.xml (THIS FILE) which is the only one included in the repo.
    Eventually, it'll be removed (when we remove all current lint errors included). -->

into the different lint-baseline-ci.xml files.

Copy link
Member

Choose a reason for hiding this comment

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

@Guardiola31337 Guardiola31337 force-pushed the pg-lint-support branch 3 times, most recently from 2ee9c05 to 311a1d0 Compare July 21, 2017 07:50
@Guardiola31337 Guardiola31337 merged commit b83d797 into master Jul 21, 2017
@Guardiola31337 Guardiola31337 deleted the pg-lint-support branch July 21, 2017 12:03
@tobrun tobrun mentioned this pull request Jul 27, 2017
3 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants