Skip to content

Commit 3070e68

Browse files
committed
Improves custom flavor suggestion
Replaces the flavor suggestion system with a custom flavor suggestion, which directs users to the documentation for creating a custom flavor based on their active linters. This approach streamlines the process and encourages users to tailor their MegaLinter setup for optimal performance.
1 parent 70fd0de commit 3070e68

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

megalinter/reporters/ConsoleReporter.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,25 +120,20 @@ def produce_report(self):
120120
logging.info(table_line)
121121
logging.info("")
122122
if self.master.flavor_suggestions is not None:
123-
if self.master.flavor_suggestions[0] == "new":
124-
logging.warning(
125-
"[flavors] You could have same capabilities but better runtime performances"
126-
" if you request a new MegaLinter flavor."
127-
)
128-
linters_list_formatted = ", ".join(self.master.flavor_suggestions[1])
129-
body = (
130-
"MegaLinter would run faster on my project if I had a flavor containing the following "
131-
f"list of linters:\n\n{linters_list_formatted}\n\n"
132-
"Would it be possible to create one ? Thanks :relaxed:"
133-
)
134-
new_flavor_url = (
135-
f"{self.issues_root}/new?assignees=&labels=enhancement&template=feature_request.md"
136-
f"&title={urllib.parse.quote('Request new MegaLinter flavor')}"
137-
f"&body={urllib.parse.quote(body)}"
138-
)
139-
logging.warning(
140-
f"[flavors] Use the following link to request the new flavor: {new_flavor_url}"
141-
)
123+
active_linter_names = [linter.name for linter in self.master.active_linters]
124+
custom_flavor_command = (
125+
"npx mega-linter-runner --custom-flavor-setup --custom-flavor-linters "
126+
+ ",".join(active_linter_names)
127+
)
128+
custom_flavor_message = (
129+
"Your project could benefit from a custom flavor, "
130+
"which would allow you to run only the linters you need, and thus improve runtime performances.\n\n"
131+
"To create your custom flavor, follow the related documentation and commands: \n"
132+
f"- Documentation: {ML_DOC_URL}/custom-flavors/\n"
133+
f"- Command: `{custom_flavor_command}`"
134+
)
135+
if len(self.master.flavor_suggestions) == 1:
136+
logging.warning(custom_flavor_message)
142137
else:
143138
build_version = config.get(None, "BUILD_VERSION", DEFAULT_RELEASE)
144139
action_version = (
@@ -161,4 +156,5 @@ def produce_report(self):
161156
f"{self.gh_url}/flavors/{suggestion['flavor']}/"
162157
)
163158
logging.warning(flavor_msg)
159+
logging.warning(custom_flavor_message)
164160
logging.info("")

0 commit comments

Comments
 (0)