diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 814fe78c8..13e670fca 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -27,16 +27,6 @@ jobs: - uses: ./.github/actions/setup-java - - name: Check lint - run: ./gradlew lintDebug --stacktrace - - - name: Upload lint reports - if: always() - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - with: - name: lint-reports - path: build/lint-reports - - name: Build all build type and flavor permutations run: ./gradlew assemble --stacktrace diff --git a/.github/workflows/Format.yml b/.github/workflows/Format.yml index e2c107059..9f0f07d51 100644 --- a/.github/workflows/Format.yml +++ b/.github/workflows/Format.yml @@ -24,3 +24,13 @@ jobs: - uses: ./.github/actions/setup-java - name: Check spotless run: ./gradlew spotlessCheck --stacktrace + + - name: Check lint + run: ./gradlew lintDebug --stacktrace + + - name: Upload lint reports + if: always() + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + with: + name: lint-reports + path: build/lint-reports diff --git a/.github/workflows/WorkflowHook.yml b/.github/workflows/WorkflowHook.yml index c5ae746be..b3053ee0d 100644 --- a/.github/workflows/WorkflowHook.yml +++ b/.github/workflows/WorkflowHook.yml @@ -104,7 +104,7 @@ jobs: recreate: true message: > Hi @${{ github.event.workflow_run.actor.login }}! - Codes seem to be unformatted. Please run `./gradlew spotlessKotlinApply` to fix this issue. + Codes seem to be unformatted. To resolve this issue, please run `./gradlew spotlessKotlinApply` and fix the results of ./gradlew lintDebug.. Thank you for your contribution. diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt index a39fe19b9..6c79b2cd5 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt @@ -20,7 +20,7 @@ import io.github.droidkaigi.confsched2023.main.MainScreen import io.github.droidkaigi.confsched2023.sessions.TimetableScreen @Composable -fun KaigiApp() { +fun KaigiApp(modifier: Modifier = Modifier) { KaigiTheme { val systemUiController = rememberSystemUiController() val useDarkIcons = !isSystemInDarkTheme() @@ -31,7 +31,7 @@ fun KaigiApp() { } Surface( - modifier = Modifier.fillMaxSize(), + modifier = modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background, ) { val navController = rememberNavController() diff --git a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/AndroidComposePlugin.kt b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/AndroidComposePlugin.kt index 7f359bfb6..649b4c98b 100644 --- a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/AndroidComposePlugin.kt +++ b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/AndroidComposePlugin.kt @@ -28,6 +28,7 @@ class AndroidComposePlugin : Plugin { testImplementation(libs.findLibrary("composeUiTestJunit4")) debugImplementation(libs.findLibrary("composeUiTooling")) debugImplementation(libs.findLibrary("composeUiTestManifest")) + lintChecks(libs.findLibrary("composeLintCheck")) } } } diff --git a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/GradleDsl.kt b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/GradleDsl.kt index a07f7df9a..4d1ad67f0 100644 --- a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/GradleDsl.kt +++ b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/GradleDsl.kt @@ -37,6 +37,12 @@ fun DependencyHandlerScope.testImplementation( add("testImplementation", artifact.get()) } +fun DependencyHandlerScope.lintChecks( + artifact: Optional> +) { + add("lintChecks", artifact.get()) +} + private fun DependencyHandlerScope.api( artifact: Optional> ) { diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index f78711f6b..eb6e25552 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -24,4 +24,5 @@ kotlin { } dependencies { + lintChecks(libs.findLibrary("composeLintCheck").get()) } \ No newline at end of file diff --git a/feature/main/src/main/java/io/github/droidkaigi/confsched2023/main/MainScreen.kt b/feature/main/src/main/java/io/github/droidkaigi/confsched2023/main/MainScreen.kt index 97ba3d1a0..025e95494 100644 --- a/feature/main/src/main/java/io/github/droidkaigi/confsched2023/main/MainScreen.kt +++ b/feature/main/src/main/java/io/github/droidkaigi/confsched2023/main/MainScreen.kt @@ -31,8 +31,8 @@ const val MainScreenTestTag = "MainScreen" @Composable fun MainScreen( timetableScreen: @Composable () -> Unit, + viewModel: MainScreenViewModel = hiltViewModel(), ) { - val viewModel: MainScreenViewModel = hiltViewModel() val uiState by viewModel.uiState.collectAsState() val snackbarHostState = SnackbarHostState() diff --git a/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/TimetableScreen.kt b/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/TimetableScreen.kt index 8a9bf704d..ab883bf53 100644 --- a/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/TimetableScreen.kt +++ b/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/TimetableScreen.kt @@ -30,8 +30,8 @@ const val TimetableScreenTestTag = "TimetableScreen" @Composable fun TimetableScreen( onContributorsClick: () -> Unit, + viewModel: TimetableScreenViewModel = hiltViewModel(), ) { - val viewModel: TimetableScreenViewModel = hiltViewModel() val uiState by viewModel.uiState.collectAsState() val snackbarHostState = SnackbarHostState() diff --git a/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/component/TimetableTopArea.kt b/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/component/TimetableTopArea.kt index 03ce3eeb8..7b3ccbd43 100644 --- a/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/component/TimetableTopArea.kt +++ b/feature/sessions/src/main/java/io/github/droidkaigi/confsched2023/sessions/component/TimetableTopArea.kt @@ -25,8 +25,12 @@ const val TimetableUiTypeChangeButtonTestTag = "TimetableUiTypeChangeButton" @Composable @OptIn(ExperimentalMaterial3Api::class) -fun TimetableTopArea(state: TimetableScreenScrollState, onTimetableUiChangeClick: () -> Unit) { - Column { +fun TimetableTopArea( + state: TimetableScreenScrollState, + onTimetableUiChangeClick: () -> Unit, + modifier: Modifier = Modifier, +) { + Column(modifier = modifier) { // TODO: Implement TopAppBar design TopAppBar( title = { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 919d74852..21b627bbe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -48,6 +48,7 @@ composeUiTestJunit4 = { module = "androidx.compose.ui:ui-test-junit4", version.r composeUiTooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } composeUiTestManifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "compose" } composeHiltNavigtation = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "composeHiltNavigatiaon" } +composeLintCheck = { module = "com.slack.lint.compose:compose-lint-checks", version = "1.2.0" } accompanistSystemUiController = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }