Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Top-level EditorConfig configuration file
root = true

# Global defaults
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Kotlin-specific rules
[*.{kt,kts}]
indent_style = space
indent_size = 4
continuation_indent_size = 4
max_line_length = 120
insert_final_newline = true
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_function-naming = disabled

# Disable wildcard imports
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,android.**
ij_kotlin_allow_wildcard_imports = false

# Sort imports alphabetically and by groups
ij_kotlin_optimize_imports = true

# Do not align multiline parameters or arguments
ij_formatter_align_multiline_parameters = false
ij_formatter_align_multiline_method_brackets = false

# XML files (layout, manifest, etc.)
[*.xml]
indent_style = space
indent_size = 4
83 changes: 83 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Lint Check on Push

on:
push:
branches: # 必要に応じて特定のブランチを除外・指定できます
- '**' # 全てのブランチへのpushで実行
# - '!main' # 例: mainブランチへの直接pushでは実行しない場合

jobs:
lint:
runs-on: ubuntu-latest
name: Lint Changed Modules

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Download hash cache
uses: actions/download-artifact@v4
with:
name: lint-hash-cache
path: .lint-hash-cache
continue-on-error: true

- name: Read module list from projects.properties
id: define
run: |
modules=$(grep '^modules=' projects.properties | cut -d= -f2 | tr ',' ' ')
echo "modules=$modules" >> $GITHUB_OUTPUT

- name: Detect changed modules by hashing src/
id: detect
run: |
changed_modules=""
mkdir -p .lint-hash-cache
for module in ${{ steps.define.outputs.modules }}; do
hash=$(find "$module/src" -type f \( -name "*.kt" -o -name "*.xml" \) | sort | xargs sha256sum | sha256sum | cut -d ' ' -f1)
CACHE_KEY_FILE=".lint-hash-cache/${module//\//-}.txt"
if [ -f "$CACHE_KEY_FILE" ]; then
old_hash=$(cat "$CACHE_KEY_FILE")
if [ "$hash" == "$old_hash" ]; then
echo "Module $module unchanged."
continue
fi
fi
echo "Module changed: $module"
changed_modules="${changed_modules:+$changed_modules }$module"
echo "$hash" > "$CACHE_KEY_FILE"
done
# 余分な空白や改行を除去
changed_modules=$(echo "$changed_modules" | xargs)
echo "changed_modules=$changed_modules" >> $GITHUB_OUTPUT

- name: Run ktlintCheck
if: steps.detect.outputs.changed_modules != ''
run: |
for module in ${{ steps.detect.outputs.changed_modules }}; do
echo "Running ktlintCheck for $module"
# エラーがあってもCIを止めない場合は `|| true` やエラーハンドリングを追加
./gradlew ":$module:ktlintCheck"
done

- name: Run Android Lint
if: steps.detect.outputs.changed_modules != ''
run: |
for module in ${{ steps.detect.outputs.changed_modules }}; do
echo "Running lint for $module"
# エラーがあってもCIを止めない場合は `|| true` やエラーハンドリングを追加
./gradlew ":$module:lint"
done

- name: Upload hash cache
if: always() # 常にキャッシュをアップロード
uses: actions/upload-artifact@v4
with:
name: lint-hash-cache
path: .lint-hash-cache/
32 changes: 32 additions & 0 deletions .github/workflows/review.yml-disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Claude Auto Review

on:
pull_request:
types: [opened, synchronize]

jobs:
auto-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Automatic PR Review
uses: anthropics/claude-code-action@beta
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
timeout_minutes: "120"
direct_prompt: |
Please review this pull request and provide comprehensive feedback in Japanese.

Focus on:
- Code quality and best practices
- Potential bugs or issues

allowed_tools: "mcp__github__add_pull_request_review_comment"
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.android.library) apply false
id("org.jlleitschuh.gradle.ktlint") version "13.0.0-rc.1"
}

buildscript {
Expand All @@ -14,4 +15,4 @@ buildscript {
dependencies {
classpath(libs.secrets.gradle.plugin)
}
}
}
15 changes: 11 additions & 4 deletions example-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ plugins {
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
id("org.jlleitschuh.gradle.ktlint")
}

ktlint {
android.set(true)
reporters {
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
}
}

android {
namespace = "com.mapconductor.example"
Expand All @@ -14,7 +22,7 @@ android {
defaultConfig {
applicationId = "com.mapconductor.example"
minSdk = project.property("minSdk").toString().toInt()
targetSdk = project.property("targetSdk").toString().toInt()
targetSdk = project.property("targetSdk").toString().toInt()
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -30,7 +38,7 @@ android {
isMinifyEnabled = project.property("isMinifyEnabled").toString().toBoolean()
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}
}
Expand Down Expand Up @@ -75,7 +83,6 @@ dependencies {
implementation(libs.androidx.material3)
implementation(libs.androidx.appcompat)


// Google Maps SDK
implementation(libs.play.services.maps)
// Here Maps SDK
Expand Down Expand Up @@ -108,4 +115,4 @@ dependencies {
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.mapconductor.example

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mapconductor.overlaytest", appContext.packageName)
}
}
}
Loading
Loading