feat(spotless/gradle-plugin): Allow `SpotlessApply` to notify when/what work was done
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 領域
- build-system
調査の方向性
まず Gradle タスク SpotlessApply とその didWork の動作を確認し、次に実行中にコピーされたファイルがどのように追跡されるかを調べます。作業が発生した場合にのみ、タスクが変更されたファイルを公開または報告し、その動作が関連するテストで検証されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hello Spotless team! We're very thankful for your work on this tool. Seeking review on a proposed feature that we are happy to help incorporate into the project if it sounds like a desirable enhancement.
TL;DR:
We'd like to expose information on which files were auto-fixed by SpotlessApply to propagate that information to our developer experience
Problem Statement
Our current team's workflow is as such for running Spotless:
- On CI, our invocation of
gradle buildrunsspotlessCheck, as is configured by default. All failures are reported by CI and require manual updates - In local use cases,
gradle buildwill instead runspotlessApplyto automatically fix issues. This is biased toward improving the UX during local development
In this case, the developer experience is enhanced by the automatic fixing, however it is less clear when spotlessApply is run on the user's behalf.
It would be preferable to do something more targeted. In this case, we'd prefer to have SpotlessApply (or a finalizer task) only print information in the event that Spotless performed work.
[!NOTE]
In an ideal world, we'd also be able to show the violations that were fixed during the auto-fix phase, such that we could demonstrate to developers "there were X and Y issues, and we've auto-fixed them". This may be out of scope of this more immediate enhancement, but may be interesting to provide.
(Potential) Design
Enhance the SpotlessApply task to output a simple report containing a manifest of all files it copied in on the most recent execution. This output location can be exposed by the task for the specific gradle build, read, and used to provide a more detailed listing of the edited files.
Note: Theoretical Workaround
We've attempted what we thought would be a suitable workaround for the time being:
// build.gradle.kts (or in convention plugin)
tasks.withType<SpotlessApply>() {
doLast {
if(didWork) {
logger.lifecycle("code auto-formatted by spotlessApply")
}
}
}
Unfortunately, even for cases where there are no changes to any of the source files, the SpotlessApply task is still labeled as didWork == true. If we should file this separately as a "bug", please let us know!
- 主要言語
- Java
- スター
- 5.7k
- フォーク
- 560
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 43
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
diffplug/spotless のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 66/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
diffplug/spotless の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
infinispan/infinispan#18150 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
opensearch-project/k-NN#3597 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100