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

New Lint: Avoid too many static code paths #1681

Open
Evrey opened this issue Apr 15, 2017 · 0 comments
Open

New Lint: Avoid too many static code paths #1681

Evrey opened this issue Apr 15, 2017 · 0 comments
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-correctness Lint: Belongs in the correctness lint group L-style Lint: Belongs in the style lint group T-middle Type: Probably requires verifiying types T-MIR Type: This lint will require working with the MIR

Comments

@Evrey
Copy link

Evrey commented Apr 15, 2017

Based on this HIC++ guideline, in addition to the existing cyclomatic complexity lint. It basically comes down to the possible number of branches in a function's code path, not counting loops. E.g. this is okay:

if this { that }
else { or_that } // Just 2 code paths

Wherease this is not so cool:

if this1 { that1(); } // ... 2 paths (do or don't)
if this2 { that2(); } // ... 4 paths
if this3 { that3(); } // ... 8 paths
...
if this10 { that10(); } // ... 1024 paths - Have fun with unit testing!
@oli-obk oli-obk added L-correctness Lint: Belongs in the correctness lint group L-style Lint: Belongs in the style lint group E-medium Call for participation: Medium difficulty level problem and requires some initial experience. A-lint Area: New lints T-middle Type: Probably requires verifiying types T-MIR Type: This lint will require working with the MIR labels Apr 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints E-medium Call for participation: Medium difficulty level problem and requires some initial experience. L-correctness Lint: Belongs in the correctness lint group L-style Lint: Belongs in the style lint group T-middle Type: Probably requires verifiying types T-MIR Type: This lint will require working with the MIR
Projects
None yet
Development

No branches or pull requests

2 participants