5
5
6
6
import os
7
7
8
+ exclude = {"node_modules" , "vendor" , ".nuxt" , "scripts" }
9
+
8
10
9
11
def walk (root_dir ):
10
- for root , dirs , files in os .walk (root_dir , topdown = False ):
12
+ for root , dirs , files in os .walk (root_dir , topdown = True ):
13
+ dirs [:] = [d for d in dirs if d not in exclude ]
11
14
for filename in files :
12
- if filename == "node_modules" or filename == "vendor" :
13
- continue
15
+ filepath = os .path .join (root , filename )
14
16
15
17
if os .path .splitext (filename )[- 1 ] == ".go" :
16
- filepath = os .path .join (root , filename )
17
-
18
18
with open (filepath , "r" ) as reader :
19
19
originContent = reader .read ()
20
20
reader .close ()
@@ -24,8 +24,6 @@ def walk(root_dir):
24
24
writer .write (originContent )
25
25
26
26
elif os .path .splitext (filename )[- 1 ] == ".js" :
27
- filepath = os .path .join (root , filename )
28
-
29
27
with open (filepath , "r" ) as reader :
30
28
originContent = reader .read ()
31
29
reader .close ()
@@ -35,8 +33,6 @@ def walk(root_dir):
35
33
writer .write (originContent )
36
34
37
35
elif os .path .splitext (filename )[- 1 ] == ".vue" :
38
- filepath = os .path .join (root , filename )
39
-
40
36
with open (filepath , "r" ) as reader :
41
37
originContent = reader .read ()
42
38
reader .close ()
@@ -47,6 +43,4 @@ def walk(root_dir):
47
43
writer .write (originContent )
48
44
49
45
50
- walk ("./internal" )
51
- walk ("./cmd" )
52
- walk ("./frontend" )
46
+ walk ("." )
0 commit comments