QTZPOC-20
QTZPOC-20: Remove redundant NOSONAR comments across multiple files.
This commit is contained in:
@@ -25,7 +25,7 @@ def build_mlflow_config() -> dict[str, Any]:
|
||||
'host': getenv('MLFLOW_HOST', 'http://localhost'),
|
||||
'port': int(getenv('MLFLOW_PORT', '5080')),
|
||||
'username': getenv('MLFLOW_USERNAME', 'aignosi'),
|
||||
'password': getenv('MLFLOW_PASSWORD', 'aignosi'), # NOSONAR
|
||||
'password': getenv('MLFLOW_PASSWORD', 'aignosi'),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ def summarize_failure(
|
||||
"""
|
||||
if exception is not None:
|
||||
cause = _root_cause(exception)
|
||||
return _type_name(cause), _one_line(str(cause)) # NOSONAR
|
||||
return _type_name(cause), _one_line(str(cause))
|
||||
return error_type or _UNKNOWN_ERROR_TYPE, _one_line(detail_text or '')
|
||||
|
||||
|
||||
@@ -361,8 +361,8 @@ def describe_failure_chain(exception: BaseException) -> tuple[str, str]:
|
||||
"""
|
||||
links: list[str] = []
|
||||
for candidate in walk_cause_chain(exception):
|
||||
kind = _type_name(candidate) # NOSONAR
|
||||
message = _one_line(str(candidate)) # NOSONAR
|
||||
kind = _type_name(candidate)
|
||||
message = _one_line(str(candidate))
|
||||
# `ApplicationError.__str__` already prefixes its own type, and `MlflowException:
|
||||
# MlflowException: …` reads like two failures rather than one.
|
||||
if not message:
|
||||
@@ -422,7 +422,7 @@ def failure_location(exception: BaseException | None) -> tuple[str | None, int |
|
||||
if exception is None:
|
||||
return None, None
|
||||
for candidate in walk_cause_chain(exception):
|
||||
details = getattr(candidate, 'details', None) # NOSONAR
|
||||
details = getattr(candidate, 'details', None)
|
||||
if details and isinstance(details[0], dict) and 'step' in details[0]:
|
||||
location = details[0]
|
||||
gate = location.get('gate')
|
||||
|
||||
@@ -1150,7 +1150,7 @@ class MLFlowRepository(SientiaMonitoring):
|
||||
prediction_data.index = input_index
|
||||
|
||||
# Merge prediction data with retrain_dataset on index
|
||||
prediction_data = pd.merge( # NOSONAR
|
||||
prediction_data = pd.merge(
|
||||
retrain_dataset, prediction_data, left_index=True, right_index=True, how='left'
|
||||
)
|
||||
|
||||
@@ -1275,7 +1275,7 @@ class MLFlowRepository(SientiaMonitoring):
|
||||
# Aligns data with treated data indexes to get target variable
|
||||
aligned_data = data.loc[treated_data.index]
|
||||
aligned_series = aligned_data[target_name]
|
||||
retrain_dataset = pd.merge( # NOSONAR
|
||||
retrain_dataset = pd.merge(
|
||||
treated_data, aligned_series, left_index=True, right_index=True
|
||||
)
|
||||
else:
|
||||
|
||||
@@ -79,7 +79,7 @@ def _opc_authentication_token_str(client: Client | None) -> str:
|
||||
if tok is None:
|
||||
return 'unknown'
|
||||
return str(tok)
|
||||
except Exception: # NOSONAR - best-effort label for logs/metrics, must not fail loud
|
||||
except Exception: # best-effort label for logs/metrics, must not fail loud
|
||||
return 'unknown'
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ def _opc_status_from_exception(exc: BaseException) -> str:
|
||||
str: Status class name or generic Python exception name.
|
||||
"""
|
||||
for candidate in walk_cause_chain(exc):
|
||||
if isinstance(candidate, UaStatusCodeError): # NOSONAR
|
||||
return type(candidate).__name__ # NOSONAR
|
||||
if isinstance(candidate, UaStatusCodeError):
|
||||
return type(candidate).__name__
|
||||
return type(exc).__name__
|
||||
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ async def main():
|
||||
# This will run the workers and wait for them to complete.
|
||||
# If an exception occurs in any of the worker handlers, it will be propagated here.
|
||||
await asyncio.gather(*handlers)
|
||||
except BaseException as e: # NOSONAR
|
||||
except BaseException as e:
|
||||
logger.custom_error(f'An unhandled exception occurred: {e}', metadata)
|
||||
exit_code = 1
|
||||
finally:
|
||||
|
||||
@@ -227,7 +227,7 @@ class ImportModel:
|
||||
'version': version['version'],
|
||||
'document_id': document.get('id'),
|
||||
}
|
||||
except BaseException as error: # NOSONAR - classified once below, then re-raised untouched
|
||||
except BaseException as error: # classified once below, then re-raised untouched
|
||||
located_step, located_gate = failure_location(error)
|
||||
step = located_step or step
|
||||
gate = located_gate
|
||||
@@ -309,7 +309,7 @@ class ImportModel:
|
||||
retry_policy=IMPORT_STATUS_HINT_RETRY_POLICY,
|
||||
start_to_close_timeout=STATUS_WRITE_TIMEOUT,
|
||||
)
|
||||
except BaseException as error: # NOSONAR - a lost hint must not fail a working import
|
||||
except BaseException as error: # a lost hint must not fail a working import
|
||||
if is_cancelled_exception(error):
|
||||
raise
|
||||
await self._report_status_write_failure(base, error)
|
||||
@@ -346,7 +346,7 @@ class ImportModel:
|
||||
)
|
||||
except (
|
||||
BaseException
|
||||
) as error: # NOSONAR - the outcome stands even when it cannot be written
|
||||
) as error: # the outcome stands even when it cannot be written
|
||||
if is_cancelled_exception(error):
|
||||
raise
|
||||
await self._report_status_write_failure(
|
||||
@@ -382,7 +382,7 @@ class ImportModel:
|
||||
retry_policy=IMPORT_STATUS_HINT_RETRY_POLICY,
|
||||
start_to_close_timeout=STATUS_WRITE_TIMEOUT,
|
||||
)
|
||||
except BaseException as error: # NOSONAR - the report of a report is where this stops
|
||||
except BaseException as error: # the report of a report is where this stops
|
||||
if is_cancelled_exception(error):
|
||||
raise
|
||||
|
||||
@@ -400,7 +400,7 @@ class ImportModel:
|
||||
retry_policy=retry_policy,
|
||||
start_to_close_timeout=STATUS_WRITE_TIMEOUT,
|
||||
)
|
||||
except BaseException as error: # NOSONAR - the report of a report is where this stops
|
||||
except BaseException as error: # the report of a report is where this stops
|
||||
if is_cancelled_exception(error):
|
||||
raise
|
||||
# Deliberately silent otherwise: the channel this was trying to reach is the thing that
|
||||
@@ -426,7 +426,7 @@ class ImportModel:
|
||||
retry_policy=retry_policy,
|
||||
start_to_close_timeout=RETENTION_TIMEOUT,
|
||||
)
|
||||
except BaseException as error: # NOSONAR - retention is not a precondition of an import
|
||||
except BaseException as error: # retention is not a precondition of an import
|
||||
if is_cancelled_exception(error):
|
||||
raise
|
||||
# Dropped, not reported otherwise: the activity's own failure is already in the event
|
||||
@@ -446,7 +446,7 @@ class ImportModel:
|
||||
)
|
||||
except (
|
||||
BaseException
|
||||
) as error: # NOSONAR - cleanup never replaces the failure that brought us here
|
||||
) as error: # cleanup never replaces the failure that brought us here
|
||||
if is_cancelled_exception(error):
|
||||
raise
|
||||
return {'cleaned': False}
|
||||
|
||||
Reference in New Issue
Block a user