Copyright year calculation with merge commits

Open
#3,034 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
java
Domain
build-system

Research direction

Start by locating the copyright year calculation and the tests or fixtures covering merge commits; the issue names no files or entry points. Reproduce the described Spotless check with branches changed in different years and a clean merge. Done means a clean merge does not advance the end year, while a merge that changes the file still does.

Written by the indexing model from the issue text.

Description

Copyright year calculation currently takes the date of the merge commit, even if that particular file merged cleanly.

It causes a specific failure in spotlessCheck (I used Gradle plugin, but the issue is likely not related to Gradle): when branches being merged were changed in the previous year (e.g. 2025) and both had correct copyright end year, checked by Spotless at the time of their respective commits, and when the merge itself happens in the new year (e.g. 2026), Spotless insists that the 2025 copyright year from the clean merge is now incorrect and requires a manual change to 2026.

The expected outcome is that the clean, non-conflicting merge commit does not advance the copyright end year.
Merge commit that actively changes a file (to resolve conflicts or otherwise) should still advance the end year.

Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.