-
Notifications
You must be signed in to change notification settings - Fork 0
correcao do uso de git fetch no script #68
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -90,20 +90,24 @@ run_reviewdog() { | |||||
|
|
||||||
| generate_git_diff() { | ||||||
| if [ -n "$GITHUB_BASE_SHA" ] && [ -n "$GITHUB_HEAD_SHA" ]; then | ||||||
| git fetch origin "$GITHUB_BASE_SHA" --depth=1 >/dev/null 2>&1 || true | ||||||
| git fetch origin "$GITHUB_HEAD_SHA" --depth=1 >/dev/null 2>&1 || true | ||||||
| git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' | ||||||
| if git cat-file -e "$GITHUB_BASE_SHA" 2>/dev/null && git cat-file -e "$GITHUB_HEAD_SHA" 2>/dev/null; then | ||||||
| git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The git diff command should include error handling to prevent silent failures when the diff operation fails.
Suggested change
|
||||||
| else | ||||||
| git fetch origin "$GITHUB_BASE_SHA" --depth=1 2>&1 || true | ||||||
| git fetch origin "$GITHUB_HEAD_SHA" --depth=1 2>&1 || true | ||||||
| git diff -U0 "$GITHUB_BASE_SHA" "$GITHUB_HEAD_SHA" -- '*.groovy' 2>&1 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The git diff command should include error handling to prevent silent failures when the diff operation fails.
Suggested change
|
||||||
| fi | ||||||
| else | ||||||
| git diff -U0 HEAD~1 -- '*.groovy' | ||||||
| git diff -U0 HEAD~1 -- '*.groovy' 2>&1 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The git diff command should include error handling to prevent silent failures when the diff operation fails.
Suggested change
|
||||||
| fi | ||||||
| } | ||||||
|
|
||||||
| build_changed_lines_cache() { | ||||||
| true > "$CHANGED_FILES_CACHE" | ||||||
| true > "$CHANGED_LINES_CACHE" | ||||||
|
|
||||||
| generate_git_diff > "$ALL_DIFF" 2>/dev/null || return | ||||||
| [ ! -s "$ALL_DIFF" ] && return | ||||||
| generate_git_diff > "$ALL_DIFF" 2>&1 | ||||||
| [ ! -s "$ALL_DIFF" ] && return 1 | ||||||
|
|
||||||
| awk ' | ||||||
| BEGIN { file = ""; line_num = 0 } | ||||||
|
|
@@ -185,12 +189,9 @@ check_blocking_rules() { | |||||
|
|
||||||
| echo "" | ||||||
| echo "⚠️ Analisando se as P1s estão em linhas alteradas..." | ||||||
| build_changed_lines_cache | ||||||
|
|
||||||
| if [ ! -s "$ALL_DIFF" ]; then | ||||||
| echo "" | ||||||
| echo "⚠️ Diff vazio: Sem informações de linhas alteradas. Todas as P1s são consideradas bloqueantes." | ||||||
| echo "💡 Corrija as violações ou use um bypass autorizado." | ||||||
|
|
||||||
| if ! build_changed_lines_cache || [ ! -s "$ALL_DIFF" ]; then | ||||||
| echo "❌ Não foi possível gerar diff. Todas as P1s serão consideradas bloqueantes." | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
|
|
||||||
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.
📝 [shellcheck] reported by reviewdog 🐶
Double quote to prevent globbing and word splitting. SC2086
codenarc-docker/entrypoint.sh
Line 27 in 2f2dbd9