Skip to content

Commit 0ff4860

Browse files
committed
Excludes current flavor from suggestions
Prevents the current image flavor from being suggested as an alternative flavor when generating flavor suggestions. This avoids redundancy and ensures that users are not prompted to switch to the flavor they are already using.
1 parent de7d728 commit 0ff4860

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

megalinter/flavor_factory.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,18 @@ def get_megalinter_flavor_suggestions(active_linters):
135135
matching_flavors = []
136136
for flavor_id, flavor_info in all_flavors.items():
137137
match = True
138+
# Exclude current flavor
139+
if flavor_id == get_image_flavor():
140+
continue
141+
# Check if all active linters are in flavor linters
138142
for active_linter in active_linters:
139143
if (
140144
active_linter.name not in flavor_info["linters"]
141145
and active_linter.ignore_for_flavor_suggestions is False
142146
):
143147
match = False
144148
break
149+
# If match, add to matching flavors
145150
if match is True:
146151
matching_flavor = {
147152
"flavor": flavor_id,

0 commit comments

Comments
 (0)