From cdb996515fc8dd0aa9b06d3fa2f7b418a2229531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 17 Apr 2025 13:32:47 +0100 Subject: [PATCH 1/5] add dartanalyzer on the pipeline docs and uv.lock as supported file --- .../supported-languages-and-tools.md | 2 +- .../local-analysis/running-dartanalyzer.md | 73 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 docs/repositories-configure/local-analysis/running-dartanalyzer.md diff --git a/docs/getting-started/supported-languages-and-tools.md b/docs/getting-started/supported-languages-and-tools.md index eeec38796b..c590742327 100644 --- a/docs/getting-started/supported-languages-and-tools.md +++ b/docs/getting-started/supported-languages-and-tools.md @@ -448,7 +448,7 @@ The table below lists all languages that Codacy supports and the corresponding t Prospector, Semgrep, Trivy - Trivy, scans
requirements.txt (pip),
Pipfile.lock (pipenv),
poetry.lock (Poetry) + Trivy, scans
requirements.txt (pip),
Pipfile.lock (pipenv),
poetry.lock (Poetry), uv.lock (UV) PMD CPD 10 Radon Lizard - diff --git a/docs/repositories-configure/local-analysis/running-dartanalyzer.md b/docs/repositories-configure/local-analysis/running-dartanalyzer.md new file mode 100644 index 0000000000..40f831d6ec --- /dev/null +++ b/docs/repositories-configure/local-analysis/running-dartanalyzer.md @@ -0,0 +1,73 @@ +--- +description: Instructions on how to run Dart Analyzer as a client-side tool on Codacy. +tool_name: Dart Analyzer +--- + +# Running Dart Analyzer + +To run Dart Analyzer as a [client-side tool](client-side-tools.md): + + + +{% + include "../../assets/includes/client-side-tool-instructions.md" + start="" + end="" +%} + +## Important Concepts + +- **`.codacy/codacy.yaml`**: Configuration file to specify `dart`, or `flutter`, and `dartanalyzer` versions for the CLI. + +```yaml +runtimes: + - dart@3.7.2 +tools: + - dartanalyzer@3.7.20 +``` +## Manual configuration + +```bash +codacy-cli install +codacy-cli analyze -t dartanalyzer -o dartanalyzer.sarif +codacy-cli upload -s dartanalyzer.sarif -c $COMMIT_SHA -t CODACY_PROJECT_TOKEN +``` + + **If you're using an account API token**, you must also provide the flags `-p`, `-o`, and `-r`. You can obtain the values for these flags from the URL of your repository dashboard on Codacy: + +```bash +codacy-cli install +codacy-cli analyze -t dartanalyzer -o dartanalyzer.sarif +codacy-cli analyze -t dartanalyzer -o dartanalyzer.sarif -c $COMMIT_SHA -a CODACY_API_TOKEN -p provider (gh|gl|bb) -o ORGANIZATION -r REPOSITORY +``` + +## GitHub Action + + +### Using a project token +```yml +- name: Run Codacy CLI + uses: codacy/codacy-cli-v2-action@main + with: + project-token: CODACY_PROJECT_TOKEN + tool: dartanalyzer + upload_report: true +``` + +### Using an account API token + +```yml +- name: Run Codacy CLI + uses: codacy/codacy-cli-v2-action@main + with: + api_token: CODACY_API_TOKEN + tool: dartanalyzer + upload_report: true + provider: gh + owner: codacy-acme + repository: sample-javascript-project +``` + +!!! warning "Tokens should be stored in the repository secrets." + From 683e0e4c5393a27c8aa32e137e3e766aede776c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 17 Apr 2025 13:50:23 +0100 Subject: [PATCH 2/5] include flutter example --- .../local-analysis/running-dartanalyzer.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/repositories-configure/local-analysis/running-dartanalyzer.md b/docs/repositories-configure/local-analysis/running-dartanalyzer.md index 40f831d6ec..49dcfdb9d8 100644 --- a/docs/repositories-configure/local-analysis/running-dartanalyzer.md +++ b/docs/repositories-configure/local-analysis/running-dartanalyzer.md @@ -26,6 +26,15 @@ runtimes: tools: - dartanalyzer@3.7.20 ``` + +or + +```yaml +runtimes: + - flutter@3.29.3 +tools: + - dartanalyzer@3.7.20 +``` ## Manual configuration ```bash @@ -66,7 +75,7 @@ codacy-cli analyze -t dartanalyzer -o dartanalyzer.sarif -c $COMMIT_SHA -a CODAC upload_report: true provider: gh owner: codacy-acme - repository: sample-javascript-project + repository: sample-dart-project ``` !!! warning "Tokens should be stored in the repository secrets." From 3e006b1654081e0d4bc6f1f9a65417e604579543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 17 Apr 2025 14:20:22 +0100 Subject: [PATCH 3/5] fix navigation --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index 380ef2d193..e2dbc3ce0e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -589,6 +589,7 @@ nav: - Local analysis: - repositories-configure/local-analysis/client-side-tools.md - repositories-configure/local-analysis/running-aligncheck.md + - repositories-configure/local-analysis/running-dartanalyzer.md - repositories-configure/local-analysis/running-deadcode.md - repositories-configure/local-analysis/running-spotbugs.md - repositories-configure/local-analysis/running-eslint.md From f1f20ac2d60ac2b02cf74a6c31832168a428b43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 17 Apr 2025 13:32:47 +0100 Subject: [PATCH 4/5] add dartanalyzer on the pipeline docs and uv.lock as supported file --- .../local-analysis/running-dartanalyzer.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/repositories-configure/local-analysis/running-dartanalyzer.md b/docs/repositories-configure/local-analysis/running-dartanalyzer.md index 49dcfdb9d8..3bec221e47 100644 --- a/docs/repositories-configure/local-analysis/running-dartanalyzer.md +++ b/docs/repositories-configure/local-analysis/running-dartanalyzer.md @@ -35,6 +35,7 @@ runtimes: tools: - dartanalyzer@3.7.20 ``` + ## Manual configuration ```bash @@ -75,7 +76,11 @@ codacy-cli analyze -t dartanalyzer -o dartanalyzer.sarif -c $COMMIT_SHA -a CODAC upload_report: true provider: gh owner: codacy-acme +<<<<<<< HEAD repository: sample-dart-project +======= + repository: sample-javascript-project +>>>>>>> cdb996515 (add dartanalyzer on the pipeline docs and uv.lock as supported file) ``` !!! warning "Tokens should be stored in the repository secrets." From ab2983b277254762c67cfd70cae08315da96dab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9lio=20Rocha?= Date: Thu, 17 Apr 2025 13:50:23 +0100 Subject: [PATCH 5/5] rebase --- .../local-analysis/running-dartanalyzer.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/repositories-configure/local-analysis/running-dartanalyzer.md b/docs/repositories-configure/local-analysis/running-dartanalyzer.md index 3bec221e47..4f229c830b 100644 --- a/docs/repositories-configure/local-analysis/running-dartanalyzer.md +++ b/docs/repositories-configure/local-analysis/running-dartanalyzer.md @@ -76,11 +76,7 @@ codacy-cli analyze -t dartanalyzer -o dartanalyzer.sarif -c $COMMIT_SHA -a CODAC upload_report: true provider: gh owner: codacy-acme -<<<<<<< HEAD repository: sample-dart-project -======= - repository: sample-javascript-project ->>>>>>> cdb996515 (add dartanalyzer on the pipeline docs and uv.lock as supported file) ``` !!! warning "Tokens should be stored in the repository secrets."