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

add pre-commit hook for dotnet-format #4362

Merged
merged 16 commits into from
Aug 17, 2020
Merged

add pre-commit hook for dotnet-format #4362

merged 16 commits into from
Aug 17, 2020

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Aug 14, 2020

Proposed change(s)

WIP - hook to run dotnet-format on cs files. Assumes the package is already installed.
Will likely fail to start precommit in CI; will definitely fail because files aren't formatted correctly.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the documentation (if applicable)
  • Updated the migration guide (if applicable)

Other comments

@@ -0,0 +1 @@
com.unity.ml-agents/.editorconfig
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a symlink to the "main" config.

for f in args.files:
fp.write(f + "\n")

subprocess_args = ["dotnet", "format", "--folder", "--include", f"@{resp_file}"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could potentially add more flags here (and in the ArgumentParser accordingly) but this works well enough for now.

@chriselion chriselion requested a review from surfnerd August 14, 2020 18:50
@chriselion chriselion changed the title hook first pass add pre-commit hook for dotnet-format Aug 14, 2020
@chriselion
Copy link
Contributor Author

Thanks to @tomekpaszek for introducing me to dotnet-format

Copy link
Contributor

@surfnerd surfnerd left a comment

Choose a reason for hiding this comment

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

LGTM

@chriselion chriselion merged commit 9a2ed84 into master Aug 17, 2020
@chriselion chriselion deleted the dotnet-format-hook branch September 16, 2020 17:08
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants