Hello everyone
I would like to ask a question about lintr
package and precisely about its indentation customization.
If I understand correctly, using lintr
package allows to check whether a code conforms to The Tidyverse style guide. I use lintr
as part of ESS
installation in Emacs
. So far, this has always worked pretty well.
I use Emacs for almost everything (R, Python, SQL, Rust, etc.) I have a global setting in my Emacs Init file to set tabs equivalent of 4 spaces:
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
However, recently I had to upgrade to a new version of Emacs and I reinstalled everything including ESS
and lintr
. It appears that the latest version of lintr
expects 2 spaces for indentation with tabs and because of this, currently I have loads of warning messages with the latest version of lintr
in my R programs:
[indentation lintr] : Indentation should be 2 spaces but is 4 spaces.
Well, I cannot have two spaces for indentation, first of all because I don't find the code to be readable at all and my existing R programs, all of them have 4 spaces in indentations, and second, as I said earlier, it is a general configuration in my Emacs environment. Therefore, I started looking to see how I might be able to change lintr
settings in this regard. Based on what I read in Using lintr, it seems that by creating a hidden file named .lintr
placed in $HOME
directory, one can customize lintr's
behaviour, something like:
linters: linters_with_defaults(
variable_1 = value,
variable_2 = value,
. . .
)
The problem is that I couldn't manage to find the name of the specific variable allowing to set indentation to 4 spaces instead of tabs. Does anyone have an idea about how to solve this problem?
Thanks in advance.