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

feat: enforce catch-all rule in features with configuration #305

Merged
merged 1 commit into from
May 26, 2024

Conversation

fahad19
Copy link
Member

@fahad19 fahad19 commented May 25, 2024

Background

Featurevisor lets you define rules in features against individual environments: https://featurevisor.com/docs/features/#rules

Currently, there's no strict requirement to have a catch-all rule (matching everyone) as the last rule inside individual environments:

# features/my_feature.yml

# ...

environments:
  production:
    - key: nl
      segments: netherlands
      percentage: 100

    # this is optional in Featurevisor
    - key: everyone
      segments: "*" # catch-all
      percentage: 0

What's done

A new project configuration has been introduced:

// featurevisor.config.js
module.exports = {
  // ...

  enforceCatchAllRule: true, // false by default
};

If set to true, linting will fail if there are any features found that do not have a catch-all rule in any environment:

$ npx featurevisor lint

@fahad19 fahad19 self-assigned this May 25, 2024
@fahad19 fahad19 merged commit bfcd01a into main May 26, 2024
1 check passed
@fahad19 fahad19 deleted the lint-catch-all-rule branch May 26, 2024 15:33
fahad19 added a commit that referenced this pull request Aug 13, 2024
* main: (48 commits)
  [skip ci] docs: bucketing
  v1.27.0
  feat: Plugins API (#318)
  docs: updates
  docs: add Swift SDK section (#317)
  v1.26.0
  feat: allow building datafiles without making changes to state files (#314)
  v1.25.0
  feat: allow showing authors when finding unused entities (#313)
  v1.24.0
  feat: show variables count from CLI (#310)
  v1.23.0
  feat: enforce catch-all rule in features with configuration (#305)
  v1.22.1
  fix: issue with first variation having weight of 0 (#273)
  v1.22.0
  feat: show project info in CLI (#304)
  docs: deprecation (#302)
  v1.21.0
  feat: make test runner fast by default (#301)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant