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

Kotlin add linting #32

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions .github/linters/ktlint_config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_standard_no-consecutive-comments = disabled
40 changes: 40 additions & 0 deletions .github/workflows/kotlin-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Kotlin Linter

on:
workflow_dispatch:
pull_request:
paths:
- .github/workflows/kotlin-lint.yml
- 'kotlin/**/*.{kt,kts}'

jobs:
ktlint:
name: Lint Kotlin
runs-on: ubuntu-latest
steps:
- name: Checkout files
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: "kotlin/**/*.{kt,kts}"
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
- name: Install ktlint via curl
if: steps.changed-files.outputs.any_changed == 'true'
run: |
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/
- name: Run ktlint
if: steps.changed-files.outputs.any_changed == 'true'
run: |
ktlint --reporter=plain?group_by_file --editorconfig=".github/linters/ktlint_config"
continue-on-error: false

Loading