fix(Apps/Codestyle): ignore comments for some checks (#21268)
This commit is contained in:
parent
f692ae9003
commit
b47ec3b5c8
1 changed files with 8 additions and 2 deletions
|
|
@ -112,7 +112,7 @@ def sql_check(file: io, file_path: str) -> None:
|
|||
check_failed = True
|
||||
if "EntryOrGuid" in line:
|
||||
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
|
||||
if [match for match in [';;'] if match in line]:
|
||||
print(
|
||||
|
|
@ -142,6 +142,8 @@ def insert_safety_check(file: io, file_path: str) -> None:
|
|||
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if line.startswith("--"):
|
||||
continue
|
||||
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")
|
||||
check_failed = True
|
||||
|
|
@ -163,7 +165,11 @@ def semicolon_check(file: io, file_path: str) -> None:
|
|||
total_lines = len(lines)
|
||||
|
||||
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
|
||||
if not query_open and any(keyword in stripped_line for keyword in sql_keywords):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue