-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
More expressive factor condition expression support #698
Comments
@jurko-gospodnetic can you come up with a few examples where this would help? |
Simple example shortening a conditional expression could be:
which could be shortened to just:
showing us how this effectively provides similar expansion support as we have when defining an This makes the code more maintainable as for instance, if you want to add factor Another interesting use case is based on the fact that But again, parenthesis do not bring new features to the table, same as in boolean expressions where |
I think it's syntatic sugar, but from a configuration point of view is new feature. Feel free to go ahead with a PR for it. I suggest making the config.py a module (config, what it's in config.py move it into the |
Personally I am not a big fan of extending the existing configuration format even more. A lot of bugs and feature requests have to do with the shortcomings of the existing format and weaknesses in the homegrown parsing of it, so I would suggest slowly freezing the existing format and declare it feature complete and only fix bugs for it and see if we can get the advanced expressiveness that is wished for by a (in my estimation) small subset of users by introducing a new configuration format that is more powerfull and malleable. |
@jurko-gospodnetic The new proposed syntax sounds practical as it allows in many cases using shorter and more readable expressions. I understand the @obestwalter reservation but the proposal sounds relatively conservative (just simplify syntax without adding new logical operations). If the proposal:
it may contribute to both expression readability well as to fixing some older issues related to these expressions. |
creating a hypothesis model that captures the desired behaviours may be able to help sorting out the issues in more detail (as traditional testing is simply not up to the task) |
Proposing to close as wontfix and referring this (or something along those lines) to be implemented in #999. |
Agree with @obestwalter. |
We currently support the following operators in tox's factor condition expressions:
,
foror
-
forand
!
fornot
(added in issue Negated factor conditions. #292)but this support can be updated to be more expressive by supporting
(
/)
parenthesis for grouping.This would not allow any additional meaning that can not already be expressed using currently available support, but it would help by allowing us to make complex expressions shorter and possibly closer to the way developer has the logic envisioned in their mind.
It would also possibly help clean up the code by allowing us to extract the factor condition parsing into a separate grammar parsing module instead of being just kinda quick-fixed into the
config.py
module.The text was updated successfully, but these errors were encountered: