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 script that validates all files in the repo contain ASCII-only bytes and no UTF-8 BOM. #1199

Merged
merged 6 commits into from
Sep 4, 2020
Merged
20 changes: 20 additions & 0 deletions eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,26 @@ jobs:
coverageThreshold: 70
condition: eq(variables['AZ_SDK_CODE_COV'], 1)

# Validate all the files are saved as ASCII only without a UTF-8 BOM.
- bash: |
# Run grep recursive excluding git folder and known expected files and save a file with results.
grep -I -P -n "[^\x00-\x7F]" -r --exclude-dir ".git" --exclude-dir "docs" --exclude-dir "tools" --exclude "*CodeCoverage.cmake*" --exclude "grepResults" . > grepResults

# Display results to console.
cat grepResults

# Each result will produce one line, count how many lines were found.
files_with_non_ascii=($(wc -l < grepResults))

# Show info about the total files that needs attention.
echo Files found with non-ASCII characters: $files_with_non_ascii

# Return the count. When greater than 0, the step will fail.
exit $files_with_non_ascii

displayName: Validate Characters are ASCII
condition: eq(variables['AZ_SDK_CODE_COV'], 1)
danieljurek marked this conversation as resolved.
Show resolved Hide resolved

- job: GenerateReleaseArtifacts
pool:
vmImage: windows-2019
Expand Down