forked from godotengine/godot
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request godotengine#88933 from raulsntos/dotnet/pre-commit
Move dotnet-format script to pre-commit
- Loading branch information
Showing
6 changed files
with
38 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
import glob | ||
import os | ||
import sys | ||
|
||
# Create dummy generated files. | ||
for path in [ | ||
"modules/mono/SdkPackageVersions.props", | ||
]: | ||
os.makedirs(os.path.dirname(path), exist_ok=True) | ||
with open(path, "w") as f: | ||
f.write("<Project />") | ||
|
||
# Avoid importing GeneratedIncludes.props. | ||
os.environ["GodotSkipGenerated"] = "true" | ||
|
||
# Match all the input files to their respective C# project. | ||
input_files = [os.path.normpath(x) for x in sys.argv] | ||
projects = { | ||
path: [f for f in sys.argv if os.path.commonpath([f, path]) == path] | ||
for path in [os.path.dirname(f) for f in glob.glob("**/*.csproj", recursive=True)] | ||
} | ||
|
||
# Run dotnet format on all projects with more than 0 modified files. | ||
for path, files in projects.items(): | ||
if len(files) > 0: | ||
command = f"dotnet format {path} --include {' '.join(files)}" | ||
os.system(command) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters