1

Is it possible to fail a pull request pipeline if the developer has used the "Bang Operator" ?

We are using dart linter already in our PR pipeline, is there such a rule to enforce the prohibition of the Bang Operator ?

For example, this should not be allowed

Deal deal = widget.deal!
TSR
  • 17,242
  • 27
  • 93
  • 197

1 Answers1

2

You could add that check if you integrate dart-code-metrics (package) to your pipeline. They have that specific rule available avoid-non-null-assertion , see it docs here.

You can install it as an extension to the regular analyzer, so everyone gets the rules enforced at development time. And its also available as a CLI for using in a pipeline.

Codemagic recently added it as an option for their builds if you're using that.

croxx5f
  • 5,163
  • 2
  • 15
  • 36