aspect-build / aspect-build/rules_lint

[Bug]: Clang-Tidy outputs absolute filepaths

Open
#378 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Starlark
Stars
154
Forks
125
Avg merge
3d 21h
Merged PRs (30d)
20

Description

### What happened?

When running `bazel lint //speller/...` I am seeing absolute filepaths (which include the bazel output tree) with the linting results:
```
/private/var/tmp/_bazel_jesse/93d7e699c5e2019d94351d19b00be5a3/sandbox/darwin-sandbox/11/execroot/_main/speller/data_driven_tests/lookup-datatest.cc:16:8: warning: an exception may be thrown in function 'test_config' which should not throw exceptions [bugprone-exception-escape]
```

I expected to see relative filepaths outputed instead:
```
speller/data_driven_tests/lookup-datatest.cc:16:8: warning: an exception may be thrown in function 'test_config' which should not throw exceptions [bugprone-exception-escape]
```

### Version

Development (host) and target OS/architectures:

Reproduceable on MacOS and Ubuntu

Output of `bazel --version`:

(This happens on all versions of the Aspect CLI)
```
Bazelisk version: 1.20.0
Aspect CLI Pro version: 5.11.0-alpha0.dev.150.g12ded54
Build label: 7.3.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Aug 19 16:41:27 2024 (1724085687)
Build timestamp: 1724085687
Build timestamp as int: 1724085687
```

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:

```
bazel_dep(name = "aspect_bazel_lib", version = "2.7.7")
bazel_dep(name = "aspect_rules_cypress", version = "0.6.0")
bazel_dep(name = "aspect_rules_esbuild", version = "0.21.0")
bazel_dep(name = "aspect_rules_jasmine", version = "2.0.0")
bazel_dep(name = "aspect_rules_jest", version = "0.22.0")
bazel_dep(name = "aspect_rules_js", version = "2.0.0")
bazel_dep(name = "aspect_rules_lint", version = "1.0.0-rc9")
bazel_dep(name = "aspect_rules_swc", version = "2.0.0")
bazel_dep(name = "aspect_rules_ts", version = "3.0.0")
bazel_dep(name = "aspect_rules_webpack", version = "0.16.0")
```

Language(s) and/or frameworks involved:

Clang-Tidy

### How to reproduce

```shell
Checkout: https://github.com/aspect-build/bazel-examples

Run: `bazel lint //speller/...`
```

### Any other information?

We have solved this problem for eslint. Look into how we fixed it there and apply it to clang tidy as well

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with `bazel lint //speller/...` in the bazel-examples checkout, then inspect how the existing eslint fix produces relative paths. Compare that path handling with the Clang-Tidy integration and verify that lint output uses workspace-relative paths for the speller targets.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.