dfe-analytical-services / dfeR

Common R tasks in the Department for Education (DfE)
https://dfe-analytical-services.github.io/dfeR/
GNU General Public License v3.0
11 stars 2 forks source link

create_project() has too high a cyclomatic complexity score in linting #77

Closed cjrace closed 1 month ago

cjrace commented 2 months ago

Describe the bug

In the linting the create_project() function is failing on cyclocomp checks.

How to reproduce

Steps to reproduce the behaviour:

  1. Look at the actions logs -

Expected behaviour

This linting check should pass

Screenshots

image

Additional context

From the top of my head I think this is a count of the if / else statements within the function and intended to keep functions from getting overly complex and twisty with various different potential paths. Worth checking Hadley's R packages guide and anything we can find around CRAN guidance on this. Potentially breaking out smaller helper functions might help?

jen-machin commented 2 months ago

This is a nice beginner intro to cyclomatic complexity in case anyone is curious: https://linearb.io/blog/reduce-cyclomatic-complexity