Skip to content

Commit

Permalink
Add outstanding checks from lint.sh to pre-commit (#2327)
Browse files Browse the repository at this point in the history
* versions
* validate metadata
* check names
* check links
  • Loading branch information
wiktorn authored May 31, 2024
1 parent 0a105c9 commit 49c1d60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,28 @@ repos:
pass_filenames: false
require_serial: true
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
# rev: v1.34.0
Expand Down
5 changes: 4 additions & 1 deletion tools/check_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def check_docs(dir_name, external=False):
@click.option('-e', '--external', is_flag=True, default=False,
help='Whether to test external links.')
@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.'
errors = []
if scan_files:
dirs = [pathlib.Path(x).parent for x in dirs]
for dir_name in dirs:
if show_summary:
print(f'----- {dir_name} -----')
Expand Down

0 comments on commit 49c1d60

Please sign in to comment.