Browse Source
Upgrade dotnet-format from version 5 to the version included with the .NET (6) SDK.
pull/2747/head
Upgrade dotnet-format from version 5 to the version included with the .NET (6) SDK.
pull/2747/head

9 changed files with 48 additions and 84 deletions
-
5.github/workflows/build-ilspy.yml
-
10BuildTools/pre-commit
-
33BuildTools/tidy.py
-
3ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
-
45ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs
-
12ICSharpCode.Decompiler/IL/Transforms/InterpolatedStringTransform.cs
-
9ICSharpCode.Decompiler/IL/Transforms/RemoveInfeasiblePathTransform.cs
-
13ICSharpCode.Decompiler/IL/Transforms/UsingTransform.cs
-
2TestPlugin/Properties/AssemblyInfo.cs
@ -0,0 +1,10 @@ |
|||
#!/bin/sh |
|||
# |
|||
# To enable this hook, copy/symlink this file to ".git/hooks/pre-commit". |
|||
|
|||
#if git diff --quiet --ignore-submodules; then |
|||
# dotnet format whitespace --no-restore --verbosity detailed ILSpy.sln |
|||
# git add -u -- \*\*.cs |
|||
#else |
|||
exec dotnet format whitespace --verify-no-changes --no-restore --verbosity detailed ILSpy.sln |
|||
#fi |
@ -1,33 +0,0 @@ |
|||
#!/usr/bin/env python |
|||
|
|||
import os, sys, subprocess |
|||
|
|||
def check(filename): |
|||
ok = True |
|||
with open(filename, 'r') as f: |
|||
for i, line in enumerate(f): |
|||
if line.startswith(' '): |
|||
print('{}:{}: Line starting with spaces. Use tabs for indentation instead!'.format(filename, i+1)) |
|||
ok = False |
|||
return ok |
|||
|
|||
def main(): |
|||
root_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) |
|||
dirs_to_check = ( |
|||
os.path.join(root_dir, subdir) |
|||
for subdir in ('ICSharpCode.Decompiler', 'ICSharpCode.Decompiler.Tests', 'ILSpy', 'ILSpy.BamlDecompiler')) |
|||
format_result = subprocess.call(['dotnet-format', '--check', '--verbosity', 'detailed', os.path.join(root_dir, 'ILSpy.sln')]) |
|||
ok = format_result == 0 |
|||
for dir in dirs_to_check: |
|||
for root, dirs, files in os.walk(dir): |
|||
if '\\obj\\' in root: |
|||
continue |
|||
for filename in files: |
|||
if filename.lower().endswith('.cs') and not filename.lower().endswith('resources.designer.cs'): |
|||
if not check(os.path.join(root, filename)): |
|||
ok = False |
|||
print('Tidy check: {}'.format('successful' if ok else 'failed')) |
|||
return 0 if ok else 1 |
|||
|
|||
if __name__ == '__main__': |
|||
sys.exit(main()) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue