Last active
March 20, 2024 21:20
-
-
Save fededri/e5129d293ca6fdddc680194c1d9d75fe to your computer and use it in GitHub Desktop.
check unused SQLDelight queries
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
import re | |
# Define the file paths | |
sql_file_path = "" | |
kotlin_file_path = "" | |
# Read the SQLDelight file | |
with open(sql_file_path, 'r') as file: | |
sql_file_content = file.read() | |
# Extract the SQL query names | |
sql_query_names = re.findall(r'([a-zA-Z0-9_]+):', sql_file_content) | |
# Read the Kotlin file | |
with open(kotlin_file_path, 'r') as file: | |
kotlin_file_content = file.read() | |
# Check if each SQL query name is present in the Kotlin file | |
for query_name in sql_query_names: | |
if query_name not in kotlin_file_content: | |
print(f"The query '{query_name}' is not used in the Kotlin file.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment