You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The pre-commit command has the feature format the source.
It will be more useful if the pre-commit commands support reformatting the code for specific languages only.
Current behavior.
For example,
There are three wrong format files.
% git status .
On branch pre-commit
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: c_glib/arrow-glib/basic-data-type.cpp
modified: cpp/src/arrow/type.cc
modified: r/src/dataset.cpp
no changes added to commit (use "git add" and/or "git commit -a")
pre-commit run --color=always --all-files check and reformat codes in all sub directories.
pre-commit run --color=always --all-files
Release Audit Tool.......................................................Passed
Docker Format............................................................Failed
- hook id: hadolint-docker
- exit code: 125
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
See 'docker run --help'.
Python Format............................................................Passed
cython-lint..............................................................Passed
C++ Format...............................................................Failed
- hook id: clang-format
- files were modified by this hook
C++ Lint.................................................................Passed
C/GLib Format............................................................Failed
- hook id: clang-format
- files were modified by this hook
MATLAB (C++) Format......................................................Passed
Python (C++) Format......................................................Passed
R (C++) Format...........................................................Failed
- hook id: clang-format
- files were modified by this hook
CMake Format.............................................................Passed
Sphinx Lint..............................................................Passed
The tree files have been reformated by the pre-commit command.
% git status .
On branch pre-commit
nothing to commit, working tree clean
New commands
For example, the following command reformat codes in c_glib directory only.
% pre-commit run --color=always --all-files c-glib-cpp-format
C/GLib Format............................................................Failed
- hook id: clang-format
- files were modified by this hook
r and cpp directories don't change the code.
% git status .
On branch pre-commit
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: cpp/src/arrow/type.cc
modified: r/src/dataset.cpp
no changes added to commit (use "git add" and/or "git commit -a")
This command reformat codes in the r subdirectory only.
pre-commit run --color=always --all-files r-format
R (C++) Format...........................................................Failed
- hook id: clang-format
- files were modified by this hook
git status .
On branch pre-commit
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: c_glib/arrow-glib/basic-data-type.cpp
modified: cpp/src/arrow/type.cc
no changes added to commit (use "git add" and/or "git commit -a")
Component(s)
Developer Tools
The text was updated successfully, but these errors were encountered:
hiroyuki-sato
changed the title
Add language aliases to clang-format (introduce language specific reformatting)
[Dev] Add language aliases to clang-format (introduce language specific reformatting)
Oct 24, 2024
…ng (#44529)
### Rationale for this change
This change implements GH-44528.
`pre-commit run --color=always --all-files c-glib-cpp-format`
Languages:
* C++ (`cpp-format`)
* c_glib(`c-glib-cpp-format`)
* MATLAB(`matlab-cpp-format`)
* Python (`python-cpp-format`)
* R(`r-cpp-format`)
### What changes are included in this PR?
Add aliases to the `clang-format` in the pre-commit configuration file.
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No.
* GitHub Issue: #44528
Authored-by: Hiroyuki Sato <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
Describe the enhancement requested
The
pre-commit
command has the feature format the source.It will be more useful if the
pre-commit
commands support reformatting the code for specific languages only.Current behavior.
For example,
There are three wrong format files.
pre-commit run --color=always --all-files
check and reformat codes in all sub directories.The tree files have been reformated by the
pre-commit
command.New commands
For example, the following command reformat codes in
c_glib
directory only.r
andcpp
directories don't change the code.This command reformat codes in the
r
subdirectory only.Component(s)
Developer Tools
The text was updated successfully, but these errors were encountered: