Skip to content

fix: resolve all lintr violations in R/ and vignettes/#43

Merged
gladkia merged 2 commits into
masterfrom
fix/linting
May 1, 2026
Merged

fix: resolve all lintr violations in R/ and vignettes/#43
gladkia merged 2 commits into
masterfrom
fix/linting

Conversation

@gladkia

@gladkia gladkia commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixed 1752 linting violations across all R/ source files and vignettes/
  • infix_spaces: applied styler with scope="spaces" to all R/ files
  • line_length: manually wrapped all lines exceeding 120 characters (gDRstyle limit)
  • Conflict resolved: UCSCBedGraphQuantitativeTrack.R now uses is() (from fix: resolve BiocCheck NOTEs and add working local CI via Podman #42) with proper spacing (from this branch)

Test plan

  • gDRstyle::checkPackage with skip_lint = FALSE reports 0 linting violations
  • CI passes on all platforms

gladkia added 2 commits May 1, 2026 11:13
…and vignettes/

Fixes 1752 linting violations: styler scope=spaces for infix_spaces, manual
wrapping for line_length (120 char limit) per gDRstyle::checkPackage requirements.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request performs a comprehensive reformatting of the R source files to improve code style and consistency, primarily by adding spaces around operators and keywords. The review identified several critical copy-paste errors in the trackSize method implementations for various track classes (BedpeInteractionsTrack, GWASTrack, GWASUrlTrack, GenomicAlignmentTrack, and QuantitativeTrack), where the code incorrectly attempts to access a non-existent vcf.obj slot. Additionally, a logic error caused by operator precedence was found in R/igvR.R regarding the validation of metadata columns.


function(obj) {
if(!is.null(obj@vcf.obj))
if (!is.null(obj@vcf.obj))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The trackSize method for BedpeInteractionsTrack incorrectly attempts to access a vcf.obj slot, which does not exist in this class (it inherits from DataFrameAnnotationTrack). This appears to be a copy-paste error from VariantTrack. It should instead return the number of rows in the coreObject data frame.

       return(nrow(obj@coreObject))

Comment thread R/GWASTrack.R

function(obj) {
if(!is.null(obj@vcf.obj))
if (!is.null(obj@vcf.obj))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The trackSize method for GWASTrack incorrectly attempts to access a vcf.obj slot, which is not present in this class. This appears to be a copy-paste error from VariantTrack. It should return the number of rows in the coreObject data frame.

       return(nrow(obj@coreObject))

Comment thread R/GWASUrlTrack.R

function(obj) {
if(!is.null(obj@vcf.obj))
if (!is.null(obj@vcf.obj))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The trackSize method for GWASUrlTrack incorrectly attempts to access a vcf.obj slot, which is not present in this class. Since this track points to a remote URL, the size is unknown and should return NA_integer_ directly.

       return(NA_integer_)

Comment thread R/GenomicAlignmentTrack.R

function(obj) {
if(!is.null(obj@vcf.obj))
if (!is.null(obj@vcf.obj))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The trackSize method for GenomicAlignmentTrack incorrectly attempts to access a vcf.obj slot, which is not present in this class. It should return the length of the alignment slot.

       return(length(obj@alignment))

Comment thread R/QuantitativeTrack.R
function(obj){
if(!is.null(obj@vcf.obj))
function(obj) {
if (!is.null(obj@vcf.obj))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The trackSize method for the base QuantitativeTrack class incorrectly attempts to access a vcf.obj slot, which is not defined in this class. It should return NA_integer_ as the size is generally unknown for the base class or remote sources.

       return(NA_integer_)

Comment thread R/igvR.R
gr <- track@coreObject
# identify score column. we want just chrom, start, end, score
if(!ncol(mcols(gr)) == 1) stop("must have exactly one numeric metadata column")
if (!ncol(mcols(gr)) == 1) stop("must have exactly one numeric metadata column")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The logical negation !ncol(mcols(gr)) == 1 is incorrect due to operator precedence in R. The ! operator is evaluated before ==. This means !ncol(...) will evaluate to FALSE for any non-zero number of columns, and FALSE == 1 will always be FALSE. This should be changed to ncol(mcols(gr)) != 1 to correctly check that there is exactly one metadata column.

      if (ncol(mcols(gr)) != 1) stop("must have exactly one numeric metadata column")

@gladkia gladkia merged commit c4696a1 into master May 1, 2026
6 checks passed
@gladkia gladkia deleted the fix/linting branch May 1, 2026 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant