File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -20,3 +20,10 @@ repos:
20
20
rev : ' v8.0.1'
21
21
hooks :
22
22
- id : clang-format
23
+ - repo : local
24
+ hooks :
25
+ - id : check-image-naming
26
+ name : check image names
27
+ language : python
28
+ entry : tools/check-image-names.py
29
+ files : " .*/images/.*"
Original file line number Diff line number Diff line change
1
+ #!python3
2
+
3
+ import sys
4
+ import os
5
+
6
+ problems = False
7
+ for file in sys .argv [1 :]:
8
+ parts = file .split (os .sep )
9
+ # Ignore non-interesting files
10
+ if len (parts ) != 3 or parts [1 ] != "images" :
11
+ continue
12
+
13
+ if parts [0 ] == "quickstart" :
14
+ prefix = "quickstart-"
15
+ else :
16
+ prefix = f"tutorials-{ parts [0 ]} -"
17
+
18
+ if not parts [2 ].startswith (prefix ):
19
+ print (f"Incorrect: { file } " )
20
+ print (f"Expected prefix: { prefix } " )
21
+ print ()
22
+ problems = True
23
+
24
+ sys .exit (1 if problems else 0 )
You can’t perform that action at this time.
0 commit comments