Skip to content

Path to EasyCodingStandard binary is wrong #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
georgms opened this issue Mar 25, 2021 · 2 comments
Closed

Path to EasyCodingStandard binary is wrong #37

georgms opened this issue Mar 25, 2021 · 2 comments

Comments

@georgms
Copy link

georgms commented Mar 25, 2021

Describe the bug
The model generator provides a pretty-print option which uses EasyCodingStandard (ECS) in the background.

Expected behavior
The generated models are pretty-printed after generation.

Actual behavior
sh: 1: /home/username/project/vendor/wol-soft/php-json-schema-model-generator/src/../vendor/bin/ecs: not found

Schema
Not related to a schema.

Config

    $config = new GeneratorConfiguration();
    $config
        ->setNamespacePrefix('ACME\Common\Models')
        ->setImmutable(false)
        ->setPrettyPrint(true)
        ->setSerialization(true);

    $generator = new ModelGenerator($config);
    $generator
        ->generateModelDirectory(__DIR__ . '/src/ACME/Common/Models')
        ->generateModels(
            new RecursiveDirectoryProvider(__DIR__ . '/resources'),
            __DIR__ . '/src/ACME/Common/Models'
        );

Version:
0.20.0

Additional context

  • In src/ModelGenerator.php ECS is called like this: shell_exec(__DIR__ . "/../vendor/bin/ecs check $destination --config " . __DIR__ . "/cs.yml --fix $out").
  • However, resolving this directory will end up in src/vendor/bin/ecs.
  • It should be called like this: shell_exec(__DIR__ . "/../../../../vendor/bin/ecs check $destination --config " . __DIR__ . "/cs.yml --fix $out");
@wol-soft
Copy link
Owner

Hi @georgms

thanks for the report. I can reproduce the issue but even with the changed path the execution currently fails as the ECS config format has changed from yml to php files.

Currently the model generator provides a configuration for the ECS which is something I'm not happy with as it's not possible to set a custom ruleset. At the moment I'm in favour of dropping support for the builtin setPrettyPrint option (and the maintenance of working configuration files without a declared dependency) and instead everyone is free to format the code with a tool and a configuration of their choice after the code generation if formatted code is required.

Personally when using the Lib I've always disabled the pretty printing (which is why i wasn't aware of the issue, so thanks again) as ECS slows down the process massively.

Cheers, Enno

@georgms
Copy link
Author

georgms commented Mar 25, 2021

Thank you for the quick feedback @wol-soft ! It's understood.

I've tried to send the input to PHPCBF and it indeed takes a long time to run. So I've decided to skip that entirely since the IDE autocompletion works just fine anyway.

@georgms georgms closed this as completed Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants