thomaspoignant / go-feature-flag

GO Feature Flag is a simple, complete and lightweight self-hosted feature flag solution 100% Open Source. 🎛️
https://gofeatureflag.org/
MIT License
1.49k stars 148 forks source link

(feature) Detect undefined variations with the linter #2562

Closed kna closed 4 weeks ago

kna commented 1 month ago

Requirements

A flag file might contain undefined variants due to a mistake. I think it is better for the linter to report it as an error.

Example

The following flag file is incorrect because it uses an undefined variation(NOT_IN_VARIATIONS).

# flag.goff.yaml
flag_a:
  variations:
    A: true
    B: false
  defaultRule:
    variation: NOT_IN_VARIATIONS

But the linter does not report an error.

$ docker run --rm \
  -v ./flag.goff.yaml:/flag.goff.yaml \
  gofeatureflag/go-feature-flag-lint:v1.36.1 \
  --input-format=yaml \
  --input-file=/flag.goff.yaml
(no output)
thomaspoignant commented 1 month ago

@kna Yes this is very true, we should add this capability to the linter.

Good catch 👌

thomaspoignant commented 1 month ago

/assign-me

github-actions[bot] commented 1 month ago

👋 Hey @thomaspoignant, thanks for your interest in this issue! 🎉

⚠ Note that this issue will become unassigned if it isn't closed within 10 days.

🔧 A maintainer can also add the 📌 Pinned label to prevent it from being unassigned automatically.

thomaspoignant commented 1 month ago

@kna thanks again for this issue. I have open the PR #2563 to address this, feel free to review it, we will merge it for the next version of GO Feature Flag.

kna commented 1 month ago

@thomaspoignant Thank you for your quick responce and creating the PR!