Skip to content

Exclusions read from .lintr are depedent of the current working directory #438

@joaopmatias

Description

@joaopmatias

Hi, I recently started using lintr and it's pretty great. Thank you to everyone involved!

I bumped into an issue related with the exclusions extracted from .lintr files. It seems that the lint report depends on the current working directory of the R console.

Running the following script while the working directory was in the root of the project (lintr/)

> lint_package(".")

does not show inst/example/bad.R in the report (since it's path is in .lintr). Then, if I run

> setwd("..")
> lint_package("lintr")

the file inst/example/bad.R shows in the report.

There is a similar issue with lint(). I added a file lintr/inst/example/.lintr with the content

exclusions: list("bad.R")

Then, I ran the commands

> setwd("lintr/inst/example")
> lint("bad.R")

and bad.R did not show up in the report (as expected). However, that was not the case when I ran

> setwd("..")
> lint("example/bad.R")

Furthermore, when run directly from the console, it seems that lint_dir() always ignores the exclusions in .lintr.

Can you clarify if any of these contrasting behaviors are expected, or what the expected behaviors should be?

Thank you
João

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions