You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've made an announcement also on uncrustify's googlegroup forum but I'm not sure if the message was received. I'm going to use github to send this message instead while this is not an actual issue.
We have gathered a lot of issues 60+ in our internal issue tracker. I have prepared some scripts to extract them and create github issues. I've been experimenting in my fork which you can review upfront. I'm afraid though some of them will be quite confusing but I will get back with explanations.
Let me know if there are other concerns before proceeding.
Nope, I did not even know that there is a google group out there for Uncrustify.
There are some duplicated issues, but the older ones of those had broken url's, so I assume the problem is fixed and there will be no duplicates in the end.
Some of the issues are generally a bit older but fortunately it appears that they (all?) have the full version string: # Uncrustify 0.63.584-gd2d8b38e
The issues were discovered in the unity fork right?
Some of the issues might not exists anymore, but other than that I see no problems.
The googlegroup mailinglist was created to discuss general topics, design, architecture, plans, etc., not necessarily issues. Also, sometimes it's just too much noise on github. Do not hesitate to propose other means of communication.
Yes, the issues are created against our fork but they also fail against master. I'll re-run them on latest master and recreate the issues.
@CDanU I think I'll have to minimize the config as for some tests, we're using new options only present in our fork. I'm going to try your option_reducer.py script.
No, includes are not supported, as my goal at that time was to remove them.
It should be possible to add that functionality, just don't forget that at a later point in the config the included options can be overwritten by the local options.
I am not entirely sure what you mean by
tests using the same config
The option_reducer.py script works on a single config file, but you can specify multiple input- and expected output files
The problem is that there is a bug somewhere in option_reducer.py as it sometimes deletes the wrong options or leaves options that could be removed (that's the reason why I had to add a second sanity test). It is most likely a logical bug. Some options are quiet intertwined, maybe it is related to the order in which the options are removed.
To get the best results I sometimes have to run it multiple times.
Also I had to find out that pythons threading apparently does not really use multiple cores (global interpreter lock - GIL). It just processes something else while it is waiting for I/O. Threads should be replaced by processes.
Another nice to have would be to let the processes use a job queue instead of the current batch processing in order to let every process work continuously without having to wait until all tests from a batch are finished (possibly including a test that takes much longer than others). This theoretically could increase the speed but I am not entirely sure, the blocking for the queue could make things even slower for the generally fairly small tasks that are processed with this script.
How does it generate the configs ? How do you remove the config options ?
Looking at the code, I see that you are removing them one by one and checking if the output is preserved. If not, the option is important and should not be removed. Right?
Also, set doesn't seems to work, even if there is code that should handle it.
set = MACRO_FUNC ATTRIBUTE_ALIGN
set = COMMENT F_STDCALL
set = COMMENT PLATFORM_EXCEPTION_SAFEGUARD_PROLOG
set = COMMENT WINAPI
set = COMMENT __cdecl
If I can't make it work, I might just end up commenting our options and see if they produce the same result. I don't think the bugs are not dependent on the options we've added but I thought it would be nice if we can have the configs reduced.
How does it generate the configs ? How do you remove the config options ?
Looking at the code, I see that you are removing them one by one and checking if the output is preserved. If not, the option is important and should not be removed. Right?
Yes that is how it works. It generates configs where one option is missing and tests if the expected output is still generated, if so the option can be dropped.
Each thread starts split_write_config_file with a start and end index (each batch has a range it operates in), in a loop every option in that range is set as exclude_idx once and the the config file is written with write_config_file. It writes every option that is not indexed by the exclude_idx into a config file.
I'll take a look later that day to see what's wrong with the set.
Reducing the configs is always nice, the options that are unknown to Uncrustify should be removed, if the formatting depends on it the script will complain that it can't generate the expected result from the get go (first sanity run).
Yes, that works if you don't mind that the include is removed.
I had in mind to read the include script, store its options in a separate data structure, check for overwrites of those options, add the non overwritten options to the other options, process them normally and then write the include directives and only the reduced options that where not marked as imported.
The problem with that would be to handle includes that are not placed at the top of the file.
You could make a 'fork' of my script and integrate your option. That way we will have one script that in the end, at some point, will be cleansed of the current bugs.
Alternatively in order to keep the history I can open up a separate github project for the script and give you full access to it (or vice versa). The complete history of that could be later integrated into the Uncrustify repo.
But actually my idea was to generate new configs and leave the old ones behind and edit the .test file instead (or create a new one). If, at the end of the process there are orphan configs we can remove them. It's complicated with include directive as you can't just edit those base config files.
For #1128 I did this:
In cases where a bunch of tests used for example ben.cfg, I grepped every test that used that config and added all of them with the ben.cfg into the script to reduce the options across all tests.
Later I just copied that ben.cfg N times for each test and then reduced for each specific test.
The include files where handled by just replacing (manually if I remember) the include directive with the file contents. That could be handled by the option that you implemented.
Keeping the old config files until the end is fine by me.
Ok, I've made a fork but we can have a branch against upstream and we can put them in the scripts folder (where I suppose you have them).
I had a clean git repo in mind but we also can arrange it like an upstream branch. Yes the scripts dir would be suitable.
First batch of issues are created. I've realised that the config is not helpful as it's includes are not resolved but it can be extracted with a little bit of work out of the .unc file. I can create also a PR against master with all staging tests. Maybe that will help.
If it helps, unlike other issues, the last batch of 9 issues: #1284, #1285, #1286, #1287, #1288, #1289, #1290, #1291 and #1292 are regressions introduced between 0.63 and latest master.
Activity
CDanU commentedon Jul 3, 2017
Nope, I did not even know that there is a google group out there for Uncrustify.
There are some duplicated issues, but the older ones of those had broken url's, so I assume the problem is fixed and there will be no duplicates in the end.
Some of the issues are generally a bit older but fortunately it appears that they (all?) have the full version string:
# Uncrustify 0.63.584-gd2d8b38eThe issues were discovered in the unity fork right?
Some of the issues might not exists anymore, but other than that I see no problems.
Btw. gmaurel will be unreachable for some weeks.
mihaipopescu commentedon Jul 4, 2017
The googlegroup mailinglist was created to discuss general topics, design, architecture, plans, etc., not necessarily issues. Also, sometimes it's just too much noise on github. Do not hesitate to propose other means of communication.
Yes, the issues are created against our fork but they also fail against master. I'll re-run them on latest master and recreate the issues.
mihaipopescu commentedon Jul 5, 2017
@CDanU I think I'll have to minimize the config as for some tests, we're using new options only present in our fork. I'm going to try your option_reducer.py script.
mihaipopescu commentedon Jul 5, 2017
I assume the scripts don't support
includeand tests using the same config. I'll make some scripts to satisfy these requirements.CDanU commentedon Jul 5, 2017
No, includes are not supported, as my goal at that time was to remove them.
It should be possible to add that functionality, just don't forget that at a later point in the config the included options can be overwritten by the local options.
I am not entirely sure what you mean by
The option_reducer.py script works on a single config file, but you can specify multiple input- and expected output files
mihaipopescu commentedon Jul 6, 2017
Ok, cool. I was using
auto_reducer.py. Btw, nice scripts. Would be very nice to have them in uncrustify.CDanU commentedon Jul 6, 2017
The problem is that there is a bug somewhere in
option_reducer.pyas it sometimes deletes the wrong options or leaves options that could be removed (that's the reason why I had to add a second sanity test). It is most likely a logical bug. Some options are quiet intertwined, maybe it is related to the order in which the options are removed.To get the best results I sometimes have to run it multiple times.
Also I had to find out that pythons threading apparently does not really use multiple cores (global interpreter lock - GIL). It just processes something else while it is waiting for I/O. Threads should be replaced by processes.
Another nice to have would be to let the processes use a job queue instead of the current batch processing in order to let every process work continuously without having to wait until all tests from a batch are finished (possibly including a test that takes much longer than others). This theoretically could increase the speed but I am not entirely sure, the blocking for the queue could make things even slower for the generally fairly small tasks that are processed with this script.
mihaipopescu commentedon Jul 6, 2017
How does it generate the configs ? How do you remove the config options ?
Looking at the code, I see that you are removing them one by one and checking if the output is preserved. If not, the option is important and should not be removed. Right?
Also,
setdoesn't seems to work, even if there is code that should handle it.If I can't make it work, I might just end up commenting our options and see if they produce the same result. I don't think the bugs are not dependent on the options we've added but I thought it would be nice if we can have the configs reduced.
CDanU commentedon Jul 6, 2017
Yes that is how it works. It generates configs where one option is missing and tests if the expected output is still generated, if so the option can be dropped.
Each thread starts
split_write_config_filewith a start and end index (each batch has a range it operates in), in a loop every option in that range is set asexclude_idxonce and the the config file is written withwrite_config_file. It writes every option that is not indexed by theexclude_idxinto a config file.I'll take a look later that day to see what's wrong with the
set.Reducing the configs is always nice, the options that are unknown to Uncrustify should be removed, if the formatting depends on it the script will complain that it can't generate the expected result from the get go (first sanity run).
mihaipopescu commentedon Jul 6, 2017
To support
includeI've wrote this script to take the non-default options using uncrustify. It could be a first step in the option remover script.CDanU commentedon Jul 6, 2017
Yes, that works if you don't mind that the
includeis removed.I had in mind to read the include script, store its options in a separate data structure, check for overwrites of those options, add the non overwritten options to the other options, process them normally and then write the include directives and only the reduced options that where not marked as imported.
The problem with that would be to handle includes that are not placed at the top of the file.
You could make a 'fork' of my script and integrate your option. That way we will have one script that in the end, at some point, will be cleansed of the current bugs.
Alternatively in order to keep the history I can open up a separate github project for the script and give you full access to it (or vice versa). The complete history of that could be later integrated into the Uncrustify repo.
CDanU commentedon Jul 6, 2017
Btw. an empty input file with this command should be better:
uncrustify --check -c cfg -f /dev/null -p dbgmihaipopescu commentedon Jul 6, 2017
Ok, I've made a fork but we can have a branch against upstream and we can put them in the
scriptsfolder (where I suppose you have them).Yes, using an empty file would be better (unsure if
/dev/nullwill work on Windows though - could be justnul).mihaipopescu commentedon Jul 6, 2017
But actually my idea was to generate new configs and leave the old ones behind and edit the
.testfile instead (or create a new one). If, at the end of the process there are orphan configs we can remove them. It's complicated withincludedirective as you can't just edit those base config files.CDanU commentedon Jul 6, 2017
I handled the win null device this way:
For #1128 I did this:
In cases where a bunch of tests used for example
ben.cfg, I grepped every test that used that config and added all of them with theben.cfginto the script to reduce the options across all tests.Later I just copied that
ben.cfgN times for each test and then reduced for each specific test.The include files where handled by just replacing (manually if I remember) the include directive with the file contents. That could be handled by the option that you implemented.
Keeping the old config files until the end is fine by me.
I had a clean git repo in mind but we also can arrange it like an upstream branch. Yes the scripts dir would be suitable.
guy-maurel commentedon Jul 9, 2017
Fine!
Lets go on.
mihaipopescu commentedon Jul 11, 2017
First batch of issues are created. I've realised that the config is not helpful as it's includes are not resolved but it can be extracted with a little bit of work out of the
.uncfile. I can create also a PR against master with all staging tests. Maybe that will help.mihaipopescu commentedon Jul 18, 2017
If it helps, unlike other issues, the last batch of 9 issues: #1284, #1285, #1286, #1287, #1288, #1289, #1290, #1291 and #1292 are regressions introduced between 0.63 and latest master.
mihaipopescu commentedon Jul 18, 2017
Thanks @CDanU for taking a first dive on most of the issues posted.
guy-maurel commentedon Feb 16, 2018
@mihaipopescu : All the issues are solved, Thanks to UT people!
Please make a test with the current git master, report and move back.
mihaipopescu commentedon Feb 17, 2018
Will do, thanks @gmaurel!