Skip to content

Commit 84d875d

Browse files
authored
PYSCAN-35: Decide for a package name and a CLI command name (#39)
1 parent 873d5fb commit 84d875d

16 files changed

+63
-64
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
# sonar-scanner-python
1+
# pysonar
22
A wrapper around SonarScanner CLI, available on PyPI.
33

44
# Installation
55

66
Install with pip:
77
```
8-
pip install sonar-scanner-python FIXME -- The actual package name is not yet defined. Refer to PYSCAN-35
8+
pip install pysonar
99
```
1010

1111
# Usage
1212

13-
Once installed, the `sonar-scanner-python` can be run from the command line to perform an analysis.
13+
Once installed, the `pysonar` can be run from the command line to perform an analysis.
1414
It assumes a running SonarQube server or a project configured on SonarCloud.
1515

1616
## Setting up analysis properties
1717

1818
In order for the analysis to run, analysis properties need to be defined.
1919
There are multiple ways of providing these properties, described below in descending order of priority:
2020

21-
* Through CLI arguments to the `sonar-scanner-python` command
21+
* Through CLI arguments to the `pysonar` command
2222
* Under the `[tool.sonar]` key of the `pyproject.toml` file
2323
* Through common properties extracted from the `pyproject.toml`
2424
* In a dedicated `sonar-project.properties` file
2525
* Through environment variables
2626

2727
### Through CLI arguments
2828

29-
Analysis properties can be provided as CLI arguments to the `sonar-scanner-python` command.
29+
Analysis properties can be provided as CLI arguments to the `pysonar` command.
3030
They follow the same convention as when running the SonarScanner CLI directly
3131
(see [documentation](https://docs.sonarsource.com/sonarqube/9.9/analyzing-source-code/scanners/sonarscanner/#running-from-zip-file)).
3232
This means that analysis properties provided that way should be prepended with `-D`, for instance:
3333

3434
```
35-
$ sonar-scanner-python -Dsonar.login=myAuthenticationToken FIXME -- The actual command name is not yet defined. Refer to PYSCAN-35
35+
$ pysonar -Dsonar.login=myAuthenticationToken
3636
```
3737

3838
You can use all the argument allowed by __SonarScanner__.
@@ -69,13 +69,13 @@ By default, the scanner will expect the `pyproject.toml` file to be present in t
6969
However, its path can be provided manually through the `toml.path` ([PYSCAN-40](https://sonarsource.atlassian.net/jira/software/c/projects/PYSCAN/issues/PYSCAN-40)) CLI argument as well as through the `sonar.projectHome` argument. For instance:
7070

7171
```
72-
sonar-scanner-python -Dtoml.path="path/to/pyproject.toml"
72+
pysonar -Dtoml.path="path/to/pyproject.toml"
7373
```
7474

7575
Or:
7676

7777
```
78-
sonar-scanner-python -Dsonar.projectHome="path/to/projectHome"
78+
pysonar -Dsonar.projectHome="path/to/projectHome"
7979
```
8080

8181

@@ -117,7 +117,7 @@ It is also possible to define configure the scanner through environment variable
117117

118118
```
119119
$ export SONAR_HOST_URL="http://localhost:9000"
120-
$ sonar-scanner-python FIXME -- The actual command name is not yet defined. Refer to PYSCAN-35
120+
$ pysonar
121121
```
122122

123123
See the __SonarScanner__ [documentation](https://docs.sonarsource.com/sonarqube/9.9/analyzing-source-code/scanners/sonarscanner/) for more information.
@@ -135,7 +135,7 @@ Install poetry with `pipx install poetry`
135135

136136
# Run the main script
137137

138-
Run `python src/py_sonar_scanner`
138+
Run `python src/pysonar`
139139

140140
# Run the tests
141141

its/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
# PYSCAN-35: Decide on definitive package name
7-
name = "py-sonar-scanner-its"
7+
name = "pysonar-its"
88
version = "0.0.1"
99
authors = [
1010
"Guillaume Dequenne <[email protected]>",
@@ -45,7 +45,7 @@ black = ">=23.12.0"
4545
pytest = ">=7.4.3"
4646
pytest-docker = ">=2.0.1"
4747
requests = "2.31.0"
48-
py-sonar-scanner = { "path" = "../" }
48+
pysonar = { "path" = "../" }
4949

5050
[[tool.poetry.source]]
5151
name = "repox"

its/utils/cli_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
class CliClient():
2727

28-
SCANNER_CMD: str = "py-sonar-scanner"
28+
SCANNER_CMD: str = "pysonar"
2929
SOURCES_FOLDER_PATH: str = os.path.join(
3030
os.path.dirname(__file__), "../sources")
3131

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ requires = ["poetry-core"]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
# PYSCAN-35: Decide on definitive package name
7-
name = "py-sonar-scanner"
6+
name = "pysonar"
87
version = "0.0.6"
98
authors = [
109
"Guillaume Dequenne <[email protected]>",
@@ -35,7 +34,7 @@ classifiers = [
3534
"Programming Language :: Python :: 3.12",
3635
"Topic :: Software Development :: Quality Assurance",
3736
]
38-
packages = [{ include = "py_sonar_scanner", from = "src" }]
37+
packages = [{ include = "pysonar", from = "src" }]
3938

4039
[tool.poetry.dependencies]
4140
python = ">=3.8"
@@ -57,7 +56,7 @@ Homepage = "https://github.com/SonarSource/sonar-scanner-python"
5756
Repository = "https://github.com/SonarSource/sonar-scanner-python"
5857

5958
[tool.poetry.scripts]
60-
"py-sonar-scanner" = "py_sonar_scanner.__main__:scan"
59+
"pysonar" = "pysonar.__main__:scan"
6160

6261
[tool.poetry.group.dev.dependencies]
6362
coverage = ">=7.3.3"
File renamed without changes.

src/py_sonar_scanner/__main__.py renamed to src/pysonar/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
# along with this program; if not, write to the Free Software Foundation,
1818
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
#
20-
from py_sonar_scanner.configuration import Configuration
21-
from py_sonar_scanner.environment import Environment
22-
from py_sonar_scanner.logger import ApplicationLogger
20+
from pysonar.configuration import Configuration
21+
from pysonar.environment import Environment
22+
from pysonar.logger import ApplicationLogger
2323

2424

2525
def scan():

src/py_sonar_scanner/configuration.py renamed to src/pysonar/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
import toml
2929

30-
from py_sonar_scanner.logger import ApplicationLogger
30+
from pysonar.logger import ApplicationLogger
3131

3232

3333
class Configuration:

src/py_sonar_scanner/environment.py renamed to src/pysonar/environment.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import urllib.request
2626
from urllib.error import HTTPError
2727

28-
from py_sonar_scanner.logger import ApplicationLogger
29-
from py_sonar_scanner.configuration import Configuration
30-
from py_sonar_scanner.utils.binaries_utils import write_binaries, unzip_binaries
31-
from py_sonar_scanner.scanner import Scanner
28+
from pysonar.logger import ApplicationLogger
29+
from pysonar.configuration import Configuration
30+
from pysonar.utils.binaries_utils import write_binaries, unzip_binaries
31+
from pysonar.scanner import Scanner
3232

3333
systems = {"Darwin": "macosx", "Windows": "windows"}
3434

File renamed without changes.

src/py_sonar_scanner/scanner.py renamed to src/pysonar/scanner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
from threading import Thread
2323
from subprocess import Popen, PIPE
2424

25-
from py_sonar_scanner.logger import ApplicationLogger
26-
from py_sonar_scanner.configuration import Configuration
25+
from pysonar.logger import ApplicationLogger
26+
from pysonar.configuration import Configuration
2727

2828

2929
class Scanner:

0 commit comments

Comments
 (0)