Skip to content

Disable Lintr but keep other diagnostic errors #456

Closed

Description

I was looking to see if there was a way to disable or edit the lintr warnings generated when r.lsp Diagnostics were turned on?

The errors that are generated when it is enabled are extremely useful, however most/all of the lintr warnings are irrelevant to the code base we are working on.

Sorry if this question has already been posted, but I have been searching through all the issues and other sites trying to find out this information, any assistance would be appreciated!
Thank you

Activity

  1. renkun-ken commented on Jul 16, 2021

    @renkun-ken
    Member

    Do you want to disable specific linters globally or disable linting for specific files or projects?

  2. renkun-ken commented on Jul 16, 2021

    @renkun-ken
    Member

    Please take a look at https://github.com/jimhester/lintr#project-configuration which might be useful. Putting the config in ~/.lintr takes effect globally, while ${workspaceFolder} does only within the project.

  3. renkun-ken commented on Jul 16, 2021

    @renkun-ken
    Member

    Currently, all diagnostics in VS Code come from lintr, i.e. a collection of linters each checks a specific aspect of the code. The .lintr config will work no matter what IDE you use. If you edit your global lintr config (e.g. via file.edit("~/.lintr")) and put the following code in it:

    linters: with_defaults(
      line_length_linter(120), 
      commented_code_linter = NULL
    )

    then it will make all lintr::lint() deviate from the defaults with the specified settings above if lint(linters=) is not specified.

    If you only want to change the linting of your particular project, then put the same file in your workspace folder (e.g. in the workspace folder in vscode terminal, file.edit(".lintr")). lintr will pick up this file instead of the global config file.

  4. renkun-ken commented on Jul 16, 2021

    @renkun-ken
    Member

    You could take a look at the names of the linter you want to disable, and write them like commented_code_linter = NULL to disable them.

  5. ghost closed this as completedon Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions