Task/rdmp 365 better load metadata logging#2323
Conversation
| } | ||
| } | ||
| var missingTasks = catalogues.Where(c => c.LoggingDataTasks.Count() ==0).ToArray(); | ||
| var potentialTasks = catalogues.Except(missingTasks).SelectMany(c => c.LoggingDataTasks).Distinct().ToArray(); |
Check warning
Code scanning / CodeQL
Useless assignment to local variable Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 3 months ago
In general, to fix a “useless assignment to local variable” you either (1) remove the unused variable and its assignment if the computed value is not needed, or (2) start using the variable in place of recomputing the same value elsewhere. Here, the variable potentialTasks is assigned but never read, and the right-hand side is a pure LINQ expression without side effects, so the simplest non‑functional change is to remove the declaration/assignment entirely.
Concretely, in MetadataLoggingConfigurationChecks.Check within Rdmp.Core/DataLoad/Engine/Checks/Checkers/MetadataLoggingConfigurationChecks.cs, in the #region Fix missing LoggingDataTask block, leave the missingTasks line intact and delete the line that declares and initializes potentialTasks. No other code changes or imports are required, since potentialTasks is not referenced anywhere else in the shown snippet. This preserves existing behavior while eliminating the dead assignment and the associated CodeQL warning.
| @@ -64,7 +64,6 @@ | ||
| #region Fix missing LoggingDataTask | ||
|
|
||
| var missingTasks = catalogues.Where(c => c.LoggingDataTasks.Count() ==0).ToArray(); | ||
| var potentialTasks = catalogues.Except(missingTasks).SelectMany(c => c.LoggingDataTasks).Distinct().ToArray(); | ||
|
|
||
| #endregion | ||
|
|
Proposed Change
Catalogues can currently only be associated with a single load metadata.
This is a bit weird, as multiple data loads can populate a catalogue.
This change migrates away from this 1-1 model to a many-to-many model.
Each load metadata -> catalogue linkage will have a name (default "Loading ()"
with multiple linkages being able to have the same name
This means that we will be able to now identify logs for each catalogue based on the linkage to a loadmetadata rather than just by catalogue.
This will solve the issue where LMD2 logs were showing up in LMD1 due to both LMD1 and LMD2 importing data into a single catalogue
Type of change
What types of changes does your code introduce? Tick all that apply.
Checklist
By opening this PR, I confirm that I have: