pik-piam / lucode2

A collection of tools which allow to manipulate and analyze code.
Other
0 stars 16 forks source link

adjust variable = value regexp in manipulateConfig to avoid false positives in comments #205

Closed orichters closed 1 month ago

orichters commented 2 months ago
tscheypidi commented 1 month ago

@orichters for such a critical function it is really complex to have all relevant use cases in mind. That said, your changes look sensible to me. Luckily, we already have some tests capturing the main use cases of the function. Please also add test cases reflecting the new aspects your PR tries to cover (e.g. a test making sure that a comment is not messed up anymore)

orichters commented 1 month ago

I will add some tests, although I am quite confident it works because of this new test in remindmodel that shows that the 1831 messy lines of main.gms are not changed at all by running manipulateConfig with the default configuration.

The more crucial question to me seems to be: is there any possibility where it might be intended to manipulate a line such as

Parameter yourswitch = yourvalue

or something like that, where yourswitch is not at the beginning of the line. I don't see any reason to do that, but I'm not sure enough…

tscheypidi commented 1 month ago

to my understanding the case in which the line starts with "parameter" or similar is already covered by the search&replace pattern2 which you did not change, right?

orichters commented 1 month ago

to my understanding the case in which the line starts with "parameter" or similar is already covered by the search&replace pattern2 which you did not change, right?

Yes, scalars or parameters are not affected by this change.