@@ -44,7 +44,7 @@ def source_to_dict(result):
4444 "repo" : result .repo ,
4545 "source_location" : result .source_location ,
4646 "line" : result .line ,
47- "type " : result .type ,
47+ "source_type " : result .source_type ,
4848 "notes" : result .notes
4949 }
5050
@@ -76,7 +76,6 @@ def _resolve_db_path(relative_db_path: str | Path):
7676class CodeqlSqliteBackend :
7777 def __init__ (self , memcache_state_dir : str ):
7878 self .memcache_state_dir = memcache_state_dir
79- self .location_pattern = r'^([a-zA-Z]+)(:\d+){4}$'
8079 if not Path (self .memcache_state_dir ).exists ():
8180 db_dir = 'sqlite://'
8281 else :
@@ -85,7 +84,7 @@ def __init__(self, memcache_state_dir: str):
8584 Base .metadata .create_all (self .engine , tables = [Source .__table__ ])
8685
8786
88- def store_new_source (self , repo , source_location , line , type , notes , update = False ):
87+ def store_new_source (self , repo , source_location , line , source_type , notes , update = False ):
8988 with Session (self .engine ) as session :
9089 existing = session .query (Source ).filter_by (repo = repo , source_location = source_location , line = line ).first ()
9190 if existing :
@@ -95,7 +94,7 @@ def store_new_source(self, repo, source_location, line, type, notes, update = Fa
9594 else :
9695 if update :
9796 return f"No source exists at repo { repo } , location { source_location } , line { line } to update."
98- new_source = Source (repo = repo , source_location = source_location , line = line , type = type , notes = notes )
97+ new_source = Source (repo = repo , source_location = source_location , line = line , source_type = source_type , notes = notes )
9998 session .add (new_source )
10099 session .commit ()
101100 return f"Added new source for { source_location } in { repo } ."
@@ -171,7 +170,7 @@ def remote_sources(owner: str, repo: str,
171170 backend .store_new_source (
172171 repo = repo ,
173172 source_location = result .get ('location' , '' ),
174- type = result .get ('source' , '' ),
173+ source_type = result .get ('source' , '' ),
175174 line = int (result .get ('line' , '0' )),
176175 notes = None , #result.get('description', ''),
177176 update = False
@@ -198,7 +197,7 @@ def add_source_notes(owner: str, repo: str,
198197 Add new notes to an existing source. The notes will be appended to any existing notes.
199198 """
200199 repo = process_repo (owner , repo )
201- return backend .store_new_source (repo = repo , source_location = source_location , line = line , type = "" , notes = notes , update = True )
200+ return backend .store_new_source (repo = repo , source_location = source_location , line = line , source_type = "" , notes = notes , update = True )
202201
203202@mcp .tool ()
204203def clear_codeql_repo (owner : str , repo : str ):
@@ -208,7 +207,6 @@ def clear_codeql_repo(owner: str, repo: str):
208207 repo = process_repo (owner , repo )
209208 with Session (backend .engine ) as session :
210209 deleted_sources = session .query (Source ).filter_by (repo = repo ).delete ()
211- # deleted_apps = session.query(Application).filter_by(repo=repo).delete()
212210 session .commit ()
213211 return f"Cleared { deleted_sources } sources from repo { repo } ."
214212
0 commit comments