SCANPY-156 Expand documentation for the pysonar-scanner#186
Conversation
da8768f to
2015180
Compare
b148d21 to
bd673ea
Compare
b4dae8f to
a7df32a
Compare
Seppli11
left a comment
There was a problem hiding this comment.
Overall, this looks really good.
I really like the approach with the CLI_ARGS.md since it guarantees that it is always up to date.
I've left a few comments. Some personal preferences and remarks, others corrections.
|
|
||
| - SonarQube v9.9 or higher | ||
| - SonarQube v10.6 or above | ||
| - Python 3.8 or above |
There was a problem hiding this comment.
We require python 3.9
| - Python 3.8 or above | |
| - Python 3.9 or above |
| When a `pyproject.toml` file is available, it is possible to set the `-read-project-config` flag | ||
| to allow the scanner to deduce analysis properties from the project configuration. | ||
| ``` | ||
| pysonar --sonar-projectBaseDir "path/to/projectBaseDir" |
There was a problem hiding this comment.
I think you meant -Dsonar.projectBaseDir here, since --sonar-projectBaseDir doesn't exist.
| pysonar --sonar-projectBaseDir "path/to/projectBaseDir" | |
| pysonar -Dsonar.projectBaseDir="path/to/projectBaseDir" |
| - poetry run licenseheaders -t license_header.tmpl -o "SonarSource SA" -y 2011-2024 -n "Sonar Scanner Python" -E .py -d tests/ | ||
| - git diff --name-only --exit-code ./src ./tests | ||
|
|
||
| documentation_task: |
| Analysis properties can be provided as CLI arguments to the `pysonar` command. | ||
| They follow the same convention as when running the SonarScanner CLI directly | ||
| (see [documentation](https://docs.sonarsource.com/sonarqube/9.9/analyzing-source-code/scanners/sonarscanner/#running-from-zip-file)). | ||
| They can be provided in a similar way as when running the SonarScanner CLI directly |
There was a problem hiding this comment.
Personally, I would have formulated this the other way around. E.g. use --token and --sonar-region by default. If the argument is not available, -D... works for everything, but we don't verify and blindly forward it
There was a problem hiding this comment.
I intentionally framed it that way so that the first information is the one that will definitely work, then only later we provide a way to make it less verbose for specific properties.
I feel that reduces the risk of mistakes if someone only skims the documentation. Does it make sense?
|
|
||
| # Group arguments by category | ||
| categories = { | ||
| "Authentication": ["token", "sonar_host_url", "sonar_region"], |
There was a problem hiding this comment.
we probably should also add sonar_organization here (depending if #188 is merged first)
There was a problem hiding this comment.
The result looks good!
| 1. Through CLI arguments to the `pysonar` command | ||
| 2. Environment variables for individual properties (e.g. `SONAR_TOKEN`, `SONAR_VERBOSE`, `SONAR_HOST_URL`, ...) | ||
| 3. Generic environment variable `SONAR_SCANNER_JSON_PARAMS` | ||
| 4. Under the `[tool.sonar]` key of the `pyproject.toml` file | ||
| 5. In a dedicated `sonar-project.properties` file | ||
| 6. Through common properties extracted from the `pyproject.toml` |
|
|
||
| You can use all the argument allowed by __SonarScanner__. | ||
| For more information on __SonarScanner__ please refer to the [SonarScanner documentation](https://docs.sonarsource.com/sonarqube/9.9/analyzing-source-code/scanners/sonarscanner/) | ||
| You can use all the arguments allowed by __SonarScanner__. |
There was a problem hiding this comment.
It could be worth it to mention that we support also Python specific properties like sonar.python.version
There was a problem hiding this comment.
I'm tempted to think it's implied, since CLI_ARGS.md mentions them explicitly.
We could keep a list of Python specific properties documented separately though, but I feel it might be overkill at this point?
| "flake8_report_paths", | ||
| "ruff_report_paths", | ||
| ], | ||
| "Other": [], # Will contain everything else |
There was a problem hiding this comment.
I'd like to see a Python specific section with :
--sonar-cpd-python-minimum-lines
--sonar-cpd-python-minimum-tokens
--sonar-python-skip-unchanged
--toml-path
--sonar-python-skip-unchanged
--sonar-python-xunit-skip-details
--sonar-python-version
There was a problem hiding this comment.
As discussed, it probably make sense to have amore granular split of the "Other" category, but I'm not sure doing it through Python-exclusive section makes sense for the end user (they probably care more about what the property achieve rather than the fact it's specific to the Python analyzer). As a baby step, let's keep it like this and revisit later.
a7df32a to
335ac21
Compare
|
thomas-serre-sonarsource
left a comment
There was a problem hiding this comment.
I like the idea !
I left a few subjective comments :)
Seppli11
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the quick changes




SCANPY-156