Add lint CI workflow and clean up package lints - #1117
Open
mattfidler wants to merge 1 commit into
Open
Conversation
Adds .github/workflows/lint.yaml running lintr::lint_package() with LINTR_ERROR_ON_LINT=true on pushes to main and pull requests. The lint gate covers package code in R/; tests, inst, vignettes, and generated files are excluded for now. High-violation style linters are disabled in .lintr with counts so they can be ratcheted down later. Fixes applied across R/: trailing whitespace, compound semicolons split into statements, spaces inside/before parentheses, T/F expanded to TRUE/FALSE, = and -> assignments converted to <-, and targeted nolint tags for deliberate names (ggplot2 conventions, C-name mirrors, checkmate-style .var.name arguments) and known-complex functions. Also fixes a real bug found by the linter: attr(rxUiGet.thetaUpper, "desc") used -> instead of <-, so the desc attribute was never set and a stray thetaUpper variable was created in the namespace. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
.github/workflows/lint.yaml: runslintr::lint_package()on pushes tomainand on pull requests, failing the job on any lint (LINTR_ERROR_ON_LINT=true). Matches the setup style ofR-CMD-check.yaml(installs the package plus the nlmixr2 GitHub dependencies soobject_usage-style linters could be enabled later).lintr::lint_package()).Lint configuration (
.lintr)The package had ~11,000 lints, most of which cannot be mechanically fixed (3,548 are object names that would require renaming exported API). Following the existing precedent in
.lintrof disabling high-count linters with their violation counts:R/;tests/,inst/,vignettes/, and generated files (RcppExports.R,rxrandomui.R,parseFuns.R,rxSyntaxFunctions.R,rxode2_md5.R,dfIni.R) are excluded for now.return_linter(533; codebase style is explicitreturn()),indentation(292),commented_code(147),line_length(112),object_usage(NSE/symengine false positives),brace(78)..var.name,..lhsenv-protocol names), snake_case S3 methods for other packages' generics (as_tibble.rxEt), and initial-caps names (ggproto objects,RxODE, math notation like.J).cyclocomp(160)andobject_length(45)caps with targeted# nolinttags on the handful of existing outliers.Fixes applied (
R/, 44 files)All position-driven from lintr output (never blind regex over strings), each file parse-verified before writing:
a; bstatements onto separate linesT/FtoTRUE/FALSE=and right-assign (->) statements to<-Bug fix found by the linter
attr(rxUiGet.thetaUpper, "desc") -> "thetaUpper"(note->) assigned the attribute's value (NULL) to a straythetaUppervariable instead of setting thedescattribute; every sibling uses<-. Fixed and noted inNEWS.md.Testing
lintr::lint_package(): 0 lintsdevtools::test(filter='basic'): 49 pass / 0 fail / 0 warn🤖 Generated with Claude Code