diff --git a/CLI_ARGS.md b/CLI_ARGS.md index 20285aff..baf7a6b0 100644 --- a/CLI_ARGS.md +++ b/CLI_ARGS.md @@ -15,7 +15,7 @@ | ------ | ----------- | | `--sonar-project-base-dir`, `-Dsonar.projectBaseDir` | Directory containing the project to be analyzed. Default is the current directory | | `--sonar-project-description`, `-Dsonar.projectDescription` | Description of the project | -| `--sonar-project-key`, `-Dsonar.projectKey` | Key of the project that usually corresponds to the project name in SonarQube | +| `--sonar-project-key`, `--project-key`, `-Dsonar.projectKey` | Key of the project that usually corresponds to the project name in SonarQube | | `--sonar-project-name`, `-Dsonar.projectName` | Name of the project in SonarQube | | `--sonar-project-version`, `-Dsonar.projectVersion` | Version of the project | | `--sonar-sources`, `-Dsonar.sources` | The analysis scope for main source code (non-test code) in the project | diff --git a/src/pysonar_scanner/configuration/cli.py b/src/pysonar_scanner/configuration/cli.py index 70d5d7e0..1aa50a90 100644 --- a/src/pysonar_scanner/configuration/cli.py +++ b/src/pysonar_scanner/configuration/cli.py @@ -71,6 +71,7 @@ def __create_parser(cls): ) parser.add_argument( "--sonar-project-key", + "--project-key", "-Dsonar.projectKey", type=str, help="Key of the project that usually corresponds to the project name in SonarQube", diff --git a/tests/unit/test_configuration_cli.py b/tests/unit/test_configuration_cli.py index 748d821a..96e5c8ee 100644 --- a/tests/unit/test_configuration_cli.py +++ b/tests/unit/test_configuration_cli.py @@ -181,7 +181,7 @@ def test_minimal_cli_args(self): def test_alternative_cli_args(self): alternatives = [ - ["-t", "myToken", "-v", "--sonar-project-key", "myProjectKey"], + ["-t", "myToken", "-v", "--project-key", "myProjectKey"], ["--sonar-token", "myToken", "--sonar-verbose", "--sonar-project-key", "myProjectKey"], ] for alternative in alternatives: