-
Notifications
You must be signed in to change notification settings - Fork 0
/
checker.py
39 lines (32 loc) · 930 Bytes
/
checker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! usr/bin/python
# -*- coding: ISO-8859-1 -*-
# Spritrl - REALINI Christophe 17/12/2021 - FR
import sys
isPythonFile = False
if len(sys.argv) < 2:
print('You need to put your file in argument.')
sys.exit()
fileName = sys.argv[len(sys.argv)-1]
if fileName[-2:] == 'py':
isPythonFile = True
print('Are you serious ? You don\'t need semicolon in Python :)')
if isPythonFile == False:
f = open(fileName, 'r')
accepted = ['{', '}', ':', ';', '*', '/', '\n']
line = 0
fails = []
for l in f:
line += 1
lineSize = len(l)
if l[lineSize - 2] in accepted:
continue
else:
isFailed = True
for c in l:
if c == '/':
isFailed = False
if isFailed:
fails.append(line)
print('Are you serious ? YOUR \';\' !')
for fail in fails:
print('ERROR : line ', fail)