Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: bazel lint //... leads to No aspects enabled for linting. ... even though config.yaml file exists #677

Open
codrin-lanterne opened this issue Feb 21, 2024 · 6 comments
Labels
bug Something isn't working more info needed More info needed to proceed further

Comments

@codrin-lanterne
Copy link

What happened?

Running bazel lint //... leads to

No aspects enabled for linting.
                
Add a section like the following to your .aspect/cli/config.yaml:

lint:
  aspects:
    - //tools:lint.bzl%eslint

Running bazel lint --aspect:config "$(pwd)/.aspect/cli/config.yaml" //... from the same directory, the root of the Bazel monorepo, works.

Version

Development (host) and target OS/architectures: Ubuntu 18.04

Output of bazel --version: aspect 5.8.20

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: aspect_bazel_lib 1.38.0, aspect_rules_lint 0.10.0

Language(s) and/or frameworks involved: not sure if relevant, the bazel lint command doesn't seem to properly locate the configuration file.

How to reproduce

No response

Any other information?

No response

@alexeagle
Copy link
Member

Oops, I'm sorry we missed your original issue on aspect-cli repo. I'm not able to reproduce.

You report that --aspect:config "$(pwd)/.aspect/cli/config.yaml" fixes it - it looks like something in your environment causes the Aspect CLI to look for its configuration file in a non-standard location. By explicitly pointing it back to the standard location, it's fixed.

@codrin-lanterne
Copy link
Author

No worries! Hmm, yeah, that's right, do you have any ideas on how I could investigate this? It seems to happen on my teammates machines as well so I'm wondering if there are any investigation leads I could follow.

@dansheerhealth
Copy link

We hit this too, looks like it has something to do with workspace detection.

The workaround we used:

In .bazelrc file:

common --enable_bzlmod

Add empty WORKSPACE.bazel file in workspace root.

@codrin-lanterne
Copy link
Author

Thank you for sharing, that did fix it!

@alexeagle alexeagle transferred this issue from aspect-build/rules_lint Apr 24, 2024
@alexeagle
Copy link
Member

Could either of you share what the repository looked like before adding that workaround?

From the code here https://github.com/aspect-build/aspect-cli/blob/main/pkg/bazel/workspace/finder.go#L27 I'd expect you need a WORKSPACE or WORKSPACE.bazel file, but that's required for any Bazel project to function at all. Were you trying out lint in a new Bazel project that couldn't even build?

@github-actions github-actions bot added the untriaged Requires traige label Apr 24, 2024
@alexeagle alexeagle added more info needed More info needed to proceed further and removed untriaged Requires traige labels Apr 24, 2024
@dansheerhealth
Copy link

In our repository there was a WORKSPACE.bzlmod file, but not a WORKSPACE or WORKSPACE.bazel file. Docs seemed kind of confusing about still needing a WORKSPACE file.

Also, found bazelbuild/vscode-bazel#323

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more info needed More info needed to proceed further
Projects
None yet
Development

No branches or pull requests

3 participants