Skip to content
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

Invalid JSON output #274

Open
mxr576 opened this issue May 2, 2022 · 1 comment
Open

Invalid JSON output #274

mxr576 opened this issue May 2, 2022 · 1 comment

Comments

@mxr576
Copy link
Contributor

mxr576 commented May 2, 2022

How is drupal-check installed?
drupal-check is installed as a dependency to my project

Environment:

  • OS: Linux (Docker containers by Wodby)
  • PHP Version: 7.4
  • Drupal core: 9.2.x

Describe the bug

./vendor/bin/drupal-check --format=json returns an invalid JSON since 1.3.0. 62dfa4d and that has not been fixed in 900d859 either. Why? Because in some runtime environments, like Docker containers, stderr and stdout is redirected to the same destination, /proc/self/fd/2.

php -i | grep error_log
error_log => /proc/self/fd/2 => /proc/self/fd/2

Suggested solution
If this information truly needed to be added to the output in every possible output formats then the added message must respect the expected output format.

Console output

./vendor/bin/drupal-check web
/modules/custom/ --format=json --no-progress
{
    "totals": {
        "errors": 0,
        "file_errors": 0
    },
    "files": [],
    "errors": []
}Thanks for using drupal-check!

Consider sponsoring the development of the maintainers which make drupal-check possible:

- phpstan (ondrejmirtes): https://github.com/sponsors/ondrejmirtes
- phpstan-deprecation-rules (ondrejmirtes)): https://github.com/sponsors/ondrejmirtes
- phpstan-drupal (mglaman)): https://github.com/sponsors/mglaman
- drupal-check (mglaman)): https://github.com/sponsors/mglaman
@mxr576
Copy link
Contributor Author

mxr576 commented May 2, 2022

#271 was the issue when the message was redirected to stderr.

pronovix-bot pushed a commit to Pronovix/drupal-qa that referenced this issue May 2, 2022
Because newer versions produces malformed JSON output and run PHPStan on level 2 that causes extra overhead on downstream projects without PHPStan's baseline feature available.

See: mglaman/drupal-check#274 and https://mglaman.dev/blog/drupal-check-140-enforcing-phpstan-level-2

Issue-Link: https://project.pronovix.net/issues/17233
(cherry picked from commit 20927cff7eb356ec6b81f51838fbd7078459c027)
Change-Id: I75d4faf6ad7e1e1c0c66288ace02677b7faf127b
pronovix-bot pushed a commit to Pronovix/drupal-qa that referenced this issue May 3, 2022
Because newer versions produces malformed JSON output and run PHPStan on level 2 that causes extra overhead on downstream projects without PHPStan's baseline feature available.

See: mglaman/drupal-check#274 and https://mglaman.dev/blog/drupal-check-140-enforcing-phpstan-level-2

Issue-Link: https://project.pronovix.net/issues/17233
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

1 participant