mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(Apps/Codestyle): ignore comments for some checks (#21268)
This commit is contained in:
@@ -112,7 +112,7 @@ def sql_check(file: io, file_path: str) -> None:
|
|||||||
check_failed = True
|
check_failed = True
|
||||||
if "EntryOrGuid" in line:
|
if "EntryOrGuid" in line:
|
||||||
print(
|
print(
|
||||||
f"Please use entryorguid syntax instead of EntryOrgGuid in {file_path} at line {line_number}\nWe recommend to use keira to have the right syntax in auto-query generation")
|
f"Please use entryorguid syntax instead of EntryOrGuid in {file_path} at line {line_number}\nWe recommend to use keira to have the right syntax in auto-query generation")
|
||||||
check_failed = True
|
check_failed = True
|
||||||
if [match for match in [';;'] if match in line]:
|
if [match for match in [';;'] if match in line]:
|
||||||
print(
|
print(
|
||||||
@@ -142,6 +142,8 @@ def insert_safety_check(file: io, file_path: str) -> None:
|
|||||||
|
|
||||||
# Parse all the file
|
# Parse all the file
|
||||||
for line_number, line in enumerate(file, start = 1):
|
for line_number, line in enumerate(file, start = 1):
|
||||||
|
if line.startswith("--"):
|
||||||
|
continue
|
||||||
if "INSERT" in line and "DELETE" not in previous_line:
|
if "INSERT" in line and "DELETE" not in previous_line:
|
||||||
print(f"No DELETE keyword found after the INSERT in {file_path} at line {line_number}\nIf this error is intended, please advert a maintainer")
|
print(f"No DELETE keyword found after the INSERT in {file_path} at line {line_number}\nIf this error is intended, please advert a maintainer")
|
||||||
check_failed = True
|
check_failed = True
|
||||||
@@ -163,7 +165,11 @@ def semicolon_check(file: io, file_path: str) -> None:
|
|||||||
total_lines = len(lines)
|
total_lines = len(lines)
|
||||||
|
|
||||||
for line_number, line in enumerate(lines, start=1):
|
for line_number, line in enumerate(lines, start=1):
|
||||||
stripped_line = line.rstrip() # Remove trailing whitespace including newline
|
if line.startswith('--'):
|
||||||
|
continue
|
||||||
|
# Remove trailing whitespace including newline
|
||||||
|
# Remove comments from the line
|
||||||
|
stripped_line = line.split('--', 1)[0].strip()
|
||||||
|
|
||||||
# Check if one keyword is in the line
|
# Check if one keyword is in the line
|
||||||
if not query_open and any(keyword in stripped_line for keyword in sql_keywords):
|
if not query_open and any(keyword in stripped_line for keyword in sql_keywords):
|
||||||
|
|||||||
Reference in New Issue
Block a user