Add pre-push hook
This commit is contained in:
2
.github/workflows/dotnet-core.yaml
vendored
2
.github/workflows/dotnet-core.yaml
vendored
@@ -26,4 +26,4 @@ jobs:
|
||||
- name: Install Fantomas
|
||||
run: dotnet tool restore
|
||||
- name: Run Fantomas
|
||||
run: dotnet tool run fantomas --check -r .
|
||||
run: ./hooks/pre-push
|
||||
|
17
hooks/pre-push
Executable file
17
hooks/pre-push
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import subprocess
|
||||
|
||||
def check_fantomas():
|
||||
result = subprocess.run(["dotnet", "tool", "run", "fantomas", "--check", "-r", "."])
|
||||
if result.returncode != 0:
|
||||
print(result.stdout)
|
||||
raise Exception(f"Formatting incomplete (return code: {result.returncode}). Consider running `dotnet tool run fantomas -r .`")
|
||||
|
||||
|
||||
def main():
|
||||
check_fantomas()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user