From 2d8e0a03ae28403cd04c42c5e9d5d4f877841a17 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 17 Sep 2024 15:03:10 +0200 Subject: [PATCH 1/9] address review feedback --- paper/paper.Rmd | 10 +++++++--- paper/paper.bib | 36 +++++++++++++++++++++++++++++++++- paper/paper.md | 52 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 76 insertions(+), 22 deletions(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index 05e3e3f61..d067738d8 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -65,10 +65,12 @@ withr::local_options(list( # Statement of Need -R is an interpreted, dynamically-typed programming language [@base2023]. It is a popular choice for statistical analysis and visualization, and is used by a wide range of researchers and data scientists. The `{lintr}` package is an open-source R package that provides static code analysis [@enwiki:1218663830] to check for a variety of common problems related to readability, efficiency, consistency, style, etc. In particular, by default it enforces the tidyverse style guide [@Wickham2023]. It is designed to be easy to use and integrate into existing workflows, and can be used as part of an automated build or continuous integration process. `{lintr}` also integrates with a number of popular IDEs and text editors, such as RStudio and Visual Studio Code, making it convenient for users to run `{lintr}` checks on their code as they work. +A linter is a tool that automatically analyzes code to identify potential errors, stylistic issues, or deviations from coding standards. It helps ensure consistency, readability, and best practices by flagging common mistakes, such as syntax errors, unused variables, or improper formatting. Linters are essential for improving code quality, preventing bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an open-source package that provides linters for R programming language, which is an interpreted, dynamically-typed programming language [@base2023]. It is a popular choice for statistical analysis and visualization, and is used by a wide range of researchers and data scientists. Therefore, `{lintr}` is a valuable tool for R users to help improve the quality and reliability of their code. # Features +By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems. + As of this writing, `{lintr}` offers `r length(all_linters())` linters. ```{r all_linters} @@ -103,7 +105,7 @@ lint( - **Efficiency** -Sometimes the users might not be aware of a more efficient way offered by R for carrying out a computation. `{lintr}` offers linters to improve code efficiency by avoiding common inefficient patterns. +Sometimes users might not be aware of a more efficient way offered by R for carrying out a computation. `{lintr}` offers linters to improve code efficiency by avoiding common inefficient patterns. For example, the `any_is_na_linter()` linter detects usages of `any(is.na(x))` and suggests `anyNA(x)` as a more efficient alternative to detect presence of *any* missing values. @@ -217,11 +219,13 @@ There are two main ways to customize it: - Create new linters (by leveraging functions like `lintr::make_linter_from_xpath()`) tailored to match project- or organization-specific coding standards. +Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. + # Benefits of using `{lintr}` There are several benefits to using `{lintr}` to analyze and improve R code. One of the most obvious is that it can help users identify and fix problems in their code, which can save time and effort during the development process. By catching issues early on, `{lintr}` can help prevent bugs and other issues from creeping into code, which can save time and effort when it comes to debugging and testing. -Another benefit of `{lintr}` is that it can help users write more readable and maintainable code. By enforcing a consistent style and highlighting potential issues, `{lintr}` can help users write code that is easier to understand and work with. This is especially important for larger projects or teams, where multiple contributors may be working on the same codebase and it is important to ensure that code is easy to follow and understand, particularly when frequently switching context among code primarily authored by different people. +Another benefit of `{lintr}` is that it can help users write more readable and maintainable code. By enforcing a consistent style and highlighting potential issues, `{lintr}` can help users write code that is easier to understand and work with. This is especially important for larger projects or teams, where multiple contributors may be working on the same codebase and it is important to ensure that code is easy to follow and understand, particularly when frequently switching context among code primarily authored by different people. `{lintr}` is designed to be easy to use and integrate into existing workflows, and can be used as part of an automated build or continuous integration process. `{lintr}` also integrates with a number of popular IDEs and text editors, such as RStudio and Visual Studio Code, making it convenient for users to run `{lintr}` checks on their code as they work. It can also be a useful tool for teaching and learning R. By providing feedback on code style and potential issues, it can help users learn good coding practices and improve their skills over time. This can be especially useful for beginners, who may not yet be familiar with all of the best practices for writing R code. diff --git a/paper/paper.bib b/paper/paper.bib index f9578f0c9..0548c9f92 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -32,10 +32,44 @@ @book{mcconnell2004code publisher={Pearson Education} } - @misc{ enwiki:1218663830, +@misc{ enwiki:1218663830, author = "{Wikipedia contributors}", title = "Static program analysis --- {Wikipedia}{,} The Free Encyclopedia", year = "2024", url = "https://en.wikipedia.org/w/index.php?title=Static_program_analysis&oldid=1218663830", note = "[Online; accessed 7-May-2024]" } + +@Manual{Tierney2024, + title = {codetools: Code Analysis Tools for R}, + author = {Luke Tierney}, + year = {2024}, + note = {R package version 0.2-20}, + url = {https://CRAN.R-project.org/package=codetools}, + } + +@Manual{Bacher2024, + title = {flint: Find and Fix Lints in R Code}, + author = {Etienne Bacher}, + year = {2024}, + note = {R package version 0.0.2, +https://github.com/etiennebacher/flint}, + url = {https://flint.etiennebacher.com}, + } + +@Manual{Müller2024, + title = {styler: Non-Invasive Pretty Printing of R Code}, + author = {Kirill Müller and Lorenz Walthert and Indrajeet Patil}, + year = {2024}, + note = {R package version 1.10.3.9000, commit 6d2f0b34245b6bc712bf2fcabf240d9ca814f0ef}, + url = {https://github.com/r-lib/styler}, + } + + @Manual{Padgham2024, + title = {goodpractice: Advice on R Package Building}, + author = {Mark Padgham and Karina Marks and Daniel {de Bortoli} and Gabor Csardi and Hannah Frick and Owen Jones and Hannah Alexander}, + year = {2024}, + note = {R package version 1.0.5, +https://github.com/ropensci-review-tools/goodpractice}, + url = {https://docs.ropensci.org/goodpractice/}, + } diff --git a/paper/paper.md b/paper/paper.md index ebdc1677d..6ee4d2f3a 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,6 +1,6 @@ --- title: "Static Code Analysis for R" -date: "2024-09-05" +date: "2024-09-17" tags: ["R", "linter", "tidyverse"] authors: - name: Jim Hester @@ -51,22 +51,28 @@ link-citations: yes # Statement of Need -R is an interpreted, dynamically-typed programming language [@base2023]. -It is a popular choice for statistical analysis and visualization, and -is used by a wide range of researchers and data scientists. The -`{lintr}` package is an open-source R package that provides static code -analysis [@enwiki:1218663830] to check for a variety of common problems -related to readability, efficiency, consistency, style, etc. In -particular, by default it enforces the tidyverse style guide -[@Wickham2023]. It is designed to be easy to use and integrate into -existing workflows, and can be used as part of an automated build or -continuous integration process. `{lintr}` also integrates with a number -of popular IDEs and text editors, such as RStudio and Visual Studio -Code, making it convenient for users to run `{lintr}` checks on their -code as they work. +A linter is a tool that automatically analyzes code to identify +potential errors, stylistic issues, or deviations from coding standards. +It helps ensure consistency, readability, and best practices by flagging +common mistakes, such as syntax errors, unused variables, or improper +formatting. Linters are essential for improving code quality, preventing +bugs, and maintaining a clean codebase, especially in collaborative +development environments [@enwiki:1218663830]. `{lintr}` is an +open-source package that provides linters for R programming language, +which is an interpreted, dynamically-typed programming language +[@base2023]. It is a popular choice for statistical analysis and +visualization, and is used by a wide range of researchers and data +scientists. Therefore, `{lintr}` is a valuable tool for R users to help +improve the quality and reliability of their code. # Features +By default, `{lintr}` enforces the tidyverse style guide +[@Wickham2023,@Müller2024]. In this respect, it differs from other +static code analysis tools in R (like `{codetools}` [@Tierney2024]), +which are not opinionated and don't enforce any particular style of +writing code, but, rather, check R code for possible problems. + As of this writing, `{lintr}` offers 113 linters. ``` r @@ -115,9 +121,9 @@ lint( - **Efficiency** -Sometimes the users might not be aware of a more efficient way offered -by R for carrying out a computation. `{lintr}` offers linters to improve -code efficiency by avoiding common inefficient patterns. +Sometimes users might not be aware of a more efficient way offered by R +for carrying out a computation. `{lintr}` offers linters to improve code +efficiency by avoiding common inefficient patterns. For example, the `any_is_na_linter()` linter detects usages of `any(is.na(x))` and suggests `anyNA(x)` as a more efficient alternative @@ -285,6 +291,11 @@ lint( `lintr::make_linter_from_xpath()`) tailored to match project- or organization-specific coding standards. +Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters +that are not part of the default set of `{lintr}` linters, while +`{flint}` [@Bacher2024] provides a way to fix the lints detected by +`{lintr}`. + # Benefits of using `{lintr}` There are several benefits to using `{lintr}` to analyze and improve R @@ -301,7 +312,12 @@ is easier to understand and work with. This is especially important for larger projects or teams, where multiple contributors may be working on the same codebase and it is important to ensure that code is easy to follow and understand, particularly when frequently switching context -among code primarily authored by different people. +among code primarily authored by different people. `{lintr}` is designed +to be easy to use and integrate into existing workflows, and can be used +as part of an automated build or continuous integration process. +`{lintr}` also integrates with a number of popular IDEs and text +editors, such as RStudio and Visual Studio Code, making it convenient +for users to run `{lintr}` checks on their code as they work. It can also be a useful tool for teaching and learning R. By providing feedback on code style and potential issues, it can help users learn From c37f43e048c7bfd00ffaab7d169493a30ccbd7f5 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 17 Sep 2024 18:47:57 +0200 Subject: [PATCH 2/9] tweak --- paper/paper.Rmd | 2 +- paper/paper.md | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index d067738d8..a55f801b0 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -65,7 +65,7 @@ withr::local_options(list( # Statement of Need -A linter is a tool that automatically analyzes code to identify potential errors, stylistic issues, or deviations from coding standards. It helps ensure consistency, readability, and best practices by flagging common mistakes, such as syntax errors, unused variables, or improper formatting. Linters are essential for improving code quality, preventing bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an open-source package that provides linters for R programming language, which is an interpreted, dynamically-typed programming language [@base2023]. It is a popular choice for statistical analysis and visualization, and is used by a wide range of researchers and data scientists. Therefore, `{lintr}` is a valuable tool for R users to help improve the quality and reliability of their code. +A linter is a tool that automatically analyzes code to identify potential errors, stylistic issues, or deviations from coding standards. It helps ensure consistency, readability, and best practices by flagging common mistakes, such as syntax errors, unused variables, or improper formatting. Linters are essential for improving code quality, preventing bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an open-source package that provides linters for R programming language, which is an interpreted, dynamically-typed programming language [@base2023], and is used by a wide range of researchers and data scientists. `{lintr}` can thus act as a valuable tool for R users to help improve the quality and reliability of their code. # Features diff --git a/paper/paper.md b/paper/paper.md index 6ee4d2f3a..8f707b064 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -60,10 +60,9 @@ bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an open-source package that provides linters for R programming language, which is an interpreted, dynamically-typed programming language -[@base2023]. It is a popular choice for statistical analysis and -visualization, and is used by a wide range of researchers and data -scientists. Therefore, `{lintr}` is a valuable tool for R users to help -improve the quality and reliability of their code. +[@base2023], and is used by a wide range of researchers and data +scientists. `{lintr}` can thus act as a valuable tool for R users to +help improve the quality and reliability of their code. # Features From 09fb9da94ad9edc2c906e97c783f476439e6288b Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 25 Sep 2024 08:21:13 +0200 Subject: [PATCH 3/9] Update paper/paper.Rmd Co-authored-by: Michael Chirico --- paper/paper.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index a55f801b0..fa0379638 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -65,7 +65,7 @@ withr::local_options(list( # Statement of Need -A linter is a tool that automatically analyzes code to identify potential errors, stylistic issues, or deviations from coding standards. It helps ensure consistency, readability, and best practices by flagging common mistakes, such as syntax errors, unused variables, or improper formatting. Linters are essential for improving code quality, preventing bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an open-source package that provides linters for R programming language, which is an interpreted, dynamically-typed programming language [@base2023], and is used by a wide range of researchers and data scientists. `{lintr}` can thus act as a valuable tool for R users to help improve the quality and reliability of their code. +A linter is a tool that analyzes code to identify potential errors, stylistic issues, or deviations from coding standards. It helps ensure consistency, readability, and best practices by flagging common mistakes, such as syntax errors, unused variables, or improper formatting. Linters are essential for improving code quality, preventing bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an open-source package that provides linters for the R programming language, which is an interpreted, dynamically-typed programming language [@base2023], and is used by a wide range of researchers and data scientists. `{lintr}` can thus act as a valuable tool for R users to help improve the quality and reliability of their code. # Features From 7f87126077d23fc799aa83cf714ad1549881f291 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Thu, 26 Sep 2024 22:12:06 +0200 Subject: [PATCH 4/9] reference more packages --- paper/.gitignore | 1 + paper/paper.Rmd | 6 +++--- paper/paper.bib | 36 ++++++++++++++++++++++++++++++++++-- paper/paper.md | 28 ++++++++++++++++------------ 4 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 paper/.gitignore diff --git a/paper/.gitignore b/paper/.gitignore new file mode 100644 index 000000000..075b2542a --- /dev/null +++ b/paper/.gitignore @@ -0,0 +1 @@ +/.quarto/ diff --git a/paper/paper.Rmd b/paper/paper.Rmd index fa0379638..4f083bff2 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -46,7 +46,7 @@ output: standalone: true bibliography: paper.bib csl: apa.csl -link-citations: yes +link-citations: true --- ```{r setup, warning=FALSE, message=FALSE, echo=FALSE} @@ -69,7 +69,7 @@ A linter is a tool that analyzes code to identify potential errors, stylistic is # Features -By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems. +By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems. Additionally, `{lintr}` doesn't cover linting inline code for documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for linting `{roxygen2}` comments [@Wickham2024roxy]). As of this writing, `{lintr}` offers `r length(all_linters())` linters. @@ -219,7 +219,7 @@ There are two main ways to customize it: - Create new linters (by leveraging functions like `lintr::make_linter_from_xpath()`) tailored to match project- or organization-specific coding standards. -Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. +Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024]. # Benefits of using `{lintr}` diff --git a/paper/paper.bib b/paper/paper.bib index 0548c9f92..278bde85a 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -49,7 +49,7 @@ @Manual{Tierney2024 } @Manual{Bacher2024, - title = {flint: Find and Fix Lints in R Code}, + title = {flint: Find and Fix Lints in {R} Code}, author = {Etienne Bacher}, year = {2024}, note = {R package version 0.0.2, @@ -65,7 +65,7 @@ @Manual{Müller2024 url = {https://github.com/r-lib/styler}, } - @Manual{Padgham2024, +@Manual{Padgham2024, title = {goodpractice: Advice on R Package Building}, author = {Mark Padgham and Karina Marks and Daniel {de Bortoli} and Gabor Csardi and Hannah Frick and Owen Jones and Hannah Alexander}, year = {2024}, @@ -73,3 +73,35 @@ @Manual{Padgham2024 https://github.com/ropensci-review-tools/goodpractice}, url = {https://docs.ropensci.org/goodpractice/}, } + +@Manual{Rudolph2024, + title = {box: Write Reusable, Composable and Modular {R} Code}, + author = {Konrad Rudolph}, + year = {2024}, + note = {R package version 1.2.0}, + url = {https://CRAN.R-project.org/package=box}, + } + +@Manual{Basa2024, + title = {box.linters: Linters for 'box' Modules}, + author = {Ricardo Rodrigo Basa and Jakub Nowicki}, + year = {2024}, + note = {R package version 0.10.5}, + url = {https://CRAN.R-project.org/package=box.linters}, + } + +@Manual{Kelkhoff2024, + title = {roxylint: Lint 'roxygen2'-Generated Documentation}, + author = {Doug Kelkhoff}, + year = {2024}, + note = {R package version 0.1.0}, + url = {https://CRAN.R-project.org/package=roxylint}, + } + +@Manual{Wickham2024roxy, + title = {roxygen2: In-Line Documentation for {R}}, + author = {Hadley Wickham and Peter Danenberg and Gábor Csárdi and Manuel Eugster}, + year = {2024}, + note = {R package version 7.3.2}, + url = {https://CRAN.R-project.org/package=roxygen2}, + } diff --git a/paper/paper.md b/paper/paper.md index 8f707b064..e0e77607b 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,6 +1,6 @@ --- title: "Static Code Analysis for R" -date: "2024-09-17" +date: "2024-09-26" tags: ["R", "linter", "tidyverse"] authors: - name: Jim Hester @@ -46,23 +46,23 @@ output: standalone: true bibliography: paper.bib csl: apa.csl -link-citations: yes +link-citations: true --- # Statement of Need -A linter is a tool that automatically analyzes code to identify -potential errors, stylistic issues, or deviations from coding standards. -It helps ensure consistency, readability, and best practices by flagging -common mistakes, such as syntax errors, unused variables, or improper +A linter is a tool that analyzes code to identify potential errors, +stylistic issues, or deviations from coding standards. It helps ensure +consistency, readability, and best practices by flagging common +mistakes, such as syntax errors, unused variables, or improper formatting. Linters are essential for improving code quality, preventing bugs, and maintaining a clean codebase, especially in collaborative development environments [@enwiki:1218663830]. `{lintr}` is an -open-source package that provides linters for R programming language, -which is an interpreted, dynamically-typed programming language -[@base2023], and is used by a wide range of researchers and data -scientists. `{lintr}` can thus act as a valuable tool for R users to -help improve the quality and reliability of their code. +open-source package that provides linters for the R programming +language, which is an interpreted, dynamically-typed programming +language [@base2023], and is used by a wide range of researchers and +data scientists. `{lintr}` can thus act as a valuable tool for R users +to help improve the quality and reliability of their code. # Features @@ -71,6 +71,9 @@ By default, `{lintr}` enforces the tidyverse style guide static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems. +Additionally, `{lintr}` doesn't cover linting inline code for +documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for linting +`{roxygen2}` comments [@Wickham2024roxy]). As of this writing, `{lintr}` offers 113 linters. @@ -293,7 +296,8 @@ lint( Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by -`{lintr}`. +`{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to +support `{box}` modules [@Rudolph2024]. # Benefits of using `{lintr}` From 0acef0965339afa5961bcc0d62c7b85104e4c488 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sat, 28 Sep 2024 16:35:39 +0200 Subject: [PATCH 5/9] codetools as backend --- paper/paper.Rmd | 2 +- paper/paper.md | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index 4f083bff2..4f3d31a09 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -69,7 +69,7 @@ A linter is a tool that analyzes code to identify potential errors, stylistic is # Features -By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems. Additionally, `{lintr}` doesn't cover linting inline code for documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for linting `{roxygen2}` comments [@Wickham2024roxy]). +By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems (incidentally, `{lintr}` uses `{codetools}` as a backend for object usage linters). Additionally, `{lintr}` doesn't cover linting inline code for documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for linting `{roxygen2}` comments [@Wickham2024roxy]). As of this writing, `{lintr}` offers `r length(all_linters())` linters. diff --git a/paper/paper.md b/paper/paper.md index e0e77607b..0f0123fe3 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,6 +1,6 @@ --- title: "Static Code Analysis for R" -date: "2024-09-26" +date: "2024-09-28" tags: ["R", "linter", "tidyverse"] authors: - name: Jim Hester @@ -70,10 +70,11 @@ By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of -writing code, but, rather, check R code for possible problems. -Additionally, `{lintr}` doesn't cover linting inline code for -documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for linting -`{roxygen2}` comments [@Wickham2024roxy]). +writing code, but, rather, check R code for possible problems +(incidentally, `{lintr}` uses `{codetools}` as a backend for object +usage linters). Additionally, `{lintr}` doesn't cover linting inline +code for documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for +linting `{roxygen2}` comments [@Wickham2024roxy]). As of this writing, `{lintr}` offers 113 linters. From 8705a3437fa7f973c8cd30dea2b602e0e7ec5b8d Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Sun, 29 Sep 2024 21:22:53 +0200 Subject: [PATCH 6/9] also include checklist --- paper/paper.Rmd | 2 +- paper/paper.bib | 10 ++++++++++ paper/paper.md | 5 +++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index 4f3d31a09..dc2b97864 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -219,7 +219,7 @@ There are two main ways to customize it: - Create new linters (by leveraging functions like `lintr::make_linter_from_xpath()`) tailored to match project- or organization-specific coding standards. -Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024]. +Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024], while `{checklist}` includes linters as one of the strict checks for R packages [@Onkelinx2024]. # Benefits of using `{lintr}` diff --git a/paper/paper.bib b/paper/paper.bib index 278bde85a..329f7c403 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -105,3 +105,13 @@ @Manual{Wickham2024roxy note = {R package version 7.3.2}, url = {https://CRAN.R-project.org/package=roxygen2}, } + +@Manual{Onkelinx2024, + title = {checklist: A Thorough and Strict Set of Checks for {R} Packages and Source Code. Version 0.4.0}, + author = {Thierry Onkelinx}, + year = {2024}, + url = {https://inbo.github.io/checklist/}, + abstract = {An opinionated set of rules for R packages and R source code projects.}, + keywords = {quality control; documentation; publication}, + doi = {10.5281/zenodo.4028303}, + } diff --git a/paper/paper.md b/paper/paper.md index 0f0123fe3..7e90bf7c8 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,6 +1,6 @@ --- title: "Static Code Analysis for R" -date: "2024-09-28" +date: "2024-09-29" tags: ["R", "linter", "tidyverse"] authors: - name: Jim Hester @@ -298,7 +298,8 @@ Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to -support `{box}` modules [@Rudolph2024]. +support `{box}` modules [@Rudolph2024], while `{checklist}` includes +linters as one of the strict checks for R packages [@Onkelinx2024]. # Benefits of using `{lintr}` From 2a608655a1da403f5f05bc9ee7d3dee593e4b620 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Tue, 1 Oct 2024 23:39:32 +0200 Subject: [PATCH 7/9] tweak roxygen part --- paper/paper.Rmd | 2 +- paper/paper.md | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index dc2b97864..39c81c28d 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -69,7 +69,7 @@ A linter is a tool that analyzes code to identify potential errors, stylistic is # Features -By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems (incidentally, `{lintr}` uses `{codetools}` as a backend for object usage linters). Additionally, `{lintr}` doesn't cover linting inline code for documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for linting `{roxygen2}` comments [@Wickham2024roxy]). +By default, `{lintr}` enforces the tidyverse style guide [@Wickham2023,@Müller2024]. In this respect, it differs from other static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems (incidentally, `{lintr}` uses `{codetools}` as a backend for object usage linters). Additionally, `{lintr}` is concerned only with R code, so code-adjacent text like inline `{roxygen2}` comments [@Wickham2024roxy] will not be covered (cf. `{roxylint}` [@Kelkhoff2024]). As of this writing, `{lintr}` offers `r length(all_linters())` linters. diff --git a/paper/paper.md b/paper/paper.md index 7e90bf7c8..a4214e90a 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,6 +1,6 @@ --- title: "Static Code Analysis for R" -date: "2024-09-29" +date: "2024-10-01" tags: ["R", "linter", "tidyverse"] authors: - name: Jim Hester @@ -72,9 +72,10 @@ static code analysis tools in R (like `{codetools}` [@Tierney2024]), which are not opinionated and don't enforce any particular style of writing code, but, rather, check R code for possible problems (incidentally, `{lintr}` uses `{codetools}` as a backend for object -usage linters). Additionally, `{lintr}` doesn't cover linting inline -code for documentation generation (cf. `{roxylint}` [@Kelkhoff2024] for -linting `{roxygen2}` comments [@Wickham2024roxy]). +usage linters). Additionally, `{lintr}` is concerned only with R code, +so code-adjacent text like inline `{roxygen2}` comments +[@Wickham2024roxy] will not be covered (cf. `{roxylint}` +[@Kelkhoff2024]). As of this writing, `{lintr}` offers 113 linters. From 0c2c3f62d529db75437d4fe017048de7d788a458 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 2 Oct 2024 07:51:18 +0200 Subject: [PATCH 8/9] Update paper.Rmd Co-authored-by: Michael Chirico --- paper/paper.Rmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index 39c81c28d..c29db4496 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -219,7 +219,8 @@ There are two main ways to customize it: - Create new linters (by leveraging functions like `lintr::make_linter_from_xpath()`) tailored to match project- or organization-specific coding standards. -Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{flint}` [@Bacher2024] provides a way to fix the lints detected by `{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024], while `{checklist}` includes linters as one of the strict checks for R packages [@Onkelinx2024]. +Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024] and `{checklist}` includes linters as one of the strict checks for R packages [@Onkelinx2024]. `{flint}` [@Bacher2024] +is a Rust-backed analogue inspired by {lintr} that also provides support for fixing lints. # Benefits of using `{lintr}` From 2c088b18da2bc460bd14b1dd497ebcde21b36e18 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 2 Oct 2024 07:53:29 +0200 Subject: [PATCH 9/9] knit --- paper/paper.Rmd | 3 +-- paper/paper.md | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/paper/paper.Rmd b/paper/paper.Rmd index c29db4496..e6f08cb0b 100644 --- a/paper/paper.Rmd +++ b/paper/paper.Rmd @@ -219,8 +219,7 @@ There are two main ways to customize it: - Create new linters (by leveraging functions like `lintr::make_linter_from_xpath()`) tailored to match project- or organization-specific coding standards. -Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024] and `{checklist}` includes linters as one of the strict checks for R packages [@Onkelinx2024]. `{flint}` [@Bacher2024] -is a Rust-backed analogue inspired by {lintr} that also provides support for fixing lints. +Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while `{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules [@Rudolph2024] and `{checklist}` includes linters as one of the strict checks for R packages [@Onkelinx2024]. `{flint}` [@Bacher2024] is a Rust-backed analogue inspired by `{lintr}` that also provides support for fixing lints. # Benefits of using `{lintr}` diff --git a/paper/paper.md b/paper/paper.md index a4214e90a..27793ea75 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,6 +1,6 @@ --- title: "Static Code Analysis for R" -date: "2024-10-01" +date: "2024-10-02" tags: ["R", "linter", "tidyverse"] authors: - name: Jim Hester @@ -297,10 +297,11 @@ lint( Indeed, `{goodpractice}` [@Padgham2024] bundles a set of custom linters that are not part of the default set of `{lintr}` linters, while -`{flint}` [@Bacher2024] provides a way to fix the lints detected by -`{lintr}`. Moreover, `{box.linters}` [@Basa2024] extends `{lintr}` to -support `{box}` modules [@Rudolph2024], while `{checklist}` includes -linters as one of the strict checks for R packages [@Onkelinx2024]. +`{box.linters}` [@Basa2024] extends `{lintr}` to support `{box}` modules +[@Rudolph2024] and `{checklist}` includes linters as one of the strict +checks for R packages [@Onkelinx2024]. `{flint}` [@Bacher2024] is a +Rust-backed analogue inspired by `{lintr}` that also provides support +for fixing lints. # Benefits of using `{lintr}`