Repository navigation
refactor: constructor injection, literal constants, and code cleanup across repository layer - #2082
Conversation
Address maintainability violations across GenericResourceRepositoryImpl, TestConformanceMetricRepositoryImpl and DailyStatisticRepositoryImpl Critical: - Extract duplicated literal value into named constant in TestConformanceMetricRepositoryImpl (S1192) - Extract duplicated literal dailyCount into named constant in DailyStatisticRepositoryImpl (S1192) Major: - Replace field injection with constructor injection across all three classes (S6813) - Remove unused private log field in GenericResourceRepositoryImpl (S1068) - Remove block of commented-out code in DailyStatisticRepositoryImpl (S125) - Replace string concatenation with format specifiers in log statements across 3 occurrences in DailyStatisticRepositoryImpl (S2629) Minor: - Replace deprecated MapReduceResults with aggregation pipeline equivalent in DailyStatisticRepositoryImpl (S1874) Signed-off-by: kishore08-07 <[email protected]>
…aintainability issues in repository impls Address maintainability violations across ImportJobRepositoryImpl and ServiceRepositoryImpl Critical: - Extract duplicated literal number into a named constant (S1192) Major: - Replace field injection with constructor injection in both classes (S6813) - Replace keySet() iteration with entrySet() to eliminate redundant map lookups across 4 occurrences (S2864) - Remove unused private log field in ImportJobRepositoryImpl (S1068) Minor: - Inline temporary variable results across 5 occurrences (S1488) - Replace explicit generic type with diamond operator (S2293) Signed-off-by: kishore08-07 <[email protected]>
lbroudoux
left a comment
There was a problem hiding this comment.
Looks good to me but I think some other files need to be removed if you refactored the mapredue to an aggregation. Also, can you explain how you checked it produces the same result and doesn't introduce any regression?
Address review feedback and S1874 in DailyStatisticRepositoryImpl Minor: - Replace deprecated MapReduceResults / MongoTemplate.mapReduce usage with aggregation pipeline (S1874) - Remove dead files MapReduce JS resources (mapDailyStatisticForADay.js, reduceDailyStatisticForADay.js) - Remove dead code MapReduce-only WrappedDailyStatistic wrapper class Tests: - Replace legacy exception test with assertions for daily/hourly aggregation and empty-day behavior Signed-off-by: kishore08-07 <[email protected]>
Yes, checked that aggregation is semantically identical with mapreduce and i validated its equivalence via:
|
|
Thanks @lbroudoux for your review and i have address the feedbacks, kindly re-review whenever you have time. |
lbroudoux
left a comment
There was a problem hiding this comment.
LGTM but need to restore the original import order before merging please.
- Reorder static imports in DailyStatisticRepositoryImpl for consistency - formatting cleanup in ExamplesExporter (inline lambda) Signed-off-by: kishore08-07 <[email protected]>
Description
This PR resolves maintainability issues flagged by SonarQube across five repository classes:
GenericResourceRepositoryImpl,TestConformanceMetricRepositoryImpl,DailyStatisticRepositoryImpl,ImportJobRepositoryImpl, andServiceRepositoryImpl.Critical
TestConformanceMetricRepositoryImpl,DailyStatisticRepositoryImpl,ImportJobRepositoryImpl, andServiceRepositoryImpl(S1192)Major
GenericResourceRepositoryImplandImportJobRepositoryImpl(S1068)DailyStatisticRepositoryImpl(S125)DailyStatisticRepositoryImpl(S2629)ImportJobRepositoryImplandServiceRepositoryImpl(S2864)Minor
DailyStatisticRepositoryImpl(S1874)ImportJobRepositoryImplandServiceRepositoryImpl(S1488)Related issue(s)
See also #2058