Closed gabrielmuresan closed 8 years ago
The logs say Time: 1 mins, 0.05 secs; Memory: 3.75Mb
. Doesn't look slow now. Does it happen only the first time you beautify?
Have you tried other beautifiers, such as for JavaScript? Is it only PHPCBF that takes a long time and others work quickly, as expected?
+1 have this exact issue. Link to my gist: https://gist.github.com/jamesaspence/cb81d77bf97fe7f9ac4b36b9af337150
@jamesaspence How would you answer the questions at https://github.com/Glavin001/atom-beautify/issues/893#issuecomment-205807744?
@prettydiff I'm able to run javascript beautifier, it finishes quickly and updates my code. JSON also works instantaneously.
@jamesaspence Thanks
@prettydiff in case you missed it, also posted my debug.md in my previous comment.
Same here, 1min for 1 small file, Fixed 1 files Time: 1 mins, 0.22 secs; Memory: 6.25Mb
So still not fixed?
Firstly, it appears I incorrectly read the log message! I saw the 0.05 secs
and completely ignored the 1 mins,
part in front of it!
Secondly, I should have mentioned that this message is NOT generated by Atom-Beautify.
You can check in the phpcbf
beautifier of Atom-Beautify: https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/phpcbf.coffee
The delay you are experiencing is being created only by running phpcbf
.
Since I read the log as taking only 0.05 secs
instead of the actual 1 mins, 0.05 secs
I thought that running the phpcbf
command had only take 0.05 secs
and Atom-Beautify was somehow taking the remaining 1 minute. Thus, I labelled this as a bug of Atom-Beautify, when really it is a third-party bug of phpcbf
.
I apologize for this misdiagnosis. The real issue is with phpcbf
. I recommend each of you create an Issue over at https://github.com/squizlabs/PHP_CodeSniffer for phpcbf
and the maintainer(s) over there can help you solve this phpcbf
bug.
That doesn't seem correct - I can run phpcbf
separately and have it resolve and finish within a second or two.
@jamesaspence : From your debug.md posted above:
2016-04-14T19:55:27.278Z - debug: [beautifiers/beautifier.coffee] spawn /Users/jamesspence/.composer/vendor/bin/phpcbf 0=--no-patch, 1=--standard=PSR2, 2=/var/folders/kv/cn4pw3r958bfb06jy9991dsh0000gn/T/temp116314-19510-1tav8fx 2016-04-14T19:56:27.325Z - debug: [beautifiers/beautifier.coffee] spawn done 1 Changing into directory /private/var/folders/kv/cn4pw3r958bfb06jy9991dsh0000gn/T Processing temp116314-19510-1tav8fx [PHP => 59 tokens in 15 lines]... DONE in 2ms (4 fixable violations) => Fixing file: 4/4 violations remaining
=> Fixing file: 4/4 violations remaining [made 1 pass]... => Fixing file: 0/4 violations remaining [made 2 passes]... DONE in 4ms => File was overwritten
Fixed 1 files Time: 1 mins, 0.02 secs; Memory: 4Mb
2016-04-14T19:56:27.325Z - verbose: [beautifiers/beautifier.coffee] spawn result 1 Changing into directory /private/var/folders/kv/cn4pw3r958bfb06jy9991dsh0000gn/T Processing temp116314-19510-1tav8fx [PHP => 59 tokens in 15 lines]... DONE in 2ms (4 fixable violations) => Fixing file: 4/4 violations remaining
=> Fixing file: 4/4 violations remaining [made 1 pass]... => Fixing file: 0/4 violations remaining [made 2 passes]... DONE in 4ms => File was overwritten
Fixed 1 files Time: 1 mins, 0.02 secs; Memory: 4Mb
So the message "Time: 1 mins, 0.02 secs; Memory: 4Mb" is generated by phpcbf
itself.
So assuming that phpcbf
is reporting the correct time -- which does appear to correlate with the minute it is taking for each of you -- Atom-Beautify has no control over this.
What Atom-Beautify does control is the command that is executed, which in this case was:
spawn /Users/jamesspence/.composer/vendor/bin/phpcbf 0=--no-patch, 1=--standard=PSR2, 2=/var/folders/kv/cn4pw3r958bfb06jy9991dsh0000gn/T/temp116314-19510-1tav8fx
If there is a particular argument that needs to be added or removed, then this can be done so within Atom-Beautify. The applicable file for phpcbf
beautifier is: https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/phpcbf.coffee
Feel free to submit a Pull Request improving phpcbf
support if you do find that the arguments need to be changed within Atom-Beautify.
Description
The beautification process runs for a ling time, aprox 1 minute or more and the file is beautified
Steps to Reproduce
Debug
Atom Beautify - Debugging information
The following debugging information was generated by
Atom Beautify
onTue Apr 05 2016 11:37:57 GMT+0200 (CEST)
.Table Of Contents
Platform: darwin
Versions
Atom Version: 1.6.2
Atom Beautify Version: 0.29.1
Original file to be beautified
Original File Path:
/Users/muresan/work_folder/bhip-shop-wordpress/wp-content/plugins/bhip-shop-plugins/plugins/bhip-dashboard-widget/bhip-dashboard-widget.php
Original File Grammar: PHP
Original File Language: PHP
Language namespace: php
Supported Beautifiers: PHP-CS-Fixer, PHPCBF
Selected Beautifier: PHPCBF
Original File Contents
Package Settings
The raw package settings options
Beautification options
Editor Options: Options from Atom Editor settings
Config Options: Options from Atom Beautify package settings
Home Options: Options from
/Users/muresan/.jsbeautifyrc
EditorConfig Options: Options from EditorConfig file
Project Options: Options from
.jsbeautifyrc
files starting from directory/Users/muresan/work_folder/bhip-shop-wordpress/wp-content/plugins/bhip-shop-plugins/plugins/bhip-dashboard-widget
and going up to rootPre-Transformed Options: Combined options before transforming them given a beautifier's specifications
Final Options
Final combined and transformed options that are used
Results
Beautified File Contents:
Original vs. Beautified Diff:
Logs