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

Extension stopped working with complex JSON rules #217

Closed
slowpokefarm opened this issue Aug 13, 2024 · 6 comments
Closed

Extension stopped working with complex JSON rules #217

slowpokefarm opened this issue Aug 13, 2024 · 6 comments

Comments

@slowpokefarm
Copy link

slowpokefarm commented Aug 13, 2024

Recently extension stopped working properly.

When I'm using complex rules settings like:

    "php-cs-fixer.rules": {
        "@PSR12": true,
        "no_extra_blank_lines": true,
        "binary_operator_spaces": {
            "default": "align_single_space",
            "operators": {
                "=>": "align_single_space_minimal"
            }
        }
    },

I receive an error:

    runAsync: spawn php
[
  "/dev/bin/php-cs-fixer.phar",
  "fix",
  "--using-cache=no",
  "--format=json",
  "--rules={\"@PSR12\":true,\"no_extra_blank_lines\":true,\"binary_operator_spaces\":{\"default\":\"align_single_space\",\"operators\":{\"=>\":\"align_single_space_minimal\"}}}",
  "--path-mode=override",
  "/tmp/pcf-tmp0.454048559428494/WebsiteController.php"
]
{
  "cwd": "/website/http",
  "shell": true
}
runAsync: error
{
  "exitCode": 16,
  "stdout": null,
  "stderr": "PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.\nPHP runtime: 8.1.2-1ubuntu2.18\nRunning analysis on 1 core sequentially.\nYou can enable parallel runner and speed up the analysis! Please see https://cs.symfony.com/doc/usage.html for more information.\nLoaded config default.\n\nIn ConfigurationResolver.php line 663:\n                                             \n  Invalid JSON rules input: \"Syntax error\".  \n                                             \n\nfix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--sequential] [--] [<path>...]\n\n"
}
runAsync: reject promise
PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.1.2-1ubuntu2.18
Running analysis on 1 core sequentially.
You can enable parallel runner and speed up the analysis! Please see https://cs.symfony.com/doc/usage.html for more information.
Loaded config default.

In ConfigurationResolver.php line 663:
                                             
  Invalid JSON rules input: "Syntax error".                                        

When I'm using simple rules like "php-cs-fixer.rules": "@PSR12", everything works ok:

runAsync: spawn php
[
  "/dev/bin/php-cs-fixer.phar",
  "fix",
  "--using-cache=no",
  "--format=json",
  "--rules=@PSR12",
  "--path-mode=override",
  "/tmp/pcf-tmp0.9332918928450025/WebsiteController.php"
]
{
  "cwd": "/website/http",
  "shell": true
}
runAsync: success
{
  "stdout": "{\"about\":\"PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.\",\"files\":[],\"time\":{\"total\":0.005},\"memory\":17.066}",
  "stderr": "PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.\nPHP runtime: 8.1.2-1ubuntu2.18\nRunning analysis on 1 core sequentially.\nYou can enable parallel runner and speed up the analysis! Please see https://cs.symfony.com/doc/usage.html for more information.\nLoaded config default.\n"
}
runAsync: resolve promise
{"about":"PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.","files":[],"time":{"total":0.005},"memory":17.066}
PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.1.2-1ubuntu2.18
Running analysis on 1 core sequentially.
You can enable parallel runner and speed up the analysis! Please see https://cs.symfony.com/doc/usage.html for more information.
Loaded config default.
@RYRDU
Copy link

RYRDU commented Aug 14, 2024

Still having issues, v0.3.13 works fine.

@junstyle
Copy link
Owner

your os is linux, i can't test on linux.
if v0.3.13 works fine, latest version is ok too

@slowpokefarm
Copy link
Author

Works fine after update for me, thanks

@RYRDU
Copy link

RYRDU commented Aug 14, 2024

Parsing JSON works fine, but there are new problems.

runAsync: spawn
[
"c:\Users\user1\.vscode-insiders\extensions\junstyle.php-cs-fixer-0.3.16\php-cs-fixer.phar",
"fix",
"--using-cache=no",
"--format=json",
"--rules={\"@PhpCsFixer\":true,\"@psr12\":true,\"array_syntax\":{\"syntax\":\"short\"},\"blank_line_after_opening_tag\":true,\"blank_line_before_statement\":{\"statements\":[\"case\",\"continue\",\"default\",\"declare\",\"return\",\"throw\",\"try\"]},\"cast_spaces\":{\"space\":\"none\"},\"concat_space\":{\"spacing\":\"one\"},\"linebreak_after_opening_tag\":true,\"method_argument_space\":{\"on_multiline\":\"ensure_fully_multiline\"},\"no_break_comment\":{\"comment_text\":\"no break...\"},\"no_trailing_comma_in_list_call\":true,\"no_trailing_comma_in_singleline_array\":true,\"phpdoc_summary\":false,\"phpdoc_align\":false,\"phpdoc_no_alias_tag\":false,\"phpdoc_annotation_without_dot\":true,\"phpdoc_no_empty_return\":true,\"single_line_comment_style\":{\"comment_types\":[\"asterisk\"]},\"single_quote\":{\"strings_containing_single_quote_chars\":true},\"trailing_comma_in_multiline\":{\"elements\":[]},\"yoda_style\":{\"always_move_variable\":true}}",
"--path-mode=override",
"C:\Users\user1\AppData\Local\Temp\pcf-tmp0.5814790718269975\Untitled-1"
]
{
"shell": true
}
runAsync: error
{
"exitCode": 16,
"stdout": null,
"stderr": "PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.\nPHP runtime: 8.3.8\r\n\r\nIn ConfigurationResolver.php line 395:\r\n \r\n The path "break..."},"no_trailing_comma_in_list_call":true,"no_trailing_com \r\n ma_in_singleline_array":true,"phpdoc_summary":false,"phpdoc_align":false,"p \r\n hpdoc_no_alias_tag":false,"phpdoc_annotation_without_dot":true,"phpdoc_no_e \r\n mpty_return":true,"single_line_comment_style":{"comment_types":["asterisk"] \r\n },"single_quote":{"strings_containing_single_quote_chars":true},"trailing_c \r\n omma_in_multiline":{"elements":[]},"yoda_style":{"always_move_variable":tru \r\n e}}" is not readable. \r\n \r\n\r\nfix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--sequential] [--] [...]\r\n\r\n"
}
runAsync: reject promise
PHP CS Fixer 3.62.0 (1ce9e24) 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.8

In ConfigurationResolver.php line 395:

The path "break..."},"no_trailing_comma_in_list_call":true,"no_trailing_com
ma_in_singleline_array":true,"phpdoc_summary":false,"phpdoc_align":false,"p
hpdoc_no_alias_tag":false,"phpdoc_annotation_without_dot":true,"phpdoc_no_e
mpty_return":true,"single_line_comment_style":{"comment_types":["asterisk"]
},"single_quote":{"strings_containing_single_quote_chars":true},"trailing_c
omma_in_multiline":{"elements":[]},"yoda_style":{"always_move_variable":tru
e}}" is not readable.

fix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--cache-file CACHE-FILE] [--diff] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--sequential] [--] [...]

junstyle pushed a commit that referenced this issue Aug 14, 2024
@junstyle
Copy link
Owner

new version published, test again

@RYRDU
Copy link

RYRDU commented Aug 15, 2024

Works fine after update, thanks

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

3 participants