Skip to content
This repository was archived by the owner on Jan 1, 2026. It is now read-only.

Commit 23af617

Browse files
committed
Switch to the exitstatus module.
1 parent 42e502a commit 23af617

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cppcheck_junit.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import sys
1010
from xml.etree import ElementTree
1111

12-
EXIT_SUCCESS = 0
13-
EXIT_FAILURE = -1
12+
from exitstatus import ExitStatus
1413

1514

1615
class CppcheckError(object):
@@ -144,7 +143,7 @@ def generate_single_success_test_suite():
144143

145144

146145
def main(): # pragma: no cover
147-
# type: () -> int
146+
# type: () -> ExitStatus
148147
"""Main function.
149148
150149
Returns:
@@ -156,22 +155,22 @@ def main(): # pragma: no cover
156155
errors = parse_cppcheck(args.input_file)
157156
except ValueError as e:
158157
print(str(e))
159-
return EXIT_FAILURE
158+
return ExitStatus.failure
160159
except IOError as e:
161160
print(str(e))
162-
return EXIT_FAILURE
161+
return ExitStatus.failure
163162
except ElementTree.ParseError as e:
164163
print('{} is a malformed XML file. Did you use --xml-version=2?\n{}'.format(
165164
args.input_file, e))
166-
return EXIT_FAILURE
165+
return ExitStatus.failure
167166

168167
if len(errors) > 0:
169168
tree = generate_test_suite(errors)
170169
else:
171170
tree = generate_single_success_test_suite()
172171
tree.write(args.output_file, encoding='utf-8', xml_declaration=True)
173172

174-
return EXIT_SUCCESS
173+
return ExitStatus.success
175174

176175
if __name__ == '__main__': # pragma: no cover
177176
sys.exit(main())

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
exitstatus
12
typing

0 commit comments

Comments
 (0)