Skip to content

Commit

Permalink
[IMP] Add try-except on branch analyze action (OCA#26)
Browse files Browse the repository at this point in the history
* [IMP] Add try-except on branch analyze action

Add try-except statements on analyze actions that could
potentially crash the analyze process.

* [REF] Fix error logging

Changes include:
 - fix error values
 - use error instead of warning

* [IMP] Fix error in analyze call

Fix a programming mistake in the analyze call.
By @RoelAdriaans

* [IMP] Bump version number of github_connector

Bump the version number of github_connector to '11.0.1.1.1'.

* [IMP] Bump version number of github_connector

Bump the version number of github_connector_odoo to
'11.0.1.1.1'.
  • Loading branch information
StephanRozendaal authored and carolinafernandez-tecnativa committed Jan 8, 2024
1 parent a1f3228 commit a799ad2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion github_connector/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
'name': 'Github Connector',
'summary': 'Synchronize information from Github repositories',
'version': '11.0.1.1.0',
'version': '11.0.1.1.1',
'category': 'Connector',
'license': 'AGPL-3',
'author':
Expand Down
24 changes: 15 additions & 9 deletions github_connector/models/github_repository_branch.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,21 @@ def _analyze_code(self):
"Warning Folder %s not found: Analysis skipped." % path)
else:
_logger.info("Analyzing Source Code in %s ..." % path)
vals = branch.analyze_code_one(branch)
vals.update({
'last_analyze_date': datetime.today(),
'state': 'analyzed',
})
# Mark the branch as analyzed
branch.write(vals)
if partial_commit:
self._cr.commit() # pylint: disable=invalid-commit
try:
vals = branch.analyze_code_one(branch)
vals.update({
'last_analyze_date': datetime.today(),
'state': 'analyzed',
})
# Mark the branch as analyzed
branch.write(vals)
if partial_commit:
self._cr.commit() # pylint: disable=invalid-commit

except Exception as e:
_logger.warning(
'Cannot analyze branch %s so skipping it, error '
'is: %s' % (branch.name, e))
return True

# Compute Section
Expand Down

0 comments on commit a799ad2

Please sign in to comment.