thisisnic commented on code in PR #46686: URL: https://github.com/apache/arrow/pull/46686#discussion_r2143422007
########## r/vignettes/developers/workflow.Rmd: ########## @@ -51,31 +51,19 @@ pkgdown::build_site(preview=TRUE) ## Styling and linting -### R code - -The R code in the package follows [the tidyverse style](https://style.tidyverse.org/). On PR submission (and on pushes) our CI will run linting and will flag possible errors on the pull request with annotations. +You can automatically adjust our styling and lint by [pre-commit](https://pre-commit.com/): -To run the linter locally, install the `{lintr}` package (note, we currently use a fork that includes fixes not yet accepted upstream, see how lintr is being installed in the file [`ci/docker/linux-apt-lint.dockerfile`](https://github.com/apache/arrow/blob/main/ci/docker/linux-apt-lint.dockerfile) for the current status) and then run Review Comment: > Could you share pre-commit related issues you got? Can we fix them instead of avoiding pre-commit? Yeah, absolutely. I think it boils down to the fact that I had an older version - just updating it now to see if that fixes it. Maybe we wanna specify a minimum? ``` nic@xps-15:~$ cd arrow nic@xps-15:~/arrow$ pre-commit [INFO] Initializing environment for https://github.com/hadolint/hadolint. [INFO] Initializing environment for https://github.com/pre-commit/mirrors-clang-format. [INFO] Initializing environment for https://github.com/cpplint/cpplint. [INFO] Initializing environment for https://github.com/hhatto/autopep8. [INFO] Initializing environment for https://github.com/pycqa/flake8. [INFO] Initializing environment for https://github.com/MarcoGorelli/cython-lint. [INFO] Initializing environment for https://github.com/numpy/numpydoc. [INFO] Initializing environment for local:cyclocomp,lintr. [INFO] Initializing environment for local:roxygen2,styler. [INFO] Initializing environment for https://github.com/rubocop/rubocop. [INFO] Initializing environment for https://github.com/cheshirekow/cmake-format-precommit. [INFO] Initializing environment for https://github.com/sphinx-contrib/sphinx-lint. [INFO] Initializing environment for https://github.com/koalaman/shellcheck-precommit. [INFO] Initializing environment for https://github.com/scop/pre-commit-shfmt. An error has occurred: InvalidManifestError: ==> File /home/nic/.cache/pre-commit/repoepuluybh/.pre-commit-hooks.yaml ==> At Hook(id='shfmt') ==> At key: stages ==> At index 0 =====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit' Check the log at /home/nic/.cache/pre-commit/pre-commit.log nic@xps-15:~/arrow$ cat /home/nic/.cache/pre-commit/pre-commit.log ### version information pre-commit version: 2.17.0 git --version: git version 2.34.1 sys.version: 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] sys.executable: /usr/bin/python3 os.name: posix sys.platform: linux ### error information An error has occurred: InvalidManifestError: ==> File /home/nic/.cache/pre-commit/repoepuluybh/.pre-commit-hooks.yaml ==> At Hook(id='shfmt') ==> At key: stages ==> At index 0 =====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit' Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pre_commit/error_handler.py", line 70, in error_handler yield File "/usr/lib/python3/dist-packages/pre_commit/main.py", line 396, in main return run(args.config, store, args) File "/usr/lib/python3/dist-packages/pre_commit/commands/run.py", line 403, in run for hook in all_hooks(config, store) File "/usr/lib/python3/dist-packages/pre_commit/repository.py", line 228, in all_hooks return tuple( File "/usr/lib/python3/dist-packages/pre_commit/repository.py", line 231, in <genexpr> for hook in _repository_hooks(repo, store, root_config) File "/usr/lib/python3/dist-packages/pre_commit/repository.py", line 206, in _repository_hooks return _cloned_repository_hooks(repo_config, store, root_config) File "/usr/lib/python3/dist-packages/pre_commit/repository.py", line 173, in _cloned_repository_hooks by_id = {hook['id']: hook for hook in load_manifest(manifest_path)} File "/usr/lib/python3/dist-packages/cfgv.py", line 394, in load_from_filename with reraise_as(exc_tp): File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/lib/python3/dist-packages/cfgv.py", line 43, in reraise_as raise tp(e).with_traceback(tb) from None File "/usr/lib/python3/dist-packages/cfgv.py", line 40, in reraise_as yield File "/usr/lib/python3/dist-packages/cfgv.py", line 398, in load_from_filename with validate_context(f'File {filename}'): File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/lib/python3/dist-packages/cfgv.py", line 34, in validate_context raise ValidationError(e, ctx=msg).with_traceback(tb) from None File "/usr/lib/python3/dist-packages/cfgv.py", line 31, in validate_context yield File "/usr/lib/python3/dist-packages/cfgv.py", line 410, in load_from_filename validate(data, schema) File "/usr/lib/python3/dist-packages/cfgv.py", line 376, in validate schema.check(v) File "/usr/lib/python3/dist-packages/cfgv.py", line 272, in check validate(val, self.of) File "/usr/lib/python3/dist-packages/cfgv.py", line 376, in validate schema.check(v) File "/usr/lib/python3/dist-packages/cfgv.py", line 242, in check with validate_context(context): File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/lib/python3/dist-packages/cfgv.py", line 34, in validate_context raise ValidationError(e, ctx=msg).with_traceback(tb) from None File "/usr/lib/python3/dist-packages/cfgv.py", line 31, in validate_context yield File "/usr/lib/python3/dist-packages/cfgv.py", line 244, in check item.check(v) File "/usr/lib/python3/dist-packages/cfgv.py", line 53, in _check_optional with validate_context(f'At key: {self.key}'): File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/lib/python3/dist-packages/cfgv.py", line 34, in validate_context raise ValidationError(e, ctx=msg).with_traceback(tb) from None File "/usr/lib/python3/dist-packages/cfgv.py", line 31, in validate_context yield File "/usr/lib/python3/dist-packages/cfgv.py", line 54, in _check_optional self.check_fn(dct[self.key]) File "/usr/lib/python3/dist-packages/cfgv.py", line 363, in check_array_fn with validate_context(f'At index {i}'): File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/lib/python3/dist-packages/cfgv.py", line 34, in validate_context raise ValidationError(e, ctx=msg).with_traceback(tb) from None File "/usr/lib/python3/dist-packages/cfgv.py", line 31, in validate_context yield File "/usr/lib/python3/dist-packages/cfgv.py", line 364, in check_array_fn inner_check(val) File "/usr/lib/python3/dist-packages/cfgv.py", line 342, in check_one_of_fn raise ValidationError( pre_commit.clientlib.InvalidManifestError: ==> File /home/nic/.cache/pre-commit/repoepuluybh/.pre-commit-hooks.yaml ==> At Hook(id='shfmt') ==> At key: stages ==> At index 0 =====> Expected one of commit, commit-msg, manual, merge-commit, post-checkout, post-commit, post-merge, post-rewrite, prepare-commit-msg, push but got: 'pre-commit' ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org