Skip to content

Fix some regex-based linters getting spurious matches - #620

Merged
AshesITR merged 20 commits into
masterfrom
regex-based-linter-issue-441
Dec 4, 2020
Merged

AshesITR merged 20 commits into
masterfrom
regex-based-linter-issue-441

Conversation

@MichaelChirico

@MichaelChirico MichaelChirico commented Nov 29, 2020 •

Copy link
Copy Markdown
Collaborator

Closes #441

Forked from #467 -- re-filing with the base branch on the main repo (cc @russHyde)

russHyde and others added 9 commits April 6, 2020 10:11
Tests added to ensure paren-brace linter, equals-NA linter and no-tab
linter do not flag lints in irrelevant sections of code (eg, strings /
comments).
This can check if a regex-match is covered by an expression in a
source_file and restrict analysis to tokens of a particular type, if
required.
Also, rename file containing equals_na_linter to match format of other
linter-files (`*_linter.R` not `*_lintr.R`)
@MichaelChirico
MichaelChirico force-pushed the regex-based-linter-issue-441 branch from 2e5a03d to 2cc47ec Compare November 29, 2020 02:31
@MichaelChirico

Copy link
Copy Markdown
Collaborator Author

For now I'll leave this as is on the assumption that #546 would be merged first. After that, I would keep the tests for equals_na_linter from here.

@MichaelChirico MichaelChirico changed the title Regex based linter issue 441 Fix some regex-based linters getting spurious matches Nov 29, 2020
@MichaelChirico

Copy link
Copy Markdown
Collaborator Author

The same issue as #546 (about the XML tree being missing when there's a syntax error) was hitting equals_na_linter in this branch, so I just went ahead and reverted that part. First, I copied the tests over there as well.

AshesITR
AshesITR previously approved these changes Nov 29, 2020

@AshesITR AshesITR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

AshesITR
AshesITR previously approved these changes Nov 30, 2020

@AshesITR AshesITR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for resurrecting this PR!

AshesITR
AshesITR previously approved these changes Nov 30, 2020
@AshesITR
AshesITR merged commit f5ce702 into master Dec 4, 2020
@AshesITR
AshesITR deleted the regex-based-linter-issue-441 branch December 4, 2020 06:35
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.

paren_brace_linter false positive within regex strings: "(match_group){quantifier}"

3 participants