diffplug / diffplug/spotless

LicenseHeaderStep with `git --follow` in some repositories produces garbage year history

Open
#774 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
5.7k
Forks
561
Avg merge
1d 14h
Merged PRs (30d)
43

Description

- [x] summary of problem

I have been working on migrating a project to use spotless for license headers. The project hasn't been great on keeping license headers up to date - so I used spotless's feature to allow fixing the header years from git history.

However with the project the `--follow` option for git produces a lot of garbage header years.
Examples being small functional interfaces created in 2020 resolving to get an incorrect year range of `2018, 2020`.

Possible solution:
Allow disabling the `--follow` option for git history check here: https://github.com/diffplug/spotless/blob/a30553386acfa24f0d97f587249c38f44feb79b6/lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java#L289-L294

- [x] gradle or maven version
Gradle 6.7.1

- [x] spotless version
5.8.2

Contributor guide

Open the contributing guide

Research direction

Start in lib/src/main/java/com/diffplug/spotless/generic/LicenseHeaderStep.java around lines 289-294 and inspect how git history is queried with --follow. Verify the behavior against the reported small functional-interface example, and consider the issue's proposed way to disable --follow so license-header years no longer include incorrect history.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, java
Domain
build-system, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.