luisDVA / annotater

Annotate Package Load Calls
https://annotater.liomys.mx/
Other
99 stars 2 forks source link

Fix: Annotate fun calls on code with bad syntax #25

Closed jcrodriguez1989 closed 2 weeks ago

jcrodriguez1989 commented 2 weeks ago

I found a bug with annotate_fun_calls, if the R code has wrong syntax (unparsable code), then the annotated adds "# No used functions found" instead of avoiding this incorrect annotation.

In this file, select is imported from {dplyr}, but the file syntax is incorrect because of the if else,

library(dplyr)
select(mtcars[1, ], mpg)

if else

and it gets this incorrect annotation

library(dplyr) # No used functions found
select(mtcars[1, ], mpg)

if else

I think we should show an error instead of returning this wrong annotation. Ideally, we should ignore the unparsable code, but I don't have an idea on how to build this annotator without parsing the script.

luisDVA commented 2 weeks ago

good find! never even thought of what would happen if the code had problems and couldn't be parsed. I agree that throwing an error is preferable. merging!