checkstyle / checkstyle/contribution

diff:groovy: can't clone checkstyle repo in some directories on Windows

Open
#840 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
57
Forks
168
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Identified at https://github.com/checkstyle/contribution/issues/839#issuecomment-1970188522 ,

When running diff.groovy with the checkstyle on my local, I got the following error:
````
Cloning into 'repositories\checkstyle'...
error: unable to create file src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclaration.java: Filename too long
error: unable to create file src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonafteroutertypedeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterOuterTypeDeclarationInnerTypes.java: Filename too long
error: unable to create file src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclaration.java: Filename too long
error: unable to create file src/it/resources/org/checkstyle/suppressionxpathfilter/unnecessarysemicolonaftertypememberdeclaration/SuppressionXpathRegressionUnnecessarySemicolonAfterTypeMemberDeclarationTokens.java: Filename too long
error: unable to create file src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonafteroutertypedeclaration/InputUnnecessarySemicolonAfterOuterTypeDeclarationRecords.java: Filename too long
error: unable to create file src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonaftertypememberdeclaration/InputUnnecessarySemicolonAfterTypeMemberDeclarationRecords.java: Filename too long
error: unable to create file src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceCheckSwitchExpressions.java: Filename too long
error: unable to create file src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/coding/variabledeclarationusagedistance/InputVariableDeclarationUsageDistanceCheckSwitchExpressions2.java: Filename too long
error: unable to create file src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/naming/abbreviationaswordinname/InputAbbreviationAsWordInNameCheckEnhancedInstanceofAllowXmlLength1.java: Filename too long
error: unable to create file src/test/resources-noncompilable/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespacebeforecasedefaultcolon/InputNoWhitespaceBeforeCaseDefaultColonEnumAndStrings.java: Filename too long
error: unable to create file src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/unnecessarysemicolonaftertypememberdeclaration/InputUnnecessarySemicolonAfterTypeMemberDeclarationNullAst.java: Filename too long
.....
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
....
fatal: destination path 'repositories\checkstyle' already exists and is not an empty directory.
fatal: destination path 'repositories\checkstyle' already exists and is not an empty directory.
fatal: destination path 'repositories\checkstyle' already exists and is not an empty directory.
fatal: destination path 'repositories\checkstyle' already exists and is not an empty directory.
Caught: groovy.lang.GroovyRuntimeException: Error: !
````
This shows I can't do this in a nested directory (`M:\checkstyleWorkspaceEclipse\contribution\checkstyle-tester`) of 61 characters.

I tested this and I can't clone checkstyle into a path of 71 characters or more.

`\contribution\checkstyle-tester\repositories\checkstyle` is 56 characters, which doesn't include the drive (2 characters), leaving me 13 characters to put the contribution directory somewhere if I choose.

We should allow users to override the repository directory. It creates issues and a lag to put it into the path of git even with the gitignore when I was working with this on linux.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with diff.groovy and trace where it creates or clones repositories\checkstyle. Check how the repository directory is selected on Windows and how existing clone failures are handled. Done means users can override the repository directory and clone checkstyle successfully from a sufficiently nested path.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.