Skip to content

Commit

Permalink
Fine-tune lint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ofalvai committed Aug 11, 2022
1 parent 8dc38e6 commit 4c64792
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@ android {

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

manifestPlaceholders = [api_key_bugsnag: "${API_KEY_BUGSNAG}"]
manifestPlaceholders += ["api_key_bugsnag": "${API_KEY_BUGSNAG}"]
buildConfigField("String", "URL_PRIVACY_POLICY", "\"$URL_PRIVACY_POLICY\"")
buildConfigField("String", "URL_SOURCE_CODE", "\"$URL_SOURCE_CODE\"")
}

lint {
enable 'DuplicateStrings', 'NewerVersionAvailable'
abortOnError true
ignoreTestSources true
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/ofalvai/habittracker/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,14 @@ private fun AppBottomNavigation(navController: NavController) {

AppBottomNavigationItem(
rootScreen = Destination.Dashboard,
icon = { Icon(CoreIcons.Habits, stringResource(R.string.tab_dashboard)) },
content = { Icon(CoreIcons.Habits, stringResource(R.string.tab_dashboard)) },
label = stringResource(R.string.tab_dashboard),
currentDestination = currentDestination,
navController = navController
)
AppBottomNavigationItem(
rootScreen = Destination.Insights,
icon = { Icon(AppIcons.Insights, stringResource(R.string.tab_insights)) },
content = { Icon(AppIcons.Insights, stringResource(R.string.tab_insights)) },
label = stringResource(R.string.tab_insights),
currentDestination = currentDestination,
navController = navController
Expand All @@ -189,13 +189,13 @@ private fun AppBottomNavigation(navController: NavController) {
@Composable
private fun RowScope.AppBottomNavigationItem(
rootScreen: Screen,
icon: @Composable () -> Unit,
label: String,
currentDestination: NavDestination?,
navController: NavController
navController: NavController,
content: @Composable () -> Unit
) {
BottomNavigationItem(
icon = icon,
icon = content,
selected = currentDestination?.hierarchy?.any { it.route == rootScreen.route } == true,
onClick = {
navController.navigate(rootScreen.route) {
Expand Down
33 changes: 33 additions & 0 deletions lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2022 Olivér Falvai
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!-- Lint issue index: http://googlesamples.github.io/android-custom-lint-rules/checks/vendors.md.html -->
<lint>
<issue id="FrequentlyChangedStateReadInComposition" severity="error" />
<issue id="ComposableLambdaParameterNaming" severity="error" />
<issue id="ComposableLambdaParameterPosition" severity="error" />
<issue id="ComposableNaming" severity="error" />
<issue id="MutableCollectionMutableState" severity="error" />
<issue id="ComposableModifierFactory" severity="error" />
<issue id="ModifierFactoryExtensionFunction" severity="error" />
<issue id="UnnecessaryComposedModifier" severity="error" />
<issue id="InvalidColorHexValue" severity="error" />
<issue id="MissingColorAlphaChannel" severity="error" />

<issue id="DuplicateStrings" severity="warning" />
<issue id="NewerVersionAvailable" severity="warning" />
</lint>

0 comments on commit 4c64792

Please sign in to comment.