Closed njtierney closed 3 years ago
Thanks. This is a really strange error I have come across once or twice before, In particular when I re-installed pre-commit after the initial use_precommit()
, locally developed and build the upstream pre-commit and similar, but I found it not really reproducible outside pre-commit, i.e. you can do
styler::style_file(c("R/extract_replace_combine.R" ,"tests/testthat/test_extract_replace_combine.R))
and probably you won't get any error or warning. Also, reducing the number of staged files resolved the problem with pre-commit for me in other situations (although this is obviously not a viable solution).
One thing that eventually worked for me was to close my git shell / RStudio, re-installed styler and/or the pre-commit framework or package or cleared the styler cache (in that order of priority) and with some luck, it went away. If you have the latest CRAN version of styler installed (v1.4.1
), trying the development version from GitHub is probably better since it has a different version number / source file and will potentially invalidate some cached initialisation misbehaviour in some low-level code (which I believe is the problem). If you don't run the latest CRAN version, updating to it is probably also fine.
It seems other people got random warnings (not errors, edit: {precommit} promoted them to errors) like that too in all kinds of places: https://community.rstudio.com/t/persistent-unknown-or-uninitialised-column-warnings/64879/20
I know this is a bit unsatisfying but I am sorry I can't offer other advise than that. Also, no one reported this before, so it does not seem to be a problem many people experience fortunately. We are also working on further isolating the hooks (switch from bare bash script to a virtual environment) as discussed in #232, so maybe this has the potential to also mitigate the problem.
@njtierney {precommit} no longer promotes the warning Unknown or uninitialised column: text
to an error. With this, I think the (random) error should go away and warnings might be occasionally encountered (but don't seem to influence the result). You can give it another try with installing the dev version of this package and put rev: c063b94
in your .pre-commit-config.yaml
or wait until a new version is released and then run precommit::autopudate()
. I'll bump here again if we have a new version if you prefer the latter.
Thanks, @lorenzwalthert ! I'll get back into using this soon :)
When running precommit I get this message:
here is the precommit info
and my sessioninfo
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.5 (2021-03-31) #> os macOS Big Sur 10.16 #> system x86_64, darwin17.0 #> ui X11 #> language (EN) #> collate en_AU.UTF-8 #> ctype en_AU.UTF-8 #> tz Australia/Perth #> date 2021-05-05 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> backports 1.2.1 2020-12-09 [1] standard (@1.2.1) #> cli 2.4.0 2021-04-05 [1] CRAN (R 4.0.2) #> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.2) #> digest 0.6.27 2020-10-24 [1] standard (@0.6.27) #> ellipsis 0.3.1 2020-05-15 [1] standard (@0.3.1) #> evaluate 0.14 2019-05-28 [1] standard (@0.14) #> fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.2) #> fs 1.5.0 2020-07-31 [1] standard (@1.5.0) #> glue 1.4.2 2020-08-27 [1] standard (@1.4.2) #> highr 0.8 2019-03-20 [1] standard (@0.8) #> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.2) #> knitr 1.31 2021-01-27 [1] CRAN (R 4.0.2) #> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.2) #> magrittr 2.0.1 2020-11-17 [1] standard (@2.0.1) #> pillar 1.6.0 2021-04-13 [1] CRAN (R 4.0.2) #> pkgconfig 2.0.3 2019-09-22 [1] standard (@2.0.3) #> purrr 0.3.4 2020-04-17 [1] standard (@0.3.4) #> reprex 2.0.0 2021-04-02 [1] CRAN (R 4.0.2) #> rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.2) #> rmarkdown 2.7 2021-02-19 [1] CRAN (R 4.0.2) #> sessioninfo 1.1.1 2018-11-05 [1] standard (@1.1.1) #> stringi 1.5.3 2020-09-09 [1] standard (@1.5.3) #> stringr 1.4.0 2019-02-10 [1] standard (@1.4.0) #> styler 1.4.1 2021-03-30 [1] CRAN (R 4.0.2) #> tibble 3.1.1 2021-04-18 [1] CRAN (R 4.0.3) #> utf8 1.2.1 2021-03-12 [1] CRAN (R 4.0.2) #> vctrs 0.3.7 2021-03-29 [1] CRAN (R 4.0.3) #> withr 2.4.2 2021-04-18 [1] CRAN (R 4.0.3) #> xfun 0.22 2021-03-11 [1] CRAN (R 4.0.2) #> yaml 2.2.1 2020-02-01 [1] standard (@2.2.1) #> #> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library ```