Skip to content

Commit

Permalink
Audit: Add dubug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jun 14, 2024
1 parent 19ee6a1 commit b6b2dc5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions github_app_geo_project/module/audit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ async def _npm_audit_fix(
for package_lock_file_name, file_messages in fixable_files_npm.items():
directory = os.path.dirname(os.path.abspath(package_lock_file_name))
messages.update(file_messages)
_LOGGER.debug("Fixing vulnerabilities in %s with npm audit fix --force", package_lock_file_name)
command = ["npm", "audit", "fix", "--force"]
_, success = await _run_timeout(
command,
Expand All @@ -499,6 +500,7 @@ async def _npm_audit_fix(
result,
directory,
)
_LOGGER.debug("Fixing version in %s", package_lock_file_name)
# Remove the add '~' in the version in the package.json
with open(os.path.join(directory, "package.json"), encoding="utf-8") as package_file:
package_json = json.load(package_file)
Expand All @@ -508,6 +510,7 @@ async def _npm_audit_fix(
package_json[dependencies_type][package] = version[1:]
with open(os.path.join(directory, "package.json"), "w", encoding="utf-8") as package_file:
json.dump(package_json, package_file, indent=2)
_LOGGER.debug("Succeeded fix %s", package_lock_file_name)

fix_success &= success
return "\n".join(messages), fix_success
Expand Down

0 comments on commit b6b2dc5

Please sign in to comment.