mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 11:50:37 +08:00
add configurable docstring style
This commit is contained in:
@ -49,6 +49,7 @@ final_clip_factor = 0.9
|
||||
|
||||
[pr_add_docs_prompt] # /add_docs #
|
||||
extra_instructions = ""
|
||||
docs_style = "Google Style" # "Google Style", "Numpy Style", "Sphinx Style", "PEP257", "reStructuredText"
|
||||
|
||||
[pr_update_changelog] # /update_changelog #
|
||||
push_changelog_changes=false
|
||||
|
@ -39,7 +39,7 @@ class PRAddDocs:
|
||||
"diff": "", # empty diff for initial calculation
|
||||
"extra_instructions": get_settings().pr_add_docs_prompt.extra_instructions,
|
||||
"commit_messages_str": self.git_provider.get_commit_messages(),
|
||||
'docs_for_language': get_docs_for_language(self.main_language),
|
||||
'docs_for_language': get_docs_for_language(self.main_language, get_settings().pr_add_docs_prompt.docs_style),
|
||||
}
|
||||
self.token_handler = TokenHandler(self.git_provider.pr,
|
||||
self.vars,
|
||||
@ -183,15 +183,15 @@ class PRAddDocs:
|
||||
return data
|
||||
|
||||
|
||||
def get_docs_for_language(language):
|
||||
def get_docs_for_language(language, style):
|
||||
language = language.lower()
|
||||
if language == 'java':
|
||||
return "javadocs"
|
||||
return "Javadocs"
|
||||
elif language in ['python', 'lisp', 'clojure']:
|
||||
return "docstrings"
|
||||
return f"Docstring ({style})"
|
||||
elif language in ['javascript', 'typescript']:
|
||||
return "jsdocs"
|
||||
return "JSdocs"
|
||||
elif language == 'c++':
|
||||
return "doxygen"
|
||||
return "Doxygen"
|
||||
else:
|
||||
return "docs"
|
||||
return "Docs"
|
||||
|
Reference in New Issue
Block a user