Rector: checkout on windows errors with 'filename too long'

Created on 15 Dec 2020  路  8Comments  路  Source: rectorphp/rector

checking the current rector revision 51f5a42 I get

  HEAD is now at 51f5a4219 [Downgrade] Add ".0" after downgrading the numeric literal separator on floats (#4889)
  error: unable to create file rules/nette-kdyby/tests/Rector/ClassMethod/ReplaceMagicEventPropertySubscriberWithEven
  tClassSubscriberRector/ReplaceMagicEventPropertySubscriberWithEventClassSubscriberRectorTest.php: Filename too long
  error: unable to create file rules/nette/tests/Rector/MethodCall/GetConfigWithDefaultsArgumentToArrayMergeInCompile
  rExtensionRector/GetConfigWithDefaultsArgumentToArrayMergeInCompilerExtensionRectorTest.php: Filename too long
  error: unable to create file rules/solid/tests/Rector/ClassMethod/UseInterfaceOverImplementationInConstructorRector
  /Fixture/skip_class_that_implements_single_interface_but_defines_own_public_methods.php.inc: Filename too long
  error: unable to create file rules/solid/tests/Rector/ClassMethod/UseInterfaceOverImplementationInConstructorRector
  /Fixture/skip_class_that_implements_single_interface_but_uses_trait_with_additional_methods.php.inc: Filename too long

see details in https://github.com/rectorphp/rector/issues/4691#issuecomment-745242271

bug

All 8 comments

Could you come up with PR with shorter names that will make Windows happy? :)

windows max path length is arround 260 chars:
https://www.google.com/search?q=windows+max+path+length

maybe it would make sense to create a phpstan rule regarding too long file names?
I guess a sensible limit would be something arround 175, since we need additional chars to put rector into a checkout folder.

one of the offending paths of the error message above is
rules/solid/tests/Rector/ClassMethod/UseInterfaceOverImplementationInConstructorRector/Fixture/skip_class_that_implements_single_interface_but_uses_trait_with_additional_methods.php.inc
which is 185 chars long

wdyt?

maybe it would make sense to create a phpstan rule regarding too long file names?

You're reading my thoughts :) please include it with the fix, so we're sure.

in which folder/repo do you want such rule?

I could put it into https://github.com/rectorphp/rector/tree/master/utils/phpstan-extensions/src/Rule

how should the implementation look like?
for all ClassLike objects, try to find out in which file they are defined and calculate the file-length?
or could I just use a directory iterator and run thru the filesystem somehow?

for all ClassLike objects, try to find out in which file they are defined and calculate the file-length

This would be the best, to work with AST nodes context.
FileNode could be best

It seems already fixed in latest master. I am closing it.

(Miss click :))

Was this page helpful?
0 / 5 - 0 ratings