Public-Health-Scotland / phsmethods

An R package to standardise methods used in Public Health Scotland (https://public-health-scotland.github.io/phsmethods/)
https://public-health-scotland.github.io/phsmethods/
54 stars 14 forks source link

fix #86 adding verbose inheritance checks #87

Closed JoKPro closed 2 years ago

JoKPro commented 2 years ago

Hi,

I wrote a function that checks for the inheritance, prints out each argument that is lacking one of the specified classes and throws an exception. This is aiming to solve the issue #86 .

I added a new file make_inheritance_checks.R that contains the function, together with some documentation. Hope this helps and let me know if there are any questions!

Moohan commented 2 years ago

I've just seen the tests and lots are failing now, this seems to be because dob_from_chi has NULL by default for min_date andmax_datebut your function is throwing an error when arguments areNULL`.

JoKPro commented 2 years ago

I implemented the cli messages and added an argument ignore_null that lets you decide whether or not to ignore if checked arguments are NULL. Hope this resolves the issue.

JoKPro commented 2 years ago

I see, thanks for the feedback!

JoKPro commented 2 years ago

I implemented the tasks you mentioned and made the tests pass, hope this works!