mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-07 22:30:38 +08:00
modify get_main_pr_language to handle azuredevops provided language format
This commit is contained in:
@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
@ -112,6 +113,8 @@ def get_main_pr_language(languages, files) -> str:
|
|||||||
# validate that the specific commit uses the main language
|
# validate that the specific commit uses the main language
|
||||||
extension_list = []
|
extension_list = []
|
||||||
for file in files:
|
for file in files:
|
||||||
|
if isinstance(file, str):
|
||||||
|
file = FilePatchInfo(base_file=None, head_file=None, patch=None, filename=file)
|
||||||
extension_list.append(file.filename.rsplit('.')[-1])
|
extension_list.append(file.filename.rsplit('.')[-1])
|
||||||
|
|
||||||
# get the most common extension
|
# get the most common extension
|
||||||
@ -133,10 +136,12 @@ def get_main_pr_language(languages, files) -> str:
|
|||||||
most_common_extension == 'scala' and top_language == 'scala' or \
|
most_common_extension == 'scala' and top_language == 'scala' or \
|
||||||
most_common_extension == 'kt' and top_language == 'kotlin' or \
|
most_common_extension == 'kt' and top_language == 'kotlin' or \
|
||||||
most_common_extension == 'pl' and top_language == 'perl' or \
|
most_common_extension == 'pl' and top_language == 'perl' or \
|
||||||
most_common_extension == 'swift' and top_language == 'swift':
|
most_common_extension == 'swift' and top_language == 'swift' or \
|
||||||
|
most_common_extension == top_language:
|
||||||
main_language_str = top_language
|
main_language_str = top_language
|
||||||
|
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
logging.info(e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return main_language_str
|
return main_language_str
|
||||||
|
Reference in New Issue
Block a user