Open jesus-mg-ios opened 3 weeks ago
cc @hampustagerud - any idea what the problem is here?
@jesus-mg-ios FYI I think {created.date}
needs to be {created.year}
, although that may not be the cause of your issue
@jesus-mg-ios FYI I think
{created.date}
needs to be{created.year}
, although that may not be the cause of your issue
Sorry for the mistake, same result using {created.year}
Same issue - however what I'm experiencing but never noticed before is that when I run swiftformat .
on the project with {created.year} in the header template it sets every file to the current year. Perhaps this is the issue - it's now working as expected on CI but from SwiftFormat it's setting the current year not the created year?
@bcybs prior to the git integration added in the last release, the created date was derived from the file metadata. For files stored in git, that probably ends up being the checkout date rather than the original creation date.
If the repo is checked out with only one commit (--depth 1
) then that will be the commit creating the file, which is most likely why the errors are thrown. I am not sure what the best solution would be but some of them include:
git rev-parse --is-shallow-repository
)
.git
placeholder (e.g {git.created}
or something) and document the caveats of using it
If I were to implement a CI with this I'd try with replacing git clone --depth 1 ...
with git clone --filter=blob:none ...
/git clone --filter=tree:0 ...
to avoid cloning everything (for speed) but keeping the entire history 🙂 more info
Hi I'm comming up with an error on xcode cloud trying to use the new {created.date}.
The rules I'm using are:
The first step was adding in the script:
git fetch --unshallow
After that, the complaining count went down.
Using same version on local and CI, but when you run lint, for only some files swiftformat complains. (after doing git fetch --unshallow less files were affected) :
Any idea on how to deal with this would be much appreciated.