-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Develop temp #469
Develop temp #469
Changes from all commits
c82a947
4ee3569
339547a
1e99e80
a227500
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: DEVELOPER ASSISTANT | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
issue_comment: | ||
|
||
jobs: | ||
pr_agent_job: | ||
if: ((contains(github.event.comment.body, '/review') || | ||
contains(github.event.comment.body, '/describe')) && github.event.comment.user.login != 'nex-maximus') || | ||
github.event_name == 'pull_request' && github.event.pull_request.user.login != 'nex-maximus' | ||
runs-on: [self-hosted, genai_copilot-code-review] | ||
steps: | ||
- name: PR Agent action step | ||
id: pragent | ||
run: | | ||
cd ../../../genai_pr_agent | ||
chmod +x ./get_pr_agent_details.sh | ||
./get_pr_agent_details.sh | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
GITHUB_ACTION.AUTO_REVIEW: true | ||
GITHUB_ACTION.AUTO_DESCRIBE: true |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,8 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
def reset_files(filepath, file_type="txt"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
with open(filepath, "w") as output_file: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add error handling for file operations to catch and log exceptions such as |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if file_type == "txt": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor the function to use a dictionary mapping file types to their respective reset values for scalability and cleaner code. [medium] |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output_file.write("") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
elif file_type == "json": | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
output_file.write(json.dumps({})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
log.error("ERROR: Invalid file type") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using a more robust logging mechanism instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a return statement or raise an exception after logging the error to prevent the function from silently failing. [important]
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Import the 'json' module to ensure that 'json.dumps({})' works. Without this import, the code will raise a 'NameError' when 'file_type' is 'json'. [bug]
Suggested change
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Define the 'log' object or replace 'log.error' with 'print' to standard output or raise an exception to avoid 'NameError' when an invalid 'file_type' is provided. [bug]
Suggested change
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Handle potential exceptions that can be raised during file operations, such as 'FileNotFoundError' or 'PermissionError', to make the code more robust. [enhancement]
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import the
json
module at the beginning of the file to ensure thatjson.dumps
can be used within thereset_files
function. [important]