rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
tunerstudio
validate_ini.py
Go to the documentation of this file.
1
import
sys
2
import
re
3
4
def
check_unbalanced_quotes
(file_path):
5
errors = 0
6
with
open(file_path,
'r'
, encoding=
'utf-8'
)
as
f:
7
for
line_num, line
in
enumerate(f, 1):
8
line = line.strip()
9
# Ignore comments
10
if
line.startswith(
';'
)
or
line.startswith(
'#'
):
11
continue
12
13
# Count double quotes
14
quote_count = line.count(
'"'
)
15
if
quote_count % 2 != 0:
16
print(f
"Error: Unbalanced quotes at {file_path}:{line_num}"
)
17
print(f
" Line: {line}"
)
18
errors += 1
19
20
return
errors
21
22
if
__name__ ==
"__main__"
:
23
if
len(sys.argv) < 2:
24
print(
"Usage: python validate_ini.py <file_path>"
)
25
sys.exit(1)
26
27
total_errors = 0
28
for
file_path
in
sys.argv[1:]:
29
total_errors +=
check_unbalanced_quotes
(file_path)
30
31
if
total_errors > 0:
32
print(f
"Total errors found: {total_errors}"
)
33
sys.exit(1)
34
else
:
35
print(
"No syntax errors found."
)
36
sys.exit(0)
validate_ini.check_unbalanced_quotes
check_unbalanced_quotes(file_path)
Definition
validate_ini.py:4
Generated on Fri Feb 20 2026 00:12:37 for rusEFI by
1.9.8