Skip to content

Conversation

lgallard
Copy link
Owner

@lgallard lgallard commented Aug 9, 2025

Test Purpose

This PR is created to verify that the pre-commit workflow is working correctly by introducing intentional formatting issues.

Expected Behavior

The pre-commit workflow should:

  1. Fail initially due to formatting issues in test_formatting.tf
  2. 🔧 Detect and report the following issues:
    • Extra trailing whitespace
    • Missing final newline
    • Inconsistent indentation
    • Improper spacing around operators
    • Missing spaces after braces

Test File Contents

The test file test_formatting.tf contains intentional formatting violations to validate that:

  • The trailing-whitespace hook catches extra spaces
  • The end-of-file-fixer hook detects missing final newlines
  • The terraform_fmt hook identifies Terraform formatting issues
  • The workflow properly reports incremental file checking on PRs

Success Criteria

✅ Pre-commit workflow triggers on this PR
✅ Workflow identifies formatting issues in the test file
✅ Workflow provides clear error messages and suggestions
✅ Incremental file checking works (only tests changed files)

This test validates that our pre-commit automation is properly protecting code quality.

This file contains various formatting issues to test the pre-commit workflow:
- Extra trailing whitespace
- Missing final newline  
- Inconsistent indentation
- Improper spacing around operators
- Missing spaces after braces
Comment on lines +10 to +13
resource "aws_kms_key" "backup"{description="Test KMS key"

# Inconsistent indentation and spacing
deletion_window_in_days=7}

Check failure

Code scanning / checkov

Ensure rotation for customer created CMKs is enabled Error test

Ensure rotation for customer created CMKs is enabled
Comment on lines +10 to +13
resource "aws_kms_key" "backup"{description="Test KMS key"

# Inconsistent indentation and spacing
deletion_window_in_days=7}

Check failure

Code scanning / checkov

Ensure KMS key Policy is defined Error test

Ensure KMS key Policy is defined
@lgallard lgallard merged commit d5cefb2 into master Aug 9, 2025
23 of 45 checks passed
@lgallard lgallard deleted the test/pre-commit-workflow branch August 9, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant