Merck / Merck/sonar-r-plugin

Not able to find a InputFile with R/tests/testthat.R

Open
#17 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26
Forks
21
PR merge metrics
No merged PRs in 30d

Description

The plugin is able to find and lint source files, but not able to find test files:

ERROR: Not able to find a InputFile with R/tests/testthat.R

However, in the logs I can see that this test file was indexed correctly:

'R/tests/testthat.R' indexed as test with language 'r' 

Also, I made sure to define the properties in sonar-project.properties:

sonar.sources=R/R/
sonar.tests=R/tests/

In the source of the plugin, I can see in the function processIssue in file https://github.com/Merck/sonar-r-plugin/blob/master/src/main/java/com/msd/gin/common/sonar/LintRSensor.java#L97 that the InputFile type expected is MAIN InputFile.Type.MAIN (and not TEST), which makes me think that the test files are excluded from linting.

This is even more surprising because there are test files in the json file in the sample-project (https://github.com/Merck/sonar-r-plugin/blob/master/sample-project/lintr_out.json#L390).

Please advise.

Contributor guide

No contributing guide indexed for this repository

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 in src/main/java/com/msd/gin/common/sonar/LintRSensor.java at processIssue and compare its InputFile handling with the test-file indexing shown in the issue. Review sonar-project.properties and sample-project/lintr_out.json, then verify that R/tests/testthat.R is processed without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, r
Domain
devtools, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.