Skip to content

Commit be14cca

Browse files
jjmaestroJames Sharpe
andauthored
chore: more precommit hooks (#1325)
Co-authored-by: James Sharpe <[email protected]>
1 parent 760789a commit be14cca

File tree

72 files changed

+131
-90
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+131
-90
lines changed

.github/workflows/release_prep.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ TAG=${GITHUB_REF_NAME}
88
# The prefix is chosen to match what GitHub generates for source archives
99
PREFIX="rules_foreign_cc-${TAG}"
1010
ARCHIVE="rules_foreign_cc-$TAG.tar.gz"
11-
git archive --format=tar --prefix=${PREFIX}/ ${TAG} | gzip > $ARCHIVE
12-
SHA=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
11+
git archive --format=tar --prefix="${PREFIX}"/ "${TAG}" | gzip > "$ARCHIVE"
12+
SHA="$(shasum -a 256 "$ARCHIVE" | awk '{print $1}')"
1313

1414
cat << EOF
1515
## Using Bzlmod with Bazel 6
@@ -23,7 +23,7 @@ bazel_dep(name = "rules_foreign_cc", version = "${TAG}")
2323
2424
## Using WORKSPACE
2525
26-
Paste this snippet into your `WORKSPACE.bazel` file:
26+
Paste this snippet into your \`WORKSPACE.bazel\` file:
2727
2828
\`\`\`starlark
2929
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
@@ -43,4 +43,4 @@ EOF
4343

4444
# TODO: add example of how to configure for bzlmod
4545
# awk 'f;/--SNIP--/{f=1}' e2e/smoke/WORKSPACE.bazel
46-
echo "\`\`\`"
46+
echo "\`\`\`"

.pre-commit-config.yaml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# See CONTRIBUTING.md for instructions.
22
# See https://pre-commit.com for more information
33
# See https://pre-commit.com/hooks.html for more hooks
4+
exclude: >-
5+
(?x)^(
6+
bazel-.*/.*
7+
|.*\.patch
8+
|.*\.diff
9+
|test/(expected|.*/expected)/.*\.txt
10+
|examples/(?!.*CMakeLists\.txt$).*\.txt
11+
)$
12+
413
repos:
514
- repo: https://github.com/pre-commit/pre-commit-hooks
615
rev: v5.0.0
716
hooks:
17+
- id: check-merge-conflict
18+
- id: mixed-line-ending
19+
- id: trailing-whitespace
20+
- id: end-of-file-fixer
821
- id: check-yaml
922

1023
- repo: https://github.com/keith/pre-commit-buildifier
@@ -21,16 +34,22 @@ repos:
2134
rev: v0.6.0
2235
hooks:
2336
- id: action-validator
24-
files: >-
25-
(?x)^(
26-
.github/workflows/pages.yaml
27-
)$
2837

2938
- repo: https://github.com/rhysd/actionlint
3039
rev: v1.7.4
3140
hooks:
3241
- id: actionlint
33-
files: >-
42+
43+
- repo: https://github.com/mrtazz/checkmake.git
44+
rev: 0.2.2
45+
hooks:
46+
- id: checkmake
47+
48+
- repo: https://github.com/shellcheck-py/shellcheck-py
49+
rev: v0.10.0.1
50+
hooks:
51+
- id: shellcheck
52+
exclude: >-
3453
(?x)^(
35-
.github/workflows/pages.yaml
54+
examples/.*
3655
)$

docs/index.md

Lines changed: 1 addition & 1 deletion

docs/tools/workspace_status.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ set -euo pipefail
44

55
echo STABLE_SCM_SHORT_VERSION "$(git rev-parse --short HEAD)"
66
echo STABLE_SCM_VERSION "$(git rev-parse HEAD)"
7-
echo STABLE_RELEASE "$(cat ../version.bzl | grep VERSION | sed 's/VERSION = "//' | sed 's/"//')"
7+
echo STABLE_RELEASE "$(grep VERSION ../version.bzl | sed 's/VERSION = "//' | sed 's/"//')"

examples/cmake_android/hello_lib-example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ int main(int argc, char* argv[])
55
{
66
hello_func();
77
return 0;
8-
}
8+
}

examples/cmake_android/res/mipmap-anydpi-v26/ic_launcher.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
33
<background android:drawable="@drawable/ic_launcher_background" />
44
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5-
</adaptive-icon>
5+
</adaptive-icon>

examples/cmake_android/res/mipmap-anydpi-v26/ic_launcher_round.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
33
<background android:drawable="@drawable/ic_launcher_background" />
44
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5-
</adaptive-icon>
5+
</adaptive-icon>

examples/cmake_android/zlib-example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,4 @@ int main(int argc, char* argv[])
7777
assert(strcmp(a,c)==0);
7878

7979
return 0;
80-
}
80+
}

examples/cmake_crosstool/.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a --spawn_strategy=standalone --experimental_cc_skylark_api_enabled_packages=@rules_foreign_cc//tools/build_defs,tools/build_defs,@foreign_cc_impl
2-
test --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a --spawn_strategy=standalone --experimental_cc_skylark_api_enabled_packages=@rules_foreign_cc//tools/build_defs,tools/build_defs,@foreign_cc_impl
2+
test --crosstool_top=//tools/arm_compiler:toolchain --cpu=armeabi-v7a --spawn_strategy=standalone --experimental_cc_skylark_api_enabled_packages=@rules_foreign_cc//tools/build_defs,tools/build_defs,@foreign_cc_impl

examples/cmake_crosstool/static/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ cmake_minimum_required(VERSION 2.8.4)
55

66
project(hellolib)
77

8-
add_subdirectory(src)
8+
add_subdirectory(src)

0 commit comments

Comments
 (0)