Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add outstanding checks from lint.sh to pre-commit #2327

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading