luisDVA / annotater

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

[BUG] comment starting with 'cr' is displaced to where 'CRAN' repo is annotated #16

Closed Danny-dK closed 2 years ago

Danny-dK commented 2 years ago

https://user-images.githubusercontent.com/45395070/184667101-27b50636-7a5b-4b83-b877-fabaccd5c833.mp4

Danny-dK commented 2 years ago

Within R/align_annotations.R at line 11:

 regex_ai = "(?!\\))(?!\\s)(?=\\#\\sCR|\\#\\sBio|\\#\\snot i|\\#\\s\\[)", sep_str = "") {

Changing the (?=\\#\\sCR| to (?=\\#\\sCRAN| stops the alignment behaviour of comments starting with # cr. I could also imagine changing the ignore.case = TRUE (used throughout) to FALSE could solve the issue as well, but I'm not sure if anything would break if it is case sensitive. I'll leave the choice of one of the solutions up to you.

luisDVA commented 2 years ago

thanks for the heads up and potential solution. I was away but will look into this asap. If you want to submit a pull request please do, otherwise I'll try to test this and implement the fix soon.

Danny-dK commented 2 years ago

No worries, no hurry. I'm not too familiar with the entire code and don't know whether anything else (require calls and such) would break by using possible solutions (also for the ones in the other solutions). So I'll leave it up to you.

luisDVA commented 2 years ago

fixed in the dev version, the regex in the alignment function was not very strict but it's fixed now thanks to your feedback!