Fri, 01 Jul 2022 16:46:43 +0300
Fix right click to delete not really working properly
Instead of removing the point that had been added, it would remove
the point that is being drawn, which would cause it to overwrite the
previous point using the new point, causing a bit of a delay
114
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
1 | #!/usr/bin/env python3 |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
2 | import sys |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
3 | def check(filename): |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
4 | with open(filename) as file: |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
5 | for linenumber, line in enumerate(file, 1): |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
6 | if line[-1] == '\n': |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
7 | line = line[:-1] |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
8 | line = str.replace(line, '\t', ' ' * 4) |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
9 | if len(line) > 120: |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
10 | print(str.format( |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
11 | '{filename}:{linenumber}: warning: line length exceeds 120 characters', |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
12 | filename = filename, |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
13 | linenumber = linenumber |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
14 | ), file = sys.stderr) |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
15 | def main(): |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
16 | for filename in sys.argv[1:]: |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
17 | check(filename) |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
18 | return 0 |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
19 | if __name__ == '__main__': |
4e03b0e2a29f
added build-time test for line length
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
20 | sys.exit(main()) |