#!/usr/bin/python3

import glob
import json
import os
import re
import subprocess
import sys

publicJsonDirectory = sys.argv[1] if len(sys.argv) > 1 else ""
if not os.path.isdir(publicJsonDirectory):
    print('public/json is not found')
    exit(1)

#
# Check files
#

filePaths = glob.glob("{}/*".format(publicJsonDirectory))
for filePath in filePaths:
    #
    # Check file extension
    #

    if not re.search(r'\.json$', filePath):
        basename = os.path.basename(filePath)
        print('')
        print('----------------------------------------')
        print('ERROR:')
        print("Please rename {}/{} to {}/{}.json".format(
            publicJsonDirectory,
            basename,
            publicJsonDirectory,
            basename))
        print('----------------------------------------')
        print('')
        exit(1)

    #
    # Check json validity
    #

    with open(filePath) as f:
        try:
            json.load(f)
        except Exception as e:
            print('')
            print('----------------------------------------')
            print('ERROR:')
            print("{} error: {}".format(filePath, e))
            print('----------------------------------------')
            print('')
            exit(1)

#
# Apply lint
#

subprocess.run([
    "{}/apply-lint.sh".format(os.path.dirname(__file__)),
    "{}/*.json".format(publicJsonDirectory)
])

@@ -231,24 +231,28 @@
 found')%0A    
+sys.
 exit(1)%0A%0A#%0A#
@@ -827,32 +827,36 @@
 int('')%0A        
+sys.
 exit(1)%0A%0A    #%0A 
@@ -1248,16 +1248,20 @@
         
+sys.
 exit(1)%0A
@@ -1279,16 +1279,25 @@
 lint%0A#%0A%0A
+result = 
 subproce
@@ -1410,8 +1410,36 @@
 ory)%0A%5D)%0A
+sys.exit(result.returncode)%0A

Fix lint-public-json.py to use apply-lint.sh result