drupal-check icon indicating copy to clipboard operation
drupal-check copied to clipboard

Invalid JSON output

Open mxr576 opened this issue 3 years ago • 1 comments

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. https://github.com/mglaman/drupal-check/commit/62dfa4da99b260c24aa2a0dc10558ebf8734065d and that has not been fixed in https://github.com/mglaman/drupal-check/commit/900d859a898bfd5af43d52c66d6a81be4887ee1b 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 avatar May 02 '22 10:05 mxr576

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

mxr576 avatar May 02 '22 10:05 mxr576