[DRAFT] Add pre-commit to start standardizing commits and file formats #1573
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This repository could benefit from using
pre-commit
to help standardize formatting and prevent long-running formatting issues.While working on a work ticket, I encountered issues caused by inconsistent indentation (e.g., a mix of spaces and tabs) in the
values.schema.json
file for the operator chart. Inconsistent formatting can cause linting failures and prevent deploying the chart to certain Kubernetes environments.Changes in this PR:
pre-commit
configuration files so thatpre-commit
runs automatically when developers commit locally.pre-commit
on every PR commit and merge intomain
.CONTRIBUTING.md
to documentpre-commit
as a developer dependency.pre-commit
hooks:charts/opentelemetry-operator/values.schema.json
charts/opentelemetry-demo/grafana-dashboards/*.json
charts/opentelemetry-demo/products/products.json
charts/opentelemetry-ebpf/values.schema.json
charts/opentelemetry-kube-stack/values.schema.json
Chart Version Bump?
values.schema.json
changes require a version bump since they don't affect functionality or templates. Should I bump the version each chart affected? I guess I would do this in separate PRs one at a time.opentelemetry-demo
project required minor Grafana dashboard formatting updates to passpretty-format-json
, which did necessitate a patch version bump. To keep changes minimal, I separated that into a different PR ([demo] Refactor json values so they can work with pre-commit json hooks #1572) which will have to be merged first.Next Steps
pre-commit
hooks we should add in the future, but doing them all at once would make this PR too large.pre-commit
hooks in a follow-up PRs.