I've been running into an issue trying to lint a package while passing file exclusions via the .... From my understanding, the ... should be passed from lint_package() -> lint() -> exclude(), which is where I want my exclusions list() to end up. It's a little difficult to provide a reprex but here is an example.
The problem is that the list of excluded files are not being ignored. I have traced the issue to lintr:::exclude(), and it stems from the fact that the filenames in the df object (e.g. df$filename[1]) are written as full absolute paths, whereas the filenames being passed via the ... are provided as relative path(s). So during the vapply() step, the filenames (paths) do not match, and it doesn't know to exclude these "matching" files (i.e. file %in% namex(excl) evaluates to FALSE).
To work around this I have been able to:
use absolute paths in the original call, which is a bit tedious and doesn't appear to be what you had in mind considering the relative_path = argument defaults to TRUE.
I saw in the package README.md where you suggest configuring with a .lintr file with the exclusions supplied there in Debian Control Format. This DOES work! The paths do not get misaligned, so it's a slightly different behavior with passing via the ...
Questions:
Am I using lint_package with exclusions as you intended?
I have some inconveniently long paths, so specifying relative paths (which from your examples you intended to be the case) would be ideal. Besides the package level config with .lintr, do you have any suggestions?
I realize there is a lot more going on under the hood, so I am sorry if this is not a simple work-around. I'd appreciate any advice. BTW, I absolutely lovelintr, thank you so much for putting it together. I have been trying unify our group around common code style and practices for years ... I am hoping pre-commit hooks with lintr will get us there! ;)
Thank you so much,
Stu
The text was updated successfully, but these errors were encountered:
Hello Jim,
I've been running into an issue trying to lint a package while passing file exclusions via the
.... From my understanding, the...should be passed fromlint_package()->lint()->exclude(), which is where I want my exclusionslist()to end up. It's a little difficult to provide areprexbut here is an example.The problem is that the list of excluded files are not being ignored. I have traced the issue to
lintr:::exclude(), and it stems from the fact that the filenames in thedfobject (e.g. df$filename[1]) are written as full absolute paths, whereas the filenames being passed via the...are provided as relative path(s). So during thevapply()step, the filenames (paths) do not match, and it doesn't know to exclude these "matching" files (i.e.file %in% namex(excl)evaluates toFALSE).To work around this I have been able to:
relative_path =argument defaults toTRUE..lintrfile with the exclusions supplied there in Debian Control Format. This DOES work! The paths do not get misaligned, so it's a slightly different behavior with passing via the...Questions:
lint_packagewith exclusions as you intended?.lintr, do you have any suggestions?I realize there is a lot more going on under the hood, so I am sorry if this is not a simple work-around. I'd appreciate any advice. BTW, I absolutely love
lintr, thank you so much for putting it together. I have been trying unify our group around common code style and practices for years ... I am hoping pre-commit hooks withlintrwill get us there! ;)Thank you so much,
Stu
The text was updated successfully, but these errors were encountered: