Add outstanding checks from lint.sh to pre-commit (#2327)
* versions * validate metadata * check names * check links
This commit is contained in:
committed by
GitHub
parent
0a105c98bd
commit
49c1d60f67
@@ -50,6 +50,28 @@ repos:
|
|||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
require_serial: true
|
require_serial: true
|
||||||
files: ^fast/.*tf
|
files: ^fast/.*tf
|
||||||
|
- id: versions
|
||||||
|
name: Align Terraform provider versions
|
||||||
|
language: script
|
||||||
|
files: (versions.tf|^default-versions.tf)$
|
||||||
|
pass_filenames: false
|
||||||
|
entry: /usr/bin/find . -type f -name 'versions.tf' -exec cp default-versions.tf {} \;
|
||||||
|
- id: validate_metadata
|
||||||
|
name: Validate blueprints metadata
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
files: ^blueprints
|
||||||
|
entry: tools/validate_metadata.py -v --failed-only blueprints
|
||||||
|
- id: check-names
|
||||||
|
name: Check name lengths for FAST
|
||||||
|
language: system
|
||||||
|
pass_filenames: false
|
||||||
|
files: ^fast
|
||||||
|
entry: tools/check_names.py --prefix-length=10 --failed-only fast/stages
|
||||||
|
- id: check-links
|
||||||
|
name: Check links in markdown files
|
||||||
|
language: system
|
||||||
|
entry: tools/check_links.py --no-show-summary --scan-files
|
||||||
|
|
||||||
# - repo: https://github.com/adrienverge/yamllint
|
# - repo: https://github.com/adrienverge/yamllint
|
||||||
# rev: v1.34.0
|
# rev: v1.34.0
|
||||||
|
|||||||
@@ -78,9 +78,12 @@ def check_docs(dir_name, external=False):
|
|||||||
@click.option('-e', '--external', is_flag=True, default=False,
|
@click.option('-e', '--external', is_flag=True, default=False,
|
||||||
help='Whether to test external links.')
|
help='Whether to test external links.')
|
||||||
@click.option('--show-summary/--no-show-summary', default=True)
|
@click.option('--show-summary/--no-show-summary', default=True)
|
||||||
def main(dirs, external, show_summary=True):
|
@click.option('--scan-files', default=False, is_flag=True)
|
||||||
|
def main(dirs, external, show_summary=True, scan_files=False):
|
||||||
'Checks links in Markdown files contained in dirs.'
|
'Checks links in Markdown files contained in dirs.'
|
||||||
errors = []
|
errors = []
|
||||||
|
if scan_files:
|
||||||
|
dirs = [pathlib.Path(x).parent for x in dirs]
|
||||||
for dir_name in dirs:
|
for dir_name in dirs:
|
||||||
if show_summary:
|
if show_summary:
|
||||||
print(f'----- {dir_name} -----')
|
print(f'----- {dir_name} -----')
|
||||||
|
|||||||
Reference in New Issue
Block a user