-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
General Issue: Lintr CI check giving new and many findings #2309
Comments
@bms63 : |
awesome!! then this is a great issue for folks wanting to get back into admiral or first time contributors!! |
@bms63 @dgrassellyb Question: When I start a brand new RStudio instance and clone admiral, the first thing I do is devtools::install_dev_deps(). This tells me that devtools is not installed. So, I install devtools and do devtools::install_dev_deps(). This works great. But it does not install lintr nor styler. Is it possible to install lintr and stylr to ensure the developer is using the same versions as the Action checks will use? |
If you install the latest version of lintr and styler then you will have what is being used in the action |
True. But why leave that to chance? Why not have install_dev_deps do it? |
Here is why we removed them from DESCRIPTION file. #1919 |
@bms63 / @esimms999-gsk : maybe we should then update the documentation as well on this (just talking about necessary dev dependencies to install like |
@pharmaverse/admiral @pharmaverse/admiral_comm hey alll. Can someone look into fixing these lintr issues for us!! This will impact every future Pull Request as right now the CI action is failing. I actually think it might be a slightly bigger job than 1 hour...maybe 2-3 hours as there will be some investigation of each linter failing and maybe some quick decisions!?! Anyways, it is a huge help to tackle this one!! |
Hi @bms63, I'll give it a go! |
@gg106046 @bms63 I was digging into this a little bit. I think we need to implement a quick solution (stop lintr from failing so we can do PR's without problem) and then find a long-term solution (make all the lintr checks work as they should). There are two types of lintr checks failing at this time:
For the indentation_linter, we have a problem with styler and lintr disagreeing: I did some testing on one of the files and if I made it pass styler, it failed lintr. And if it passes lintr, it failed styler. This will take some research to figure out the best way to handle this. But, for now, we can turn off this indentation_linter check by adding a line to the .lintr file right after the "object_usage_linter=NULL," line: indentation_linter=NULL. This will get rid of all the indentation_linter fails. As for undesirable_function_linter, I tried similar but kept getting syntax errors wrt the .lintr file. I could find very little documentation on any of this and will post a question to Posit Community, |
Ack! I did not notice ... undesirable_function_linter is being ADDED to the checks; I think that by removing that line it is not used, by default. Changing the .lintr file from:
... to this:
... seems to work. I will create a branch and PR for this temporary solution. That will give us time to find a better, long-term solution. |
@ddsjoberg @cicdguy @dgrassellyb im trying to come up to speed here and maybe misunderstanding...but how do other packages handle the divergence of styler and linter for code indentation? |
@bms63 - usually that is accomplished by having specific linter configs per project, ones that conform with a style guide or style preference |
did recent updates cause stlyer and linter to diverge? I'm guessing yes as we had been using older versions previously that matched. I just would of thought they would match out of the box and we would customize to your project if you didn't like the defaults? |
Indeed: |
* Closes #2309 Bypass undesirable_function_linter and indentation_linter checks, as … (#2322) Bypass undesirable_function_linter and indentation_linter checks, as a temporary solution to failing CI checks. * [skip actions] Bump version to 1.0.0.9005 * admiral v1.0.1 - Hotfix for derive_vars_query (#2311) (#2320) * Closes #2311 attend to `derive_vars_query()` bug (#2313) * new branch here * fix typo in news * 2311 updated unit test to have mixed case * missing the toupper part * add more detail to news * fix links * add documentation on case insensitivity --------- Co-authored-by: Gordon Miller <gordon.miller@roche.com> * chore: #2311 remove renv to get website to build * [actions skip] Add/Update README.md for patch * Trigger Build --------- Co-authored-by: Zelos Zhu <zelos.zhu@atorusresearch.com> Co-authored-by: Gordon Miller <gordon.miller@roche.com> Co-authored-by: GitHub Actions <action@github.com> --------- Co-authored-by: bms63 <bms63@users.noreply.github.com> Co-authored-by: Ben Straub <ben.x.straub@gsk.com> Co-authored-by: Zelos Zhu <zelos.zhu@atorusresearch.com> Co-authored-by: Gordon Miller <gordon.miller@roche.com> Co-authored-by: GitHub Actions <action@github.com>
* Remove test about deprecation of na_val argument. Update comment in code. * Update 2316 branch with latest main. (#2323) * Closes #2309 Bypass undesirable_function_linter and indentation_linter checks, as … (#2322) Bypass undesirable_function_linter and indentation_linter checks, as a temporary solution to failing CI checks. * [skip actions] Bump version to 1.0.0.9005 * admiral v1.0.1 - Hotfix for derive_vars_query (#2311) (#2320) * Closes #2311 attend to `derive_vars_query()` bug (#2313) * new branch here * fix typo in news * 2311 updated unit test to have mixed case * missing the toupper part * add more detail to news * fix links * add documentation on case insensitivity --------- Co-authored-by: Gordon Miller <gordon.miller@roche.com> * chore: #2311 remove renv to get website to build * [actions skip] Add/Update README.md for patch * Trigger Build --------- Co-authored-by: Zelos Zhu <zelos.zhu@atorusresearch.com> Co-authored-by: Gordon Miller <gordon.miller@roche.com> Co-authored-by: GitHub Actions <action@github.com> --------- Co-authored-by: bms63 <bms63@users.noreply.github.com> Co-authored-by: Ben Straub <ben.x.straub@gsk.com> Co-authored-by: Zelos Zhu <zelos.zhu@atorusresearch.com> Co-authored-by: Gordon Miller <gordon.miller@roche.com> Co-authored-by: GitHub Actions <action@github.com> --------- Co-authored-by: bms63 <bms63@users.noreply.github.com> Co-authored-by: Ben Straub <ben.x.straub@gsk.com> Co-authored-by: Zelos Zhu <zelos.zhu@atorusresearch.com> Co-authored-by: Gordon Miller <gordon.miller@roche.com> Co-authored-by: GitHub Actions <action@github.com>
PR #2322 has implemented the temporary solution: the failing checks are no longer being performed due to changes in the .lintr file (see above for before/after .lintr content). This allows us to continue with updates to admiral because the CI/CD lintr check no longer fails. While working on this, all of the lintr errors can be surfaced by making use of the original .lintr file:
|
@bundfussr I think you wrote this line of code in call_derivation.R a couple of years ago, so I will ask you! |
@esimms999 , you need to replace it with
I think |
@bundfussr Thanks, I'll give that a try! Opened issue #2344 to concentrate on undesirable_function_lintr errors. |
OK, some success. The change @bundfussr suggested, above, worked. And I successfully made other changes, but I am sure there is a better way than changing 4 lines to 8, e.g. in test-user_utils.R:
to:
There are still some changes which need to be made and I am unsure how to do them; I am not having much luck finding information on this with Google. An example:
and:
|
Any ideas @pharmaverse/admiral @pharmaverse/admiral_comm |
You could replace
with
If you want to set more than one attribute you can use
or if you want to assign the object to a variable
|
@bundfussr I had success with
but the tests fail when I replace
in derive_merged.R with:
Unfortunately, I am really out of my depth on this. I have done what I can at this time but will need to re-visit this when I have more understanding or find someone to assign it to. |
It's important to keep the code readable, which makes it easier to maintain. My suggestion is to either keep the |
I am just assuming that lintr's complaining about the structure() function is based upon some wisdom I am unaware of. Asking the reason why: Posit Community |
Posit Community response points at: r-lib/lintr#2227, which has this great comment: @ddsjoberg I agree 100% that keeping the code readable and easier to maintain is high priority. I will fence in structure() calls so that lintr ignores them. This will allow the undesirable_function_linter to be turned on to catch anything else. |
The undesirable_function_linter problem has been resolved by making use of alternate syntax in building test-related tibbles and by using # nolint on other code. |
Background Information
Recently re-workings of CI workflows have generated more lintr findings. Unsure if these are false-positives or not.
Attached is file of the results from the latest lintr run
lintrs_findings.csv
Definition of Done
@pharmaverse/admiral @pharmaverse/admiral_comm Hi all - not totally sure what is happening with the lintr, but if anyone has some time to investigate what is going on and remedy??
The text was updated successfully, but these errors were encountered: