diff options
author | Jelle Meeus <sogladev@gmail.com> | 2025-01-25 19:58:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-25 19:58:01 +0100 |
commit | b47ec3b5c8a412ef4be24a670825ace95b0635c2 (patch) | |
tree | 89d37e8e22024c89dbc3c3d3967c7aeeec7ba75a /apps/codestyle/codestyle-sql.py | |
parent | f692ae9003a531e7949c528ac5e4429e66bea88b (diff) |
fix(Apps/Codestyle): ignore comments for some checks (#21268)
Diffstat (limited to 'apps/codestyle/codestyle-sql.py')
-rw-r--r-- | apps/codestyle/codestyle-sql.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/codestyle/codestyle-sql.py b/apps/codestyle/codestyle-sql.py index f15dceed6c..0df5dec05b 100644 --- a/apps/codestyle/codestyle-sql.py +++ b/apps/codestyle/codestyle-sql.py @@ -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): |