-
-
Notifications
You must be signed in to change notification settings - Fork 53
chore: Add line endings and BOM checks to CI lint workflow #986
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
Conversation
|
Could it be easier done with .gitattributes? And then |
Yeah, adding |
.github/workflows/lint.yml
Outdated
| - name: Check Line Endings | ||
| run: | | ||
| echo "Checking for consistent line endings (LF) in source files..." | ||
| files_with_crlf=$(find plugin-dev/Source/Sentry plugin-dev/Source/SentryEditor -name "*.h" -o -name "*.cpp" | xargs grep -l $'\r' 2>/dev/null || true) | ||
| if [ -n "$files_with_crlf" ]; then | ||
| echo "ERROR: Found files with CRLF line endings. Please convert all source files to use LF line endings." | ||
| echo "$files_with_crlf" | ||
| exit 1 | ||
| fi | ||
| echo "✓ All source files have consistent LF line endings." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be doable with clang-format alone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a viable option. However, a separate check here seems to provide cleaner output compared to clang-format which tends to flood the logs with error: code should be clang-formatted messages for every line in a file with invalid line endings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just push the clang-formatted code automatically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - clang-format now also checks for line endings and modifies sources in-place when needed. If any changes were made they will be pushed in the next step.
* Add code auto format Change line ending for source file to test it out * Fix script permissions * Fix branch name * Try different approach to checkout * Try to checkout branch differently * Test * Test * Format code * Refactor workflow * Test * Clean up * Format code * Test * Test * Fix * Test * Format code --------- Co-authored-by: Sentry Github Bot <[email protected]>
# Conflicts: # plugin-dev/Source/Sentry/Private/HAL/PlatformSentryAttachment.h # plugin-dev/Source/Sentry/Private/HAL/PlatformSentryScope.h # plugin-dev/Source/Sentry/Private/Microsoft/MicrosoftSentrySubsystem.cpp # plugin-dev/Source/Sentry/Private/Microsoft/MicrosoftSentrySubsystem.h
vaind
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LFTM except for running on main
| - name: Commit Formatted Code | ||
| if: steps.clang-format.outputs.FORMATTING_CHANGED == 'true' | ||
| env: | ||
| GITHUB_BRANCH: ${{ github.ref_name }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't run on the main branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - added a corresponding check to if block here.
|
Do we need this in the console repos too? |
This PR addresses concerns regarding inconsistent line endings and BOM in some source files included in the plugin package. It also adds an automated check for these issues as part of the CI lint workflow (see #970 for additional details).
Related to #969
#skip-changelog