-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[YSQL] add lint rule for yb_typedefs.list Form_* and YB_DEFINE_HANDLE_TYPE #28549
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -25,6 +25,29 @@ if [[ "$1" == */yb_typedefs.list ]]; then | |||||
grep -Env "$pattern" "$1" \ | ||||||
| sed 's/^/error:missing_yb_in_type_name:'\ | ||||||
'Types in yb_typedefs.list should have "yb":/' | ||||||
|
||||||
grep -o 'Form_[a-zA-Z0-9_]*' "$1" | while read -r form; do | ||||||
formdata="FormData_${form#Form_}" | ||||||
if ! grep -q "^$formdata$" "$1"; then | ||||||
echo "error:missing_FormData:$formdata is missing for $form" | ||||||
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.
Suggested change
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. diff --git i/src/postgres/src/tools/pgindent/yb_typedefs.list w/src/postgres/src/tools/pgindent/yb_typedefs.list
index 53ecb19f4b..86c2d322f1 100644
--- i/src/postgres/src/tools/pgindent/yb_typedefs.list
+++ w/src/postgres/src/tools/pgindent/yb_typedefs.list
@@ -1,6 +1,5 @@
FormData_pg_yb_migration
FormData_pg_yb_profile
-FormData_pg_yb_role_profile
FormData_pg_yb_tablegroup
FormData_yb_pg_catalog_version
FormData_yb_pg_invalidation_messages does not cause lint failure. you are missing filename and line number from the message |
||||||
fi | ||||||
done | ||||||
|
||||||
grep -o 'FormData_[a-zA-Z0-9_]*' "$1" | while read -r formdata; do | ||||||
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.
Suggested change
|
||||||
form="Form_${formdata#FormData_}" | ||||||
if ! grep -q "^$form$" "$1"; then | ||||||
echo "error:missing_Form:$form is missing for $formdata" | ||||||
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.
Suggested change
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. diff --git i/src/postgres/src/tools/pgindent/yb_typedefs.list w/src/postgres/src/tools/pgindent/yb_typedefs.list
index 53ecb19f4b..f16a49fe48 100644
--- i/src/postgres/src/tools/pgindent/yb_typedefs.list
+++ w/src/postgres/src/tools/pgindent/yb_typedefs.list
@@ -9,7 +9,6 @@ Form_pg_yb_migration
Form_pg_yb_profile
Form_pg_yb_role_profile
Form_pg_yb_tablegroup
-Form_yb_pg_catalog_version
Form_yb_pg_invalidation_messages
Form_yb_pg_logical_client_version
YBExecuteMessageFunctorContext does not cause lint failure for same reason |
||||||
fi | ||||||
done | ||||||
|
||||||
find src -name '*.h' -exec grep -l 'YB_DEFINE_HANDLE_TYPE' {} \; 2>/dev/null | \ | ||||||
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. This check adds a lot of time (around 4 seconds on my Mac). Are we ok with this? YB_DEFINE_HANDLE_TYPE is only used in 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. please only check |
||||||
xargs grep -ho 'YB_DEFINE_HANDLE_TYPE([A-Z][a-zA-Z0-9_]*)' 2>/dev/null | \ | ||||||
sed 's/YB_DEFINE_HANDLE_TYPE(//' | sed 's/)//' | sort -u | while read -r handle_type; do | ||||||
transformed_type="Ybc${handle_type}" | ||||||
if ! grep -q "^$transformed_type$" "$1"; then | ||||||
echo "error:missing_handle_type:$transformed_type is missing for YB_DEFINE_HANDLE_TYPE($handle_type)" | ||||||
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. line too long 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. diff --git i/src/postgres/src/tools/pgindent/yb_typedefs.list w/src/postgres/src/tools/pgindent/yb_typedefs.list
index 53ecb19f4b..c655a151ab 100644
--- i/src/postgres/src/tools/pgindent/yb_typedefs.list
+++ w/src/postgres/src/tools/pgindent/yb_typedefs.list
@@ -267,7 +267,6 @@ YbcPgSession
YbcPgSessionState
YbcPgSessionTxnInfo
YbcPgSplitDatum
-YbcPgStatement
YbcPgSysColumns
YbcPgSysTablePrefetcherCacheMode
YbcPgTableDesc does not cause lint failure for same reason |
||||||
fi | ||||||
done | ||||||
else | ||||||
grep -En "$pattern" "$1" \ | ||||||
| sed 's/^/error:bad_yb_in_type_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.