@@ -32,8 +32,12 @@ def remove_header(path: str):
32
32
if path .endswith ('.php' ):
33
33
content = content .rstrip ()
34
34
content = content .replace ('<?php\n ' , '' )
35
- elif path .endswith ('.go' ) and 'sorting' not in path :
36
- content = content .replace ('package main\n \n ' , '' ).replace ('package main\n ' , '' )
35
+ elif path .endswith ('.go' ):
36
+ content = content .rstrip ()
37
+ if 'sorting' not in path :
38
+ content = content .replace ('package main\n \n ' , '' ).replace (
39
+ 'package main\n ' , ''
40
+ )
37
41
else :
38
42
return
39
43
with open (path , 'w' , encoding = 'utf-8' ) as f :
@@ -95,20 +99,20 @@ def run():
95
99
"""Start formatting"""
96
100
paths = find_all_paths ()
97
101
98
- # for path in paths:
99
- # add_header(path)
100
- # if any(path.endswith(suf) for suf in ['c', 'cpp', 'java']):
101
- # # format with clang-format
102
- # os.system(f'npx clang-format -i --style=file "{path}"')
102
+ for path in paths :
103
+ add_header (path )
104
+ if any (path .endswith (suf ) for suf in ['c' , 'cpp' , 'java' ]):
105
+ # format with clang-format
106
+ os .system (f'npx clang-format -i --style=file "{ path } "' )
103
107
104
- # # format with prettier
105
- # os.system('npx prettier --write "**/*.{md,js,ts,php}"')
108
+ # format with prettier
109
+ os .system ('npx prettier --write "**/*.{md,js,ts,php}"' )
106
110
107
- # # format with gofmt
108
- # os.system('gofmt -w .')
111
+ # format with gofmt
112
+ os .system ('gofmt -w .' )
109
113
110
- # for path in paths:
111
- # remove_header(path)
114
+ for path in paths :
115
+ remove_header (path )
112
116
for path in paths :
113
117
format_inline_code (path )
114
118
0 commit comments