Skip to content

pre-commit Github action #67

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

Closed

Conversation

nkoukpaizan
Copy link
Collaborator

@nkoukpaizan nkoukpaizan commented Feb 28, 2025

Setup to apply pre-commit fixes in Github actions.

This is currently set to apply changes automatically when necessary. However, for security reason, this then disables further checks unless using tokens (see https://github.com/EndBug/add-and-commit?tab=readme-ov-file#about-actionscheckout). Adding another commit ourselves should then re-instate checks. There potentially are better ways to handle this.

Another option is to not apply the changes automatically. The pre-commit pipeline will then be reported as failed and it will be on the owner of the pull request to fix it.

nkoukpaizan and others added 26 commits February 10, 2025 14:13
* Improve the way to find Enzyme.

* Add missing 'REQUIRED' argument to find_library.

* Explicitly look for .dylib and .dll in addition to .so. Not providing an extension does not seem to work for Enzyme plugin.
* fixed some style issues and variable name selection

* fixed guard for hpp file

* fixed typos


---------

Co-authored-by: pelesh <[email protected]>
* Defined base classes for Buses and components.

* Add infinite bus to phasor dynamic components.

* Setup unit testing for phasor dynamics components.

* Add simple load component.

* Add bus tests.

* Add Branch model.

* Add load tests.

* New Model::Evaluator*

* Use override keyword in phasor dynamics models.

* Expand code comments.
* Replace ModelEvaluator class.

* Remove ModelEvaluatorImpl dependence for power electronics models.

* Move power flow specific files to Model/PowerFlow dir.

* Add phasor dynamics system composer.

* Add test for system composer.

* Add template for implementing synchronous machine model.

* Add testing framework for the synchronous machine model
* Add dependency-tracking variable data type.

* Fix compiler warnings.

* Test chain rule with local variable.

---------

Co-authored-by: shakedregev <[email protected]>
)

* Add preliminary Enzyme support

* Use better naming conventions

* More verbose tests for enzyme support.

* int --> double in Enzyme examples.

* Separate scalar and vector examples using Enzyme.

* Use classes in EnzymeLibCheck.

* Basic usage of DenseMatrix in EnzymeVector example.

* Method to convert Dense matriz to COO.

* Use DenseMatrix to store the Jacobians in Enzyme vector example.

* Working Enzyme derivative of DistributedGenerator

* EnzymeLibVectorCheck.

* Better documentation of the DenseMatrix class.

---------

Co-authored-by: Asher Mancinelli <[email protected]>
Co-authored-by: pelesh <[email protected]>
Co-authored-by: Slaven Peles <[email protected]>
- Fixed an incorrect option name causing the formatting to not work
- Increased column limit to 120
- Moved access modifiers back
this aligns more cloesly with the current codebase, and seems like a good idea since most of the code will be in the `GridKit` namespace
- Short functions will never be on a single line
- Don't binpack arguments/parameters
- Align pointers and references to the left
- Comments effectively have an extra 80 character column limit from the rest of code (bringing it up to 200 characters)
- Comments which are not meant to be written/read in-editor (such as in-documentation Latex or Matlab code, meant to be rendered by other software or copied/pasted directly from/to other software) can start with ** to indicate that they should not be formatted in any way, and clang-format will skip those lines.
@nkoukpaizan nkoukpaizan added the enhancement New feature or request label Feb 28, 2025
@nkoukpaizan nkoukpaizan self-assigned this Feb 28, 2025
@nkoukpaizan nkoukpaizan marked this pull request as ready for review February 28, 2025 19:11
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.7
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pick a version that we expect people to install with Enzyme, like v15 or so.

- id: check-toml
- id: forbid-new-submodules
- id: end-of-file-fixer
- id: check-yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious - will these check- hooks actually do anything? For instance, if I make a new submodule and then submit a PR will it fail CI or?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, the check will work as you describe. You can see what it's trying yo do in CI (e.g. https://github.com/ORNL/GridKit/actions/runs/13594004211/job/38006645346#step:4:154). These are mostly legacy checks. We can remove anything we don't need.

@pelesh
Copy link
Collaborator

pelesh commented Mar 4, 2025

Closing in favor of #68.

@pelesh pelesh closed this Mar 4, 2025
@nkoukpaizan nkoukpaizan deleted the nicholson/clang-format-pre-commit-action branch May 13, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants