McCabe Cycles In Flutter

The Dart Code Metrics Plugin

dev_dependencies:
dart_code_metrics: ^2.4.0
analyzer:
plugins:
- dart_code_metrics
dart_code_metrics:
anti-patterns:
- long-method
- long-parameter-list
metrics:
cyclomatic-complexity: 20
lines-of-executable-code: 50
number-of-arguments: 4
maximum-nesting: 5
rules:
- newline-before-return
- no-boolean-literal-compare
- no-empty-block
- prefer-trailing-comma
- prefer-conditional-expressions
- no-equal-then-else
flutter pub global activate dart_code_metrics
flutter pub global run dart_code_metrics:metrics lib --reporter=html

McCabe Cycle Background

M = E − N + 2P
E = the number of edges of the graph.
N = the number of nodes of the graph.
P = the number of connected components.

Conclusion

Resources

About Fred Grott

Flutter Cross Platform Mobile App Design https://fred.grott.gitlab.io/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store