Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/pysonar_scanner/configuration/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
from pysonar_scanner.exceptions import UnexpectedCliArgument


class PyScannerHelpFormatter(argparse.HelpFormatter):
recommended_args = {"help", "token", "sonar_project_key"}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit It is minimal or mandatory args, not recommended args in my opinion

Suggested change
recommended_args = {"help", "token", "sonar_project_key"}
mandatory_args = {"help", "token", "sonar_project_key"}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Technically they are not mandatory, as I understand it will work for instance if them will be specified in toml file or env variable


def _format_actions_usage(self, actions, groups):
filtered_actions = [action for action in actions if action.dest in PyScannerHelpFormatter.recommended_args]
return super()._format_actions_usage(filtered_actions, groups)


class CliConfigurationLoader:

@classmethod
Expand Down Expand Up @@ -59,6 +67,7 @@ def __create_parser(cls):
parser = argparse.ArgumentParser(
description="Sonar scanner CLI for Python",
epilog="Analysis properties not listed here will also be accepted, as long as they start with the -D prefix.",
formatter_class=PyScannerHelpFormatter,
)

parser.add_argument(
Expand Down