get_comment_nodes_with_prior_code: Extract lints between code and comments

View source: R/03b_doubleSpaceLinter.R View source: R/03a_additionalLinters.R

get_comment_nodes_with_prior_codeR Documentation

Extract lints between code and comments

Description

We need to account for special cases like "x <- 3 # Hello world", where both double spaces are invalid and should therefore be detected as lint. This function first pairs nodes that have code and text on the same line and then compares the amount of spaces - between code and "#", - between "#" and text.

We need to account for special cases like "x <- 3 # Hello world", where both double spaces are invalid and should therefore be detected as lint. This function first pairs nodes that have code and text on the same line and then compares the amount of spaces - between code and "#", - between "#" and text.

Usage

get_comment_nodes_with_prior_code(comment_nodes, code_nodes)

get_comment_nodes_with_prior_code(comment_nodes, code_nodes)

Arguments

comment_nodes

Node list extracted with the XPath for comments/strings

code_nodes

Node list extracted with the XPath for code

Value

Node List containing lints between code and comments

Node List containing lints between code and comments


INWT/INWTUtils documentation built on May 22, 2024, 4:45 p.m.