Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.12
- uses: r-lib/actions/setup-r@bd49c52ffe281809afa6f0fecbf37483c5dd0b93 # v2.11.3
- name: Install pre-commit
run: |
python -m pip install pre-commit
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,20 @@ repos:
?.pb\.(cc|h)$|
?^cpp/src/generated/|
)
- repo: local
hooks:
- id: lintr
name: R Lint
alias: r-lint
language: r
additional_dependencies:
- cyclocomp
- lintr
entry: |
Rscript r/tools/lint.R
pass_filenames: false
files: >-
^r/.*\.(R|Rmd)$
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
hooks:
Expand Down
26 changes: 26 additions & 0 deletions r/tools/lint.R
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the tools directory is distributed as part of the source R package and is generally intended to be used to include files for use during source installation12.
Since this script is used during development and is not needed during installation, probably it should be moved to a directory that is not included in the source R package (and is listed in .Rbuildignore).

If I understand correctly, the same reason why files like list.sh are not included in the subdirectory for now.

Footnotes

  1. If your configure script needs auxiliary files, it is recommended that you ship them in a tools directory (as R itself does).https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Configure-and-cleanup-1

  2. tools/: auxiliary files needed during configuration, usually found in the company of a configure script. https://r-pkgs.org/misc.html#other-directories

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.
Could you open a new issue for it and discuss better location in the issue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. #46661

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env Rscript
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

lints <- lintr::lint_package("r")
if (length(lints) == 0) {
q("no")
}

print(lints)
q("no", status=1)
Loading