Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Add experimental lintr job for analytics/wmde/WDCM | integration/config | master | +50 -0 | |
docker: lintr image - linter for R | integration/config | master | +57 -0 |
Details
Event Timeline
Change 378831 had a related patch set uploaded (by Addshore; owner: Addshore):
[integration/config@master] WIP DNM dicker: lintr image - linter for R
Change 379818 had a related patch set uploaded (by Addshore; owner: Addshore):
[integration/config@master] Add experimental lintr job for analytics/wmde/WDCM
So I have created and run an experimental job on the WDCM repo running lintr.
This simply runs lintr using the following bash command:
find /src -type f -name \*.R -exec Rscript -e 'lintr::lint("{}")' \; | tee /log/lintr.log
Looking at the docks for the package there should be an easier way to have this run for the whole package also taking into account exclusions and custom lintings.
https://github.com/jimhester/lintr/blob/master/README.md mentions:
Rscript -e 'lintr::lint_package()'
But I havn't been able to find any working examples that I understand.
@GoranSMilovanovic you can find a sample run over the code of WDCM @ https://integration.wikimedia.org/ci/job/lintr-docker/2/consoleFull
How would you feel about this style being used / enforced and the job running against the repo in its current state?
Also, would you be able to have a quick look at lintr and see if you can figure out how to use it and the lint_package method correctly?
I did find 1 other gerrit repo referencing lintr, wikimedia-discovery-polloi.
@mpopov might be able to help me understand lintr more as that repo has a .lintr file https://github.com/wikimedia/wikimedia-discovery-polloi/blob/master/.lintr and a testthat test for syntax https://github.com/wikimedia/wikimedia-discovery-polloi/blob/master/tests/testthat/test-syntax.R
Sure! The custom .lintr specifies which default linters to disable, how to designate lines to skip, etc. (see this section for more details). If the R files form a package, you can run the unit test from this section. If the files don't form an R package but are just a set of scripts, lintr::lint_package() won't do you much good. What you may be interested in using, though, is lintr:::read_settings() together with lintr::lint(). Let me know if you have any more questions or if you'd like some help getting that to work. I can try to come up with a minimal example.
P.S. Antoine has been working on a patch for CI with Jenkins voting for our R packages: https://gerrit.wikimedia.org/r/#/c/363337/ so that may be helpful in the future.
Change 378831 merged by jenkins-bot:
[integration/config@master] docker: lintr image - linter for R
Change 379818 merged by jenkins-bot:
[integration/config@master] Add experimental lintr job for analytics/wmde/WDCM
So, as an experimental test everything is working.
The patch above adds it as a non voting test so that we can slowly work on the issues before maybe one day making it vote.
The job sometimes times out and probably needs a bigger limit:
$ wm-ci-jjb-show lintr-docker |grep time <hudson.plugins.build__timeout.BuildTimeoutWrapper> <timeoutMinutes>1</timeoutMinutes> <timeoutPercentage>0</timeoutPercentage> <timeoutMinutesElasticDefault>3</timeoutMinutesElasticDefault> <timeoutType>absolute</timeoutType> </hudson.plugins.build__timeout.BuildTimeoutWrapper> <hudson.plugins.timestamper.TimestamperBuildWrapper/>