-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#25297] YSQL: stylistic change to ybsimplelint.sh
Summary: Add line breaks for each command in pipelines. Purely a stylistic change. Jira: DB-14495 Test Plan: Close: #25297 Jenkins: skip Reviewers: patnaik.balivada Reviewed By: patnaik.balivada Subscribers: patnaik.balivada, yql Differential Revision: https://phorge.dev.yugabyte.com/D40561
- Loading branch information
Showing
1 changed file
with
28 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,43 @@ | ||
#!/usr/bin/env bash | ||
# Simple linter for postgres code. | ||
grep -nE '\s+$' "$1" | sed 's/^/error:trailing_whitespace:/' | ||
grep -nvE '^( * {0,3}\S|$)' "$1" | sed 's/^/error:leading_whitespace:/' | ||
grep -nE '\s+$' "$1" \ | ||
| sed 's/^/error:trailing_whitespace:/' | ||
grep -nvE '^( * {0,3}\S|$)' "$1" \ | ||
| sed 's/^/error:leading_whitespace:/' | ||
|
||
# Second grep below is to exclude comments: | ||
# - lines starting with comments | ||
# - \w\* inside a single-line or inline comment. | ||
grep -nE '\w\*+(\s|\)|$)' "$1" | grep -vE '^[0-9]+:\s*/?\*\s|.*/\*.*\w\*.*\*/' | sed 's/^/warning:likely_bad_pointer:/' | ||
grep -nE '\w\*+(\s|\)|$)' "$1" \ | ||
| grep -vE '^[0-9]+:\s*/?\*\s|.*/\*.*\w\*.*\*/' \ | ||
| sed 's/^/warning:likely_bad_pointer:/' | ||
|
||
grep -nE '/\*(\w+|\s\w+|\w+\s)\*/' "$1" | sed 's/^/error:bad_parameter_comment_spacing:/' | ||
grep -nE '/\*(\w+|\s\w+|\w+\s)\*/' "$1" \ | ||
| sed 's/^/error:bad_parameter_comment_spacing:/' | ||
|
||
# Second grep below is to exclude function declarations (or catch function | ||
# declarations missing storage class). Unfortunately, it is not easy to | ||
# distinguish static function definitions from declarations when the parameter | ||
# list spans multiple lines, so those cases are missed. | ||
grep -nE '^\w+(\s+\w+)+\(' "$1" | grep -vE '^[0-9]+:(NON_EXEC_STATIC|extern|static)\s.*[^\)]$' | sed 's/^/warning:likely_bad_function_signature:/' | ||
grep -nE '^\w+(\s+\w+)+\(' "$1" \ | ||
| grep -vE '^[0-9]+:(NON_EXEC_STATIC|extern|static)\s.*[^\)]$' \ | ||
| sed 's/^/warning:likely_bad_function_signature:/' | ||
|
||
grep -nE '(\)|else)\s+{$' "$1" | sed 's/^/warning:likely_bad_opening_brace:/' | ||
grep -nE '}\s+else' "$1" | sed 's/^/warning:likely_bad_closing_brace:/' | ||
grep -nE '(\)|else)\s+{$' "$1" \ | ||
| sed 's/^/warning:likely_bad_opening_brace:/' | ||
grep -nE '}\s+else' "$1" \ | ||
| sed 's/^/warning:likely_bad_closing_brace:/' | ||
|
||
grep -nE ',\s*errmsg(_plural)?\(' "$1" | sed 's/^/error:missing_linebreak_before_errmsg:/' | ||
grep -nE ',\s*errdetail(_plural)?\(' "$1" | sed 's/^/error:missing_linebreak_before_errdetail:/' | ||
grep -nE ',\s*errhint\(' "$1" | sed 's/^/error:missing_linebreak_before_errhint:/' | ||
grep -nE ',\s*errmsg(_plural)?\(' "$1" \ | ||
| sed 's/^/error:missing_linebreak_before_errmsg:/' | ||
grep -nE ',\s*errdetail(_plural)?\(' "$1" \ | ||
| sed 's/^/error:missing_linebreak_before_errdetail:/' | ||
grep -nE ',\s*errhint\(' "$1" \ | ||
| sed 's/^/error:missing_linebreak_before_errhint:/' | ||
|
||
grep -nE 'errmsg(_plural)?\("[A-Z][a-z]' "$1" | sed 's/^/warning:likely_bad_capitalization_in_errmsg:/' | ||
grep -nE 'errdetail(_plural)?\("[a-z]' "$1" | sed 's/^/warning:likely_bad_lowercase_in_errdetail:/' | ||
grep -nE 'errhint\("[a-z]' "$1" | sed 's/^/warning:likely_bad_lowercase_in_errhint:/' | ||
grep -nE 'errmsg(_plural)?\("[A-Z][a-z]' "$1" \ | ||
| sed 's/^/warning:likely_bad_capitalization_in_errmsg:/' | ||
grep -nE 'errdetail(_plural)?\("[a-z]' "$1" \ | ||
| sed 's/^/warning:likely_bad_lowercase_in_errdetail:/' | ||
grep -nE 'errhint\("[a-z]' "$1" \ | ||
| sed 's/^/warning:likely_bad_lowercase_in_errhint:/' |