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

Need a .pre-commit-config.yaml to meet Contributing Guidelines recommendation #415

Open
chickenandpork opened this issue Dec 11, 2024 · 1 comment

Comments

@chickenandpork
Copy link
Contributor

In submitting a PR, since this is my first, the act of reviewing the diff on GitHub suggests I check out the commit guidelines (https://github.com/bazel-contrib/.github/blob/c9d6d1893b10a8d68584a6ba52c3dd35506486d0/CONTRIBUTING.md). This seems to be a cross-org guideline simply recommending a basic pre-commit install.

Without the --allow-missing, this would require a .pre-commit-config.yaml to be checked-in at the workspace directory. I don't see one in the directory.

We likely need to add one: copying https://github.com/bazel-contrib/rules_cuda/blob/main/.pre-commit-config.yaml may suffice. Other repos in bazel-contrib seem to lack this config file.

Granted, the error appears because I didn't see a .pre-commit-config.yaml, so didn't install. Having run the command, I then run a pre-commit run -a, ant that produced the error:

Allans-MBP2019:rules_bazel_integration_test allanc$ pre-commit install
pre-commit installed at .git/hooks/pre-commit
Allans-MBP2019:rules_bazel_integration_test allanc$ pre-commit run -a
An error has occurred: InvalidConfigError: 
=====> .pre-commit-config.yaml is not a file
Check the log at /Users/allanc/.cache/pre-commit/pre-commit.log

That log file follows.

version information

pre-commit version: 3.0.4
git --version: git version 2.39.5 (Apple Git-154)
sys.version:
    3.9.6 (default, Oct  4 2024, 08:01:32) 
    [Clang 16.0.0 (clang-1600.0.26.4)]
sys.executable: /Library/Developer/CommandLineTools/usr/bin/python3
os.name: posix
sys.platform: darwin

error information

An error has occurred: InvalidConfigError: 
=====> .pre-commit-config.yaml is not a file
Traceback (most recent call last):
  File "/Library/Python/3.9/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/Library/Python/3.9/site-packages/pre_commit/main.py", line 394, in main
    return run(args.config, store, args)
  File "/Library/Python/3.9/site-packages/pre_commit/commands/run.py", line 417, in run
    config = load_config(config_file)
  File "/Library/Python/3.9/site-packages/cfgv.py", line 411, in load_from_filename
    return apply_defaults(data, schema)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/contextlib.py", line 135, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Library/Python/3.9/site-packages/cfgv.py", line 43, in reraise_as
    raise tp(e).with_traceback(tb) from None
  File "/Library/Python/3.9/site-packages/cfgv.py", line 40, in reraise_as
    yield
  File "/Library/Python/3.9/site-packages/cfgv.py", line 396, in load_from_filename
    raise ValidationError(f'{filename} is not a file')
pre_commit.clientlib.InvalidConfigError: 
=====> .pre-commit-config.yaml is not a file
@cgrindel
Copy link
Member

I didn't realize that the default contributing docs require pre-commit. TBH, I am not a big fan. They are fine for developer workflow, but they offer nothing useful for repo management. We will need to update the contributing docs for this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants