[WIP] - feat: add pre-commit framework
Official -> "Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks."
https://pre-commit.com/
Description
Using a pre-commit framework speeds up development as a lot of tests can be run on the local machine giving instant feedback. So we don't have to wait for the CI / GitHub actions to run to get feedback. The pre-commit automatically fixes some of the issues when you do git commit and if there are any issues the tests are marked as red failed and the commit fails. Then you will need to commit again so that all the tests pass green.
There are many more pre-commit checks listed here -> https://pre-commit.com/hooks.html
Lets get this PR merged and then I will look at adding more pre-commit tests 👍
The next image shows some of the final pre-commit run for all files -> running on my local machine:
Related issue and scope
- [ ] I opened an issue to propose and discuss this change (#????)
My changes affect the following components
- [ ] API
- [ ] Controller
- [ ] Message Bus (e.g., Kafka)
- [ ] Loadbalancer
- [ ] Scheduler
- [ ] Invoker
- [ ] Intrinsic actions (e.g., sequences, conductors)
- [ ] Data stores (e.g., CouchDB)
- [x] Tests
- [ ] Deployment
- [ ] CLI
- [x] General tooling
- [x] Documentation
Types of changes
- [ ] Bug fix (generally a non-breaking change which closes an issue).
- [X] Enhancement or new feature (adds new functionality).
- [ ] Breaking change (a bug fix or enhancement which changes existing behavior).
Checklist:
- [ ] I signed an Apache CLA.
- [ ] I reviewed the style guides and followed the recommendations (Travis CI will check :).
- [x] I added tests to cover my changes.
- [x] My changes require further changes to the documentation.
- [x] I updated the documentation where necessary.
Codecov Report
Merging #5078 (bc83947) into master (659b762) will decrease coverage by
46.60%. The diff coverage isn/a.
@@ Coverage Diff @@
## master #5078 +/- ##
===========================================
- Coverage 81.92% 35.31% -46.61%
===========================================
Files 213 206 -7
Lines 10316 10051 -265
Branches 452 449 -3
===========================================
- Hits 8451 3550 -4901
- Misses 1865 6501 +4636
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...a/org/apache/openwhisk/common/ConfigMapValue.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| .../apache/openwhisk/core/controller/Namespaces.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...pache/openwhisk/core/controller/CorsSettings.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...che/openwhisk/core/entitlement/RateThrottler.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...he/openwhisk/core/entitlement/KindRestrictor.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...penwhisk/core/database/cosmosdb/CosmosDBUtil.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| .../openwhisk/core/entitlement/ActionCollection.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| .../openwhisk/core/entitlement/LocalEntitlement.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...nwhisk/core/database/cosmosdb/CosmosDBConfig.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ...openwhisk/core/entitlement/PackageCollection.scala | 0.00% <0.00%> (-100.00%) |
:arrow_down: |
| ... and 140 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 659b762...bc83947. Read the comment docs.