take toggleOffOn into account for linters
- 主要言語
- Java
- スター
- 5.6k
- フォーク
- 559
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 43
説明
First of all, I'm expecting a solution to this to be something extremely obvious but here it is.
Spotless setup in the project looks like this:
```
apply plugin: "com.diffplug.spotless"
spotless {
ext.targetBranch = "develop"
if (project.hasProperty('target_branch') && project.getProperty('target_branch')?.trim()) {
targetBranch = project.getProperty('target_branch')
}
ratchetFrom "origin/$targetBranch"
kotlin {
target '**/*.kt'
trimTrailingWhitespace()
indentWithSpaces()
toggleOffOn('format:off', 'format:on')
ktlint().userData([
'max_line_length': '120',
'disabled_rules' : 'import-ordering' //https://github.com/pinterest/ktlint/issues/527, https://youtrack.jetbrains.com/issue/KT-10974
])
}
}
```
The problem occurs when trying to exclude a part of the code using `spotless:off` and `spotless:on`
I also tried (as seen in the snippet above) with different tags but running `./gradlew spotlessCheck` still fails.
The part where it fails looks something like this:
```
// format:off
private fun functionName(): ReturnType = when (this) {
// A bunch of stuff, one line is >120 chars, our line limit
}
// format:on
```
Reason for failure:
```
java.lang.AssertionError: Error on line: 70, column: 1
Exceeded max line length (120)
```
What is it that I'm missing here?
コントリビューションガイド
調査の方向性
まず、issue に示されている Kotlin Spotless 設定を使って ./gradlew spotlessCheck で失敗を再現します。ktlint() ステップが実行される前に toggleOffOn マーカーがどのように処理されるかを追跡し、マークされた領域が除外され、長い行があるにもかかわらずコマンドが成功することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- kotlin
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100