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

Add lint to CI #1975

Merged
merged 1 commit into from
Jun 2, 2022
Merged

Add lint to CI #1975

merged 1 commit into from
Jun 2, 2022

Conversation

marcosholgado
Copy link
Contributor

@marcosholgado marcosholgado commented Jun 1, 2022

Task/Issue URL: https://app.asana.com/0/414730916066338/1202273688878189/f

Description

This PR adds lint to CI and fixes a few errors/warnings. It also creates baselines for all the modules.

Steps to test this PR

Tests

  • Smoke test the main features of the app
  • CI passes

@@ -33,9 +33,6 @@ jobs:
java-version: '11'
distribution: 'adopt'

- name: Spotless
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleting this because it was already done as part of jvm_checks so we were actually wasting time here.

@@ -98,6 +98,7 @@ android {
}
}
lintOptions {
disable 'ObsoleteLintCustomCheck'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed otherwise lint fails because the internal lint registry in the fragments dependency.

@@ -127,6 +128,7 @@ class SpecialUrlDetectorImpl(
return UrlType.Web(uriString)
}

@SuppressLint("WrongConstant")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -177,6 +178,7 @@ class NotificationHandlerService : IntentService("NotificationHandlerService") {
notificationManager.cancel(notificationId)
}

@SuppressLint("MissingPermission")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -177,6 +178,7 @@ class VpnDiagnosticsActivity : DuckDuckGoActivity(), CoroutineScope by MainScope
}
}

@SuppressLint("RestrictedApi")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Expected, only used in internal but should trigger an error if used in release

@@ -187,7 +187,8 @@ class MigrationsProvider(val context: Context, val settingsDataStore: SettingsDa
if (it.moveToFirst()) {
var index = 0
do {
val tabId = it.getString(it.getColumnIndex("tabId"))
val colInd = it.getColumnIndex("tabId")
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, Does this change break any warning / error from the lint checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Funnily enough yes, there was an error saying getString needs an Int > 0. Still just moving that out makes no sense to me but 🤷

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="6" by="lint 7.0.4" type="baseline" client="gradle" name="AGP (7.0.4)" variant="all" version="7.0.4">
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't even know of these issues. Probably didn't notice them. 😅 So this is really helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, not sure about the overdrawn ones but the unused resources is probably because they are used on a different module?

@karlenDimla
Copy link
Contributor

karlenDimla commented Jun 2, 2022

@marcosholgado maybe stupid question, when I introduced a lint failure ./gradlew lint fails locally but assembling a build passes. Is this expected?

Ci works as expected though (pass when no lint errors, fails when there are lint errors)

@marcosholgado
Copy link
Contributor Author

@marcosholgado maybe stupid question, when I introduced a lint failure ./gradlew lint fails locally but assembling a build passes. Is this expected?

Ci works as expected though (pass when no lint errors, fails when there are lint errors)

mmm I guess it makes sense yeah

@marcosholgado marcosholgado merged commit b0f0fc2 into develop Jun 2, 2022
@marcosholgado marcosholgado deleted the feature/marcos/enable_lint_in_ci branch June 2, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants