X Tutup
Skip to content

Commit bc7a839

Browse files
committed
updated validate_json.py
1 parent 8fbb8e6 commit bc7a839

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

validate_json.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
sys.exit(4)
5555

5656
__author__ = 'Hari Sekhon'
57-
__version__ = '0.8.0'
57+
__version__ = '0.8.1'
58+
5859

5960
class JsonValidatorTool(CLI):
6061

@@ -137,7 +138,7 @@ def check_json(self, content):
137138
# as failing
138139
elif isJson(content.replace("'", '"')):
139140
log.debug('valid json (single quotes)')
140-
# self.single_quotes_detectedsingle_quotes_detected = True
141+
# self.single_quotes_detected = True
141142
if self.permit_single_quotes:
142143
self.msg = self.valid_json_msg_single_quotes
143144
self.print(content)
@@ -152,6 +153,8 @@ def check_json(self, content):
152153
self.iostream.seek(0)
153154
if self.check_multirecord_json():
154155
return True
156+
if not self.passthru:
157+
die(self.invalid_json_msg)
155158
# pointless since it would simply return 'ValueError: No JSON object could be decoded'
156159
# if self.verbose > 2:
157160
# try:
@@ -189,7 +192,7 @@ def run(self):
189192
continue
190193
if not os.path.exists(arg):
191194
print("'%s' not found" % arg)
192-
sys.exit(ERRORS['WARNING'])
195+
sys.exit(ERRORS['CRITICAL'])
193196
if os.path.isfile(arg):
194197
log_option('file', arg)
195198
elif os.path.isdir(arg):

0 commit comments

Comments
 (0)
X Tutup