INNER CODE UNIT · Python
lintfile
asdf-vm/asdf · scripts/checkstyle.py:93
def lintfile(file: Path, rules: List[Rule], options: Dict[str, Any]):
content_arr = file.read_text().split('\n')
for line_i, line in enumerate(content_arr):
if 'checkstyle-ignore' in line:
continue
for rule in rules:
should_run = False
if 'sh' in rule['fileTypes']:
if file.name.endswith('.sh') or str(file.absolute()).endswith('bin/asdf'):
should_run = True
if 'bash' in rule['fileTypes']:
if file.name.endswith('.bash') or file.name.endswith('.bats'):
should_run = True
if options['verbose']:
print(f'{str(file)}: {should_run}')