Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/lint_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ jobs:
- name: diff scan, clang-tidy for all files which are in `.clang-tidy-diff-scans.txt`
run: ./tools/scripts/clang_tidy_check.sh scan_list .clang-tidy-diff-scans.txt "${{ steps.changed_files.outputs.added_modified }}"

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.1

check-for-todo:
runs-on: ubuntu-24.04

Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
exclude: ^bazel-
repos:
- repo: https://github.com/warchant/pre-commit-buildifier
rev: 0.1.3
hooks:
- id: buildifier
args: ["--version=v8.0.3", "--lint=warn", "--warnings=all", "-v"]
31 changes: 0 additions & 31 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# SPDX-License-Identifier: Apache-2.0

load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@buildifier_prebuilt//:rules.bzl", "buildifier")

exports_files(["LICENSE"])

Expand Down Expand Up @@ -57,33 +56,3 @@ alias(
actual = "//iceoryx_posh:iox-roudi",
visibility = ["//visibility:public"],
)

# Execute `bazel run //:buildifier` to fix formating of all starlark files in the workspace
buildifier(
name = "buildifier",
verbose = True,
)

# Execute `bazel run //:buildifier_test` to check all starlark files for correctness
buildifier(
name = "buildifier_test",
mode = "check",
verbose = True,
)

# Execute `bazel run //:buildifier_lint` to reformat and run the linter on all starlark files
buildifier(
name = "buildifier_lint",
lint_mode = "fix",
lint_warnings = ["all"],
verbose = True,
)

# Execute `bazel run //:buildifier_lint_check` to reformat and run the linter on all starlark files
buildifier(
name = "buildifier_lint_check",
lint_mode = "warn",
lint_warnings = ["all"],
mode = "check",
verbose = True,
)
5 changes: 0 additions & 5 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ bazel_dep(name = "cpptoml", version = "0.1.1")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.1.1")

bazel_dep(
name = "buildifier_prebuilt",
version = "7.1.2",
dev_dependency = True,
)
bazel_dep(name = "googletest", version = "1.15.2", dev_dependency = True)

bazel_dep(name = "ncurses", version = "6.4.20221231.bcr.4")
Empty file.
35 changes: 0 additions & 35 deletions bazel/buildifier_prebuilt/repositories.bzl

This file was deleted.

27 changes: 0 additions & 27 deletions bazel/buildifier_prebuilt/setup.bzl

This file was deleted.

2 changes: 0 additions & 2 deletions bazel/load_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ SPDX-License-Identifier: Apache-2.0
"""

load("//bazel/bazelbuild:repositories.bzl", "load_com_github_bazelbuild_rules_cc_repositories")
load("//bazel/buildifier_prebuilt:repositories.bzl", "load_buildifier_prebuilt_repositories")
load("//bazel/cpptoml:repositories.bzl", "load_cpptoml_repositories")
load("//bazel/googletest:repositories.bzl", "load_googletest_repositories")
load("//bazel/ncurses:repositories.bzl", "load_ncurses_repositories")
Expand All @@ -29,7 +28,6 @@ def load_repositories():
"""
load_com_github_bazelbuild_rules_cc_repositories()
load_bazel_skylib_repositories()
load_buildifier_prebuilt_repositories()
load_googletest_repositories()
load_cpptoml_repositories()
load_ncurses_repositories()
2 changes: 0 additions & 2 deletions bazel/setup_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ limitations under the License.
SPDX-License-Identifier: Apache-2.0
"""

load("//bazel/buildifier_prebuilt:setup.bzl", "setup_buildifier_prebuilt")
load("//bazel/skylib:setup.bzl", "setup_skylib")

def setup_repositories():
"""
Loads repositories for iceoryx dependencies
"""
setup_skylib()
setup_buildifier_prebuilt()
26 changes: 12 additions & 14 deletions doc/website/advanced/installation-guide-for-contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,27 +156,25 @@ When working with Bazel, additional tools can help the developer to maintain
a consistent codebase similar to the Clang Tools (clang-format and clang-tidy) for C++.
The [Buildifier Tool](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md)
offers formatting and linting for Bazel files.
It is integrated via [pre-commit](https://pre-commit.com/).
You may install pre-commit with the following command:

The formatting is based on rules given by Buildifier and the linting is based on
a list of [warnings](https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md).
```bash
pip install -U pre-commit identify
```

To check formatting of the Bazel files the following command needs to run in the iceoryx
workspace.
You can invoke pre-commit manually (inside the repository) on all changed files:

```bash
cd iceoryx
bazel run //:buildifier
pre-commit
```

Buildifier automatically reformat the code.

For formatting and linting this command will do the job:
or you can install it as a git hook which will automatically run before every commit:

```bash
cd iceoryx
bazel run //:buildifier_lint
pre-commit install
```

The CI will check for the correct formatting and linting.
See the `BUILD.bazel` file
in iceoryx workspace for available commands.
pre-commit runs a list of checks that check for the correct formatting and linting.

There is a CI job that runs pre-commit on all changes files in a pull request.
3 changes: 0 additions & 3 deletions tools/ci/build-test-ubuntu-bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ $(gcc --version)
$(clang --version)
$(bazel --version)"

msg "Linting Bazel files"
bazel run //:buildifier_lint_check

# Build everything including stresstests
msg "Bazel build"
bazel build //...
Expand Down
Loading