Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    rahulrachh
    @rahulrachh
    ok thanks @jimhester that was helpful
    Dragoș Moldovan-Grünfeld
    @dragosmg
    Yossi Farjoun
    @yfarjoun
    hi! is this room active?
    Jim Hester
    @jimhester
    With some definition of active
    Yossi Farjoun
    @yfarjoun
    :-)
    I'm having trouble using the lintr github action. my repo has R code, but isn't really an r package as such. I just want my .R and .Rmd files linted...
    the packages I need, actually need to be built and not downloaded from cran. When I name these packages in the DESCRIPTION file (which I couldn't avoid having), I get errors. if I don't have a DESCRIPTION file, I get errors.
    it also seems that if I removed all "required" packages from the DESCRIPTION file, I get no linting at all (but I need to test that more carefully...)
    what's the recommended github action to use if I just want a bunch of .R files to be linted without building the package first?
    Jim Hester
    @jimhester
    It would be easier to help if you link to your workflow file
    Yossi Farjoun
    @yfarjoun
    I used the one auto-generated by usethis..
    my repo is private.
    on:
      push:
        branches:
          - main
          - master
      pull_request:
        branches:
          - main
          - master
    
    name: lint
    
    jobs:
      lint:
        runs-on: macOS-latest
        env:
          GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
        steps:
          - uses: actions/checkout@v2
    
          - uses: r-lib/actions/setup-r@v1
    
          - name: Query dependencies
            run: |
              install.packages('remotes')
              saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
              writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
            shell: Rscript {0}
    
          - name: Restore R package cache
            uses: actions/cache@v2
            with:
              path: ${{ env.R_LIBS_USER }}
              key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
              restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
    
          - name: Install dependencies
            run: |
              install.packages(c("remotes"))
              remotes::install_deps(dependencies = TRUE)
              remotes::install_cran("lintr")
            shell: Rscript {0}
    
          - name: Install package
            run: R CMD INSTALL .
    
          - name: Lint
            run: lintr::lint_package()
            shell: Rscript {0}
    Jim Hester
    @jimhester
    If what you are trying to lint is not a package, call lintr::lint_dir() instead of lint_package()
    Yossi Farjoun
    @yfarjoun
    ok. sounds good. will that also invoke the linkr-bot?
    also, in that case, it seems that I could significantly reduce the yml....but I'm not sure how...
    Jim Hester
    @jimhester
    it is just a text file in .github/workflows/, just delete the lines you don't need
    Yossi Farjoun
    @yfarjoun
    if I understood the yml, I would!
    I don't understand the Query dependencies and Restore R package cache part....is there some reading I coudl do to understand it?
    Jim Hester
    @jimhester
    It is figuring out what dependencies your package needs and restoring the package cache, if you are not using an R package and installing any dependencies some other way I guess you don't need them
    Yossi Farjoun
    @yfarjoun
    :+1:
    ok...so lint_dir("scripts") completed, and gave a bunch of warnings. but it's difficult to understand which file is the culprit, and there are not comments added by the lintr-bot:
    Run lintr::lint_dir("scripts")
      lintr::lint_dir("scripts")
      shell: /usr/local/bin/Rscript {0}
      env:
        GITHUB_PAT: ***
        R_LIBS_USER: /Users/runner/work/_temp/Library
        TZ: UTC
        _R_CHECK_SYSTEM_CLOCK_: FALSE
        NOT_CRAN: true
    Warning messages:
    Warning: Variable and function name style should be snake_case.
    1: In readLines(filename) :
    Warning: Use <-, not =, for assignment.
      incomplete final line found on '/Users/runner/work/VitaminD_COVID_MR_reproduce/VitaminD_COVID_MR_reproduce/scripts/VD_extract_SNPs_test.R'
    Warning: Put spaces around all infix operators.
    2: In readLines(file) :
    Warning: Variable and function name style should be snake_case.
      incomplete final line found on
    Jim Hester
    @jimhester
    comments are not going to work on a private repository, there is no way for the bot to access it
    Yossi Farjoun
    @yfarjoun
    ah. right.
    makes sense!
    can I give it a TOKEN?
    Jim Hester
    @jimhester
    no
    Yossi Farjoun
    @yfarjoun
    OK. thanks for your help!
    another question: Since bot isn't working for me, is there a way to make the outputted comments more verbose? when I run lintr on my laptop it gives more detail than I see in the github action:
    Jim Hester
    @jimhester
    I think you might be looking at the wrong place in the GitHub Actions log
    Yossi Farjoun
    @yfarjoun
    ah. could be.
    Screen Shot 2021-03-10 at 3.16.28 PM.png
    Jim Hester
    @jimhester
    yes, that is the overview, click on the job itself
    Yossi Farjoun
    @yfarjoun
    Screen Shot 2021-03-10 at 3.17.13 PM.png
    > lintr::lint_dir(".")
    ..
    VD_extract_SNPs_test.R:10:1: style: Variable and function name style should be snake_case.
    PThreshold=5e-8
    ^~~~~~~~~~
    VD_extract_SNPs_test.R:10:11: style: Use <-, not =, for assignment.
    PThreshold=5e-8
              ^
    VD_extract_SNPs_test.R:10:11: style: Put spaces around all infix operators.
    PThreshold=5e-8
             ~^~
    VD_extract_SNPs_test.R:11:1: style: Variable and function name style should be snake_case.
    CommanThreshold=0.01
    ^~~~~~~~~~~~~~~
    VD_extract_SNPs_test.R:11:16: style: Use <-, not =, for assignment.
    CommanThreshold=0.01
    I was hoping to see somethink like what I get from my interactive session
    Jim Hester
    @jimhester
    Are they there in the raw log?
    Yossi Farjoun
    @yfarjoun
    no.
    2021-03-10T19:49:17.0980180Z ##[group]Run lintr::lint_dir("scripts")
    2021-03-10T19:49:17.0980830Z lintr::lint_dir("scripts")
    2021-03-10T19:49:17.1071490Z shell: /usr/local/bin/Rscript {0}
    2021-03-10T19:49:17.1071970Z env:
    2021-03-10T19:49:17.1073190Z   GITHUB_PAT: ***
    2021-03-10T19:49:17.1073720Z   R_LIBS_USER: /Users/runner/work/_temp/Library
    2021-03-10T19:49:17.1074510Z   TZ: UTC
    2021-03-10T19:49:17.1074920Z   _R_CHECK_SYSTEM_CLOCK_: FALSE
    2021-03-10T19:49:17.1075430Z   NOT_CRAN: true
    2021-03-10T19:49:17.1075830Z ##[endgroup]
    2021-03-10T19:49:19.7085930Z Warning messages:
    2021-03-10T19:49:19.7097410Z ##[warning]Variable and function name style should be snake_case.
    2021-03-10T19:49:19.7111540Z 1: In readLines(filename) :
    2021-03-10T19:49:19.7114290Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7144680Z   incomplete final line found on '/Users/runner/work/VitaminD_COVID_MR_reproduce/VitaminD_COVID_MR_reproduce/scripts/VD_extract_SNPs_test.R'
    2021-03-10T19:49:19.7146330Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7198740Z 2: In readLines(file) :
    2021-03-10T19:49:19.7199950Z ##[warning]Variable and function name style should be snake_case.
    2021-03-10T19:49:19.7214860Z   incomplete final line found on '/Users/runner/work/VitaminD_COVID_MR_reproduce/VitaminD_COVID_MR_reproduce/scripts/VD_extract_SNPs_test.R'
    2021-03-10T19:49:19.7216990Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7224510Z 3: In readLines(filename) :
    2021-03-10T19:49:19.7240970Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7251730Z   incomplete final line found on '/Users/runner/work/VitaminD_COVID_MR_reproduce/VitaminD_COVID_MR_reproduce/scripts/VD_extract_SNPs.R'
    2021-03-10T19:49:19.7253750Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7257760Z 4: In readLines(file) :
    2021-03-10T19:49:19.7258620Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7265990Z   incomplete final line found on '/Users/runner/work/VitaminD_COVID_MR_reproduce/VitaminD_COVID_MR_reproduce/scripts/VD_extract_SNPs.R'
    2021-03-10T19:49:19.7267820Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7290290Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7323400Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7365950Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7443010Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7513160Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7585420Z ##[warning]Commas should always have a space after.
    2021-03-10T19:49:19.7646970Z ##[warning]Lines should not be more than 80 characters.
    2021-03-10T19:49:19.7727540Z ##[warning]Use <-, not =, for assignment.
    2021-03-10T19:49:19.7775000Z ##[warning]Put spaces around all infix operators.
    2021-03-10T19:49:19.7873440Z ##[warning]Commas should always have a space after.
    Jim Hester
    @jimhester
    I think if you install the dev version of lintr it might work better for you, in particular it would give you the change in jimhester/lintr#587, which seems to address this situation
    Yossi Farjoun
    @yfarjoun
    OK. I'll do that! thanks @jimhester .