Skip to content
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

Add a rule no-comparison-of-unary-test #33

Open
barmac opened this issue Jan 24, 2025 · 0 comments
Open

Add a rule no-comparison-of-unary-test #33

barmac opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@barmac
Copy link
Member

barmac commented Jan 24, 2025

Is your feature request related to a problem? Please describe.

This is a valid FEEL expression: foo == bar
However, it will always evaluate to null. That's because we are comparing variable foo to an unary test: = bar.
This will bite any FEEL novice who wrote code before as most programming languages use double or even triple = for comparisons.

Describe the solution you'd like

Warn a user when they pass a unary test to a comparison:

Comparison [0, 10]
  VariableName [0, 3]
  CompareOp [4, 5]
  SimplePositiveUnaryTest [5, 10]
    CompareOp [5, 6]
    VariableName [7, 10]

Describe alternatives you've considered

Require to enclose unary test in parenthesis. However, that does not solve the problem, and is cumbersome when we actually want to use an inline unary test: foo in (100, >100)

Additional context

Discovered in bpmn-io/properties-panel#394

@barmac barmac added the enhancement New feature or request label Jan 24, 2025
@barmac barmac added the backlog label Feb 4, 2025 — with bpmn-io-tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant