refactor: enable lintr for tests, inst, and vignettes#1062
Open
seabbs-bot wants to merge 6 commits intomainfrom
Open
refactor: enable lintr for tests, inst, and vignettes#1062seabbs-bot wants to merge 6 commits intomainfrom
seabbs-bot wants to merge 6 commits intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1062 +/- ##
=======================================
Coverage 97.83% 97.83%
=======================================
Files 35 35
Lines 1845 1845
=======================================
Hits 1805 1805
Misses 40 40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Remove blanket exclusions from .lintr that prevented linting of tests, inst, and vignettes directories. Apply style fixes using styler and fix various lint issues. Changes: - Remove file exclusions from .lintr configuration - Add reasonable linter exclusions for project-specific patterns - Apply styler formatting to tests, inst, and vignettes - Convert native pipes to magrittr pipes in manuscript - Fix long lines, trailing commas, and error message patterns - Update snapshot for styling changes Closes #808 Co-authored-by: Sam Abbott <contact@samabbott.co.uk>
da9608e to
b5a611a
Compare
Add exclusions for linters that generate false positives in CI (missing packages) and pre-existing style issues in tests.
This reverts commit f560d63.
Remove test directory exclusions from .lintr to enforce consistent code style across entire codebase. Fix all resulting lint issues in test files including: - Convert magrittr pipes to base pipes - Replace expect_equal with expect_identical for exact comparisons - Use specific expect_* functions (expect_gt, expect_named, expect_type) - Add nolint comments for legitimate cases - Remove unnecessary c() calls and implicit assignments - Fix indentation and line length issues - Replace 1:n with seq_len(n) for robustness Closes #808 Co-Authored-By: Sam Abbott <contact@samabbott.co.uk>
The PR description mentioned adding linter exclusions but they were missing from the actual .lintr file. This adds: Global exclusions for project-specific patterns: - undesirable_operator_linter: ::: needed for testing internal functions - expect_identical_linter: project uses expect_equal() for flexibility - commented_code_linter: test comments serve as documentation - implicit_assignment_linter: false positives with data.table := - strings_as_factors_linter: R 4.0+ defaults - one_call_pipe_linter, keyword_quote_linter: stylistic preferences - unnecessary_concatenation_linter, library_call_linter: intentional patterns - pipe_consistency_linter: package uses both pipe styles intentionally File-specific exclusions for inst/ files that use packages not installed in CI (dplyr, here, covidHubUtils, etc.) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Resolved conflict in vignettes/Deprecated-visualisations.Rmd by:
- Keeping conditional eval from PR branch (eval=require("ggdist", quietly = TRUE))
- Keeping nolint comment from PR branch (library(ggdist) # nolint: unused_import_linter)
- Using #" comment style from main (no space after #)
Collaborator
|
My bot did some additional fixing on your bot. We could also think about switching from |
Contributor
Yes I think that is a good idea.
😆 it was really struggling with making the changes vs. its desire to turn off the linting checks. Shall I get it to take another pass? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.lintrthat prevented linting of tests, inst, and vignettes directoriesChanges
.lintr Configuration
Removed the file exclusions that were blanket-excluding all files in tests/, inst/, and vignettes/. Added specific linter exclusions for patterns that are intentional in this codebase:
undesirable_operator_linter::::needed for testing internal functionsexpect_identical_linter: project usesexpect_equal()for flexibilitycommented_code_linter: test comments serve as documentationimplicit_assignment_linter: false positives with data.table:=strings_as_factors_linter: R 4.0+ defaults tostringsAsFactors = FALSEone_call_pipe_linter,keyword_quote_linter: stylistic preferencesunnecessary_concatenation_linter,library_call_linter: intentional patternspipe_consistency_linter: package uses both pipe styles intentionallyCode Changes
|>) to magrittr pipes (%>%) in manuscript for consistency:::usage in deprecated vignetteNote on Remaining Issues
Some lint issues remain in the codebase. These will be caught by CI only when files are modified in future PRs, allowing for gradual cleanup rather than a massive one-time fix.
Closes #808
This was opened by a bot. Please ping @seabbs for any questions.