Skip to content

Conversation

@Mathieu-Deharbe
Copy link
Contributor

In the global filters :
Separates voltage level and substation generic filters from the others. (they are now a category in itself)

Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Signed-off-by: Mathieu DEHARBE <[email protected]>
Map<EquipmentType, List<String>> result = new EnumMap<>(EquipmentType.class);

List<AbstractFilter> genericFilters = null;
List<AbstractFilter> genericFilters = List.of();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List<AbstractFilter> genericFilters = List.of();
List<AbstractFilter> genericFilters = new ArrayList<>();

is it better ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed here : e344a08

genericFilters = filterLoader.getFilters(globalFilter.getGenericFilter());
}

List<AbstractFilter> substationOrVoltageLevelFilters = List.of();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed here : e344a08

*/
public static boolean shouldProcessEquipmentType(@Nonnull final EquipmentType equipmentType,
@Nonnull final List<AbstractFilter>genericFilters) {
@Nonnull final List<AbstractFilter> genericFilters) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange sonar did not see that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.

Comment on lines +355 to +362
final List<String> filteredIds = applyGlobalFilterOnNetwork(
network,
globalFilter,
equipmentType,
genericFilters,
substationOrVoltageLevelFilters,
filterLoader
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small refactoring suggestion : dont send globalFilter but only what we need, because we have genericFilters and substationOrVoltageLevelFilters accessibles from two different ways after

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this is not a good thing to have data accessibles from two different ways. This was discussed last month and the genericFilters "cache" was kept.

Your idea sounds good but globalFilter contains a lot of things and most are used later in :

public static ExpertFilter buildExpertFilter(@Nonnull final GlobalFilter globalFilter,
                                                 @Nonnull final EquipmentType equipmentType,
                                                 @Nonnull final List<AbstractFilter> genericFilters,
                                                 @Nonnull final List<AbstractFilter> substationOrVoltageLevelFilters) {

So we would end with a lot of function parameters which is not much better in my opinion.

Copy link
Contributor

@flomillot flomillot Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think only the other filters are used later. You add 3 params, remove 1. So 2 more params. Definetely worth it IMO, comparing to the fact of having the variable name duplicated and containing two different things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But well if you already discussed about it, then I guess it's already chosen

Signed-off-by: Mathieu DEHARBE <[email protected]>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 7, 2026

@Mathieu-Deharbe Mathieu-Deharbe merged commit 62812e8 into main Jan 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants