def check_syntax(self, app_path=None) -> None:
    'Run syntax on each ".py" and ".json" file.\n\n        Args:\n            app_path (str, optional): The path of Python files.\n        '
    fqpn = Path((app_path or os.getcwd()))
    for fqfn in sorted(fqpn.iterdir()):
        error = None
        status = True
        if fqfn.name.endswith('.py'):
            try:
                with fqfn.open(mode='rb') as fh:
                    ast.parse(fh.read(), filename=fqfn.name)
            except SyntaxError:
                status = False
                e = []
                for line in traceback.format_exc().split('\n')[(- 5):(- 2)]:
                    e.append(line.strip())
                error = ' '.join(e)
        elif fqfn.name.endswith('.json'):
            try:
                with fqfn.open() as fh:
                    json.load(fh)
            except ValueError as e:
                self.invalid_json_files.append(fqfn.name)
                status = False
                error = e
        else:
            continue
        if error:
            self.validation_data['errors'].append(f'Syntax validation failed for {fqfn.name} ({error}).')
        self.validation_data['fileSyntax'].append({'filename': fqfn.name, 'status': status})
Run syntax on each ".py" and ".json" file.

Args:
    app_path (str, optional): The path of Python files.
def check_syntax(self, app_path=None) -> None:
    'Run syntax on each ".py" and ".json" file.\n\n        Args:\n            app_path (str, optional): The path of Python files.\n        '
    fqpn = Path((app_path or os.getcwd()))
    for fqfn in sorted(fqpn.iterdir()):
        error = None
        status = True
        if fqfn.name.endswith('.py'):
            try:
                with fqfn.open(mode='rb') as fh:
                    ast.parse(fh.read(), filename=fqfn.name)
            except SyntaxError:
                status = False
                e = []
                for line in traceback.format_exc().split('\n')[(- 5):(- 2)]:
                    e.append(line.strip())
                error = ' '.join(e)
        elif fqfn.name.endswith('.json'):
            try:
                with fqfn.open() as fh:
                    json.load(fh)
            except ValueError as e:
                self.invalid_json_files.append(fqfn.name)
                status = False
                error = e
        else:
            continue
        if error:
            self.validation_data['errors'].append(f'Syntax validation failed for {fqfn.name} ({error}).')
        self.validation_data['fileSyntax'].append({'filename': fqfn.name, 'status': status})