posit-dev / posit-dev/air

respect lintr no lint comment position

Open
#256 11 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
446
Forks
32
Avg merge
16h 48m
Merged PRs (30d)
1

Description

Not sure if this is intentional, but when I have a # nolint comment at the function definition it gets shifted a line below and effectively removing the no lint command for that line:

before formatting:

as_task_fcst.TaskFcst = function(x, clone = FALSE, ...) { # nolint
  if (clone) x$clone() else x
}

after formatting:

as_task_fcst.TaskFcst = function(x, clone = FALSE, ...) {
  # nolint
  if (clone) x$clone() else x
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the formatting example in the issue and trace how the formatter handles an inline # nolint comment on a function definition. Done means formatting preserves the comment's association with the function line so lintr still ignores the intended line, with coverage for this before-and-after case.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.