feat(spotless/gradle-plugin): Allow custom string format for license header copyright year/year range#2965
Open
Maciej-Sitarz-IBM wants to merge 6 commits into
Conversation
Member
|
Happy to merge something like this, the approach looks good, obviously the System.out.printlns gotta go |
Member
|
…yright_year_format
…yright_year_format
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR:
Initial feature implementation allowing users to specify string format for year and year range during license header copyright year update and formatting. Allows left/right padding of the year/year range string.
Usage:
setLicenseStep("licenseHeader('/** $YEAR */').yearStringFormat('%-12s')");Feature status
LicenseHeaderTest.withYearStringFormat_spacesBefore()(I didn't spend much time on it, as first I wanted to get confirmation if this feature could be merged.)
println()in the code, should be removed after the above issue is fixed and before PR mergeQuestions
Problem Statement
This PR implements an initial version of a new feature that allows providing a string format for the year/year range that is inserted in the license header copyright (
$YEARplaceholder in license file template).Currently if the license template file is formatted for year range (9 characters) formatting of a license header containing single year is missing 5 spaces (the closing bracket isn't aligned).
Current:
Single year:
Year range:
Expected:
Single year:
Year range:
How to test the new feature?
Currently used workaround