Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

spotlessApply --staged

Đang mở
#623 14 bình luận 23 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
git, java
Lĩnh vực
build-system, tooling

Hướng nghiên cứu

Bắt đầu bằng cách đọc script hook cho các tệp staged được liên kết từ issue #178 và kiểm tra tích hợp git hiện có của Spotless. Xem lại cuộc thảo luận xoay quanh #603 và #600 trước khi chọn một cách tiếp cận. Hoàn thành nghĩa là cung cấp các chế độ staged để kiểm tra hoặc áp dụng việc định dạng mà không thay đổi nội dung chưa staged của working tree.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Spotless applies itself to the files on disk. However, when git makes a commit, it does not use the files on disk, it uses the staging area. If you do this:

change foo.txt
spotlessApply
git add foo.txt
git commit -m "blah"

Then your commit will definitely pass a spotlessCheck. But if you do this, it might not:

change foo.txt
git add foo.txt
spotlessApply         (changes foo on disk, but not the staged/index foo)
git commit -m "blah"  (you committed the dirty foo, not the clean foo)

aside: this three-files-per-file model, with an independent index, is confusing to beginners, and imo of limited utility even to experts, which is why DiffPlug doesn't have a staging area.

@lowwor made an excellent git hook script which uses the stash to run spotlessCheck on staged files.

With our new git integration, it would now be relatively easy for Spotless to have a mode which operates on the staging area directly. This is especially useful for pre-commit hooks, which could either fail on badly formatted content spotlessCheck --staged, or silently fix the commit right before it is created spotlessApply --staged.

Due to merge conflicts that this is likely to generate, implementing this is blocked on #603 and #600. PR's welcome!

Ngôn ngữ chính
Java
Star
5.7k
Fork
560
Merge trung bình
1 ngày 6 giờ
Pull request đã merge (30 ngày)
48

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của diffplug/spotless

Tất cả issue của diffplug/spotless

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.