Skip to content

WIP: Resolve "Improve syntax for variables expressions in 'only' and 'except': AND"

What does this MR do?

This MR adds parsing support for &&, ||, and expression-grouping parenthesis (). The and/or operator additions are fairly straightforward - new Lexeme::Operator class are added for each, evaluating their left and right with the corresponding Ruby operators.

The parenthesis support is somewhat more interesting. We create a new Lexeme subclass called Grouping, which is then inherited by separate OpenParenthesis and CloseParenthesis subclasses. These classes are built to be parsed (into RPN) in a fashion similar to operators, but are not subclasses of Lexeme::Operator because they don't operate with a left and right hand side like operators, or end up in the Parser #tokens_rpn list to be evaluated.

This is a branch off of a community MR opened here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20605

I think this is pretty close, but have pointed out a few places below where I'd like to get some more feedback.

Does this MR meet the acceptance criteria?

Conformity

Performance and testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #43656 (closed) gitlab#31085 (closed)

Edited by Ben Bodenmiller

Merge request reports