1414 $(MAKE ) -C lib/idp_common_pkg test
1515
1616# Run both linting and formatting in one command
17- lint : ruff-lint format
17+ lint : ruff-lint format check-arn-partitions
1818
1919# Run linting checks and fix issues automatically
2020ruff-lint :
@@ -29,16 +29,39 @@ format:
2929lint-cicd :
3030 @echo " Running code quality checks..."
3131 @if ! ruff check; then \
32- echo " $( RED) ERROR: Ruff linting failed!$( NC) " ; \
33- echo " $( YELLOW) Please run 'make ruff-lint' locally to fix these issues.$( NC) " ; \
32+ echo -e " $( RED) ERROR: Ruff linting failed!$( NC) " ; \
33+ echo -e " $( YELLOW) Please run 'make ruff-lint' locally to fix these issues.$( NC) " ; \
3434 exit 1; \
3535 fi
3636 @if ! ruff format --check; then \
37- echo " $( RED) ERROR: Code formatting check failed!$( NC) " ; \
38- echo " $( YELLOW) Please run 'make format' locally to fix these issues.$( NC) " ; \
37+ echo -e " $( RED) ERROR: Code formatting check failed!$( NC) " ; \
38+ echo -e " $( YELLOW) Please run 'make format' locally to fix these issues.$( NC) " ; \
39+ exit 1; \
40+ fi
41+ @echo -e " $( GREEN) All code quality checks passed!$( NC) "
42+
43+ # Check CloudFormation templates for hardcoded AWS partition ARNs
44+ check-arn-partitions :
45+ @echo " Checking CloudFormation templates for hardcoded ARN partitions..."
46+ @FOUND_ISSUES=0; \
47+ for template in template.yaml patterns/* /template.yaml patterns/* /sagemaker_classifier_endpoint.yaml options/* /template.yaml; do \
48+ if [ -f " $$ template" ]; then \
49+ echo " Checking $$ template..." ; \
50+ MATCHES=$$(grep -n "arn:aws:" "$$template" | grep -v "arn:\$${AWS::Partition}:" || true ) ; \
51+ if [ -n " $$ MATCHES" ]; then \
52+ echo -e " $( RED) ERROR: Found hardcoded 'arn:aws:' references in $$ template:$( NC) " ; \
53+ echo " $$ MATCHES" | sed ' s/^/ /' ; \
54+ echo -e " $( YELLOW) These should use 'arn:\$ ${AWS:: Partition} :' instead for GovCloud compatibility$( NC) " ; \
55+ FOUND_ISSUES=1; \
56+ fi ; \
57+ fi ; \
58+ done ; \
59+ if [ $$ FOUND_ISSUES -eq 0 ]; then \
60+ echo -e " $( GREEN) ✅ No hardcoded ARN partition references found!$( NC) " ; \
61+ else \
62+ echo -e " $( RED) ❌ Found hardcoded ARN partition references that need to be fixed$( NC) " ; \
3963 exit 1; \
4064 fi
41- @echo " $( GREEN) All code quality checks passed!$( NC) "
4265
4366# A convenience Makefile target that runs
4467commit : lint test
0 commit comments