@@ -116,27 +116,35 @@ See the __SonarScanner__ [documentation](https://docs.sonarsource.com/sonarqube/
116
116
## Prerequisites
117
117
118
118
- Python 3.12
119
- - [ Hatch ] ( https://hatch. pypa.io/latest/install/ )
119
+ - [ pipx ] ( https://github.com/ pypa/pipx )
120
120
121
- ## Install virtual env and create a new environment
121
+ ## Install poetry
122
122
123
- Run ` python3 -m pip install --user virtualenv `
124
-
125
- Then create a new env with ` python3 -m venv <name of your venv> `
126
-
127
- Activate the venv with ` source <name of your venv>/bin/activate `
123
+ Install poetry with ` pipx install poetry `
128
124
129
125
# Run the main script
130
126
131
- Run ` python3 main.py <args> `
127
+ Run ` python src/py_sonar_scanner `
132
128
133
129
# Run the tests
134
130
135
- Run ` hatch run test:test `
131
+ Run ` poetry install ` to install the dependencies
132
+
133
+ ## Run the tests only
134
+
135
+ Run ` poetry run pytest test/ `
136
+
137
+ ## Run the tests with coverage and results displayed in the terminal
138
+
139
+ Run ` poetry run pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov-branch tests `
140
+
141
+ ## Run the tests with coverage and store the result in an xml file
142
+
143
+ Run ` poetry run pytest --cov-report=xml:coverage.xml --cov-config=pyproject.toml --cov=src --cov-branch tests `
136
144
137
145
# Build the package
138
146
139
- Run ` hatch build` to create the package.
147
+ Run ` poetry build` to create the package.
140
148
The binaries will be located in the ` dist ` directory at the root level of the project.
141
149
142
150
# Publish the script
@@ -153,25 +161,28 @@ Also `dist/*` can be a bit more precise to upload a specific version of the bina
153
161
To update the version use the hatch command:
154
162
155
163
```
156
- hatch version "X.Y.Z"
164
+ poetry version "X.Y.Z"
157
165
```
158
166
For more options on the version update see [ the hatch documentation] ( https://hatch.pypa.io/latest/version/ )
159
167
160
168
# Tooling
161
169
## Formatting
162
170
163
- Run ` hatch run tool:format ` to run the check the formatting on all files.
164
- To automatically apply formatting, run ` hatch run tool:apply_format ` .
171
+ Run ` poetry run black src/ tests/ --check ` to run the check the formatting on all files.
172
+ To automatically apply formatting, run ` poetry run black src/ tests/ ` .
165
173
166
174
## Type checking
167
175
168
- Run ` hatch run tool:type_check ` to execute the type checking on all files.
176
+ Run ` poetry run mypy src/ tests/ --ignore-missing-imports ` to execute the type checking on all files.
169
177
170
178
## License header
171
179
172
180
Before pushing, please check if all files have a license header.
173
- If not all files have a license header please execute: ` hatch run tool:license ` .
174
-
181
+ If not all files have a license header please execute:
182
+ ```
183
+ poetry run licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2023 -n "Sonar Scanner Python" -E .py -d src/
184
+ poetry run licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2023 -n "Sonar Scanner Python" -E .py -d tests/
185
+ ```
175
186
176
187
# License
177
188
0 commit comments