From 0b8624d287bc292b91160249d8dcad8159cfb12a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Cort=C3=AAs?= Date: Thu, 16 Apr 2020 20:18:28 +0100 Subject: [PATCH 1/4] mkdocs? --- .circleci/config.yml | 21 ++- .gitignore | 1 + README.md | 177 +----------------- .../authenticating-using-account-token.md | 17 ++ .../installation-methods.md} | 21 ++- docs/advanced/multiple-reports.md | 19 ++ docs/authentication.md | 18 -- docs/index.md | 84 +++++++++ .../commit-detection.md} | 0 docs/troubleshooting/common-issues.md | 26 +++ .../swift-objectivec.md} | 12 +- mkdocs.yml | 28 +++ requirements.txt | 2 + 13 files changed, 219 insertions(+), 207 deletions(-) create mode 100644 docs/advanced/authenticating-using-account-token.md rename docs/{installation.md => advanced/installation-methods.md} (95%) create mode 100644 docs/advanced/multiple-reports.md delete mode 100644 docs/authentication.md create mode 100644 docs/index.md rename docs/{commit_detection.md => troubleshooting/commit-detection.md} (100%) create mode 100644 docs/troubleshooting/common-issues.md rename docs/{swift_objectivec.md => troubleshooting/swift-objectivec.md} (58%) create mode 100644 mkdocs.yml create mode 100644 requirements.txt diff --git a/.circleci/config.yml b/.circleci/config.yml index e1e8e3ec..be9c673d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -178,7 +178,21 @@ jobs: export ERROR_CODE=$? if [ $ERROR_CODE -ne 0 ]; then echo "expected an error code 0 and got $ERROR_CODE instead"; exit 1; fi echo "test completed with the expected error code: 0" - + + build_mkdocs: + docker: + - image: circleci/python:3.6.4 + working_directory: ~/workdir + steps: + - attach_workspace: + at: ~/workdir + - run: + name: install dependencies + command: sudo pip install -r requirements.txt + - run: + name: build mkdocs + command: mkdocs build + workflows: version: 2 compile_test_deploy: @@ -189,6 +203,9 @@ workflows: context: CodacyCircleCI requires: - codacy/checkout_and_version + - build_mkdocs: + requires: + - codacy/checkout_and_version - codacy/sbt: name: populate_cache cmd: sbt "set scalafmtUseIvy in ThisBuild := false;update" @@ -320,7 +337,7 @@ workflows: filters: branches: ignore: - - master + - master - publish_prod: context: CodacyCircleCI requires: diff --git a/.gitignore b/.gitignore index c779c570..f028afb0 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ codacy-coverage-reporter-darwin-* classes/ src/test/resources/codacy-coverage.json /.codacy-coverage/ +site diff --git a/README.md b/README.md index 31c72202..365a2b38 100644 --- a/README.md +++ b/README.md @@ -9,182 +9,7 @@ Multi-language coverage reporter for Codacy https://www.codacy.com ## Setup -1. Copy a *Project API Token*. You can find the token within a repository *Settings* → *Integrations* → *Project API*. -1. Set the *Project API Token* in your terminal, replacing %Project_Token% with your own: - -``` -export CODACY_PROJECT_TOKEN=%Project_Token% -``` - -⚠️ **You should keep your API token well protected, as it grants owner permissions to your projects.** - -> If you'd like to automate this process for multiple repositories you can [authenticate using an Account API Token](docs/authentication.md). - -### Self-hosted - -To upload coverage to a self-hosted installation of Codacy you need to set your installation URL: - -``` -export CODACY_API_BASE_URL=:16006 -``` - -Or use the flag: `--codacy-api-base-url :16006`. - -## Running Codacy Coverage Reporter - -### Requirements - -- `bash` or `sh` (Use `bash` on Ubuntu) -- `curl` or `wget` -- `glibc` - -### _Using curl_ -```bash -bash <(curl -Ls https://coverage.codacy.com/get.sh) -``` - -### _Using wget_ -```bash -bash <(wget -q -O - https://coverage.codacy.com/get.sh) -``` - -### _On Alpine Linux_ -```sh -wget -qO - https://coverage.codacy.com/get.sh | sh -``` - -#### _On Alpine Linux passsing command line options_ -```sh -wget -qO - https://coverage.codacy.com/get.sh | sh -s report -l Java -r report1.xml --partial -``` - -### Choose a specific version -The script uses by default the latest version. - -If you want to specify a coverage reporter version, use `CODACY_REPORTER_VERSION` environment variable. - -You can find all versions in the [Releases tab](https://github.com/codacy/codacy-coverage-reporter/releases). - -### Manual Installation - -Using GitHub Actions? Check out the [codacy/coverage-coverage-reporter action](https://github.com/codacy/codacy-coverage-reporter-action#codacy-coverage-reporter-action). - -If the automated script does not cover your use case, [check the manual installation methods](docs/installation.md#manually-downloading-the-native-binary). - -## CircleCI Orb - -Using CircleCI? Check out the [codacy/coverage-reporter orb](docs/installation.md#circleci-orb). - -## Supported formats - -The following table contains the formats supported and which coverage tools generate them: - -| Language | Coverage tools (examples) | Formats | Filename | -| --- | --- | --- | --- | -| Java | [JaCoCo](http://eclemma.org/jacoco/)
[Cobertura](http://cobertura.github.io/cobertura/) | JaCoCo
Cobertura | jacoco*.xml
cobertura.xml | -| Scala | [sbt-jacoco](https://www.scala-sbt.org/sbt-jacoco/)
[scoverage](http://scoverage.org/) | JaCoCo
Cobertura | jacoco*.xml
cobertura.xml | -| Javascript | [Istanbul](https://github.com/gotwarlost/istanbul)
[Poncho](https://github.com/deepsweet/poncho)
[Mocha](http://mochajs.org/) + [Blanket.js](https://github.com/alex-seville/blanket) | LCOV | lcov.info, lcov.dat, *.lcov | -| Python | [Coverage.py](https://coverage.readthedocs.io/en/coverage-5.0.3/) | Cobertura | cobertura.xml | -| PHP | [PHPUnit](https://phpunit.readthedocs.io/en/8.5/code-coverage-analysis.html) | PHPUnit XML (version <= 4)
[Clover](https://confluence.atlassian.com/clover/using-clover-for-php-420973033.html) | coverage-xml/index.xml
clover.xml | -| Ruby | [SimpleCov](https://github.com/colszowka/simplecov) | [Cobertura](https://github.com/dashingrocket/simplecov-cobertura)
[LCOV](https://github.com/fortissimo1997/simplecov-lcov) | cobertura.xml
lcov.info, lcov.dat, *.lcov | -| C# | [OpenCover](https://github.com/OpenCover/opencover)
[DotCover CLI](https://www.jetbrains.com/dotcover/) | OpenCover
DotCover-DetailedXML | opencover.xml
dotcover.xml | -| Swift/Objective-C | XCode Coverage | [Check here information about reports for this language](docs/swift_objectivec.md) | | - -The reporter assumes the coverage reports filename follow the name convention. Otherwise, you must define the report's location with the flag `-r`. - -> If your coverage reports are in a different format you can use a format converter, such as [ReportGenerator](https://danielpalme.github.io/ReportGenerator/), to generate a supported format. - -### Unsuported Languages - -If your language is not in the list of supported languages, you can still send coverage to Codacy. You can do it by providing the correct `--language` name and then add the `--force-language` flag. - -## Commit SHA hash detection - -Codacy automatically detects a commit SHA hash from CI workflows, the git repository or command line arguments. See [all supported environments](docs/commit_detection.md). - -## Multiple coverage reports for the same language - -In order to send multiple reports for the same language, you need to upload each report separately with the flag `--partial` and then notify Codacy, after all reports were sent, with the `final` command. - -**_Example_** - -1. `codacy-coverage-reporter report -l Java -r report1.xml --partial` -1. `codacy-coverage-reporter report -l Java -r report2.xml --partial` -1. `codacy-coverage-reporter final` - -**_Using the script_** - -1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report1.xml --partial` -1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report2.xml --partial` -1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) final` - -If you are sending reports with the partial flag for a certain language you should use it in all reports for that language to ensure the correct calculation of the coverage. - -It might also be possible to merge the reports before uploading them to Codacy, since most coverage tools support merge/aggregation, example: http://www.eclemma.org/jacoco/trunk/doc/merge-mojo.html. - -## Other commands - -For a complete list of commands and options: `--help` - -## Troubleshooting - -### `JsonParseException` while uploading C# coverage data - -If you're using dotCover to generate coverage reports for your C# projects, you should [exclude xUnit files](https://www.jetbrains.com/help/dotcover/Running_Coverage_Analysis_from_the_Command_LIne.html#filters_cmd) from the coverage analysis as follows: - -```bash -dotCover.exe cover ... /Filters=-:xunit* -``` - -By default, dotCover includes xUnit files in the coverage analysis and this results in larger coverage reports. This filter helps ensure that the resulting coverage data does not exceed the size limit accepted by the Codacy API when uploading the results. - -### `Failed to upload report: Not Found` - -Error when running the command, then you'll probably have codacy-coverage-reporter 1.0.3 installed. -Make sure you install version 1.0.4, that fixes that error. - -Example (issue: [#11](https://github.com/codacy/codacy-coverage-reporter/issues/11)) : - -``` -codacy-coverage-reporter report -l Java -r PATH_TO_COVERAGE/coverage.xml -2015-11-20 04:06:58,887 [info] com.codacy Parsing coverage data... -2015-11-20 04:06:59,506 [info] com.codacy Uploading coverage data... - -2015-11-20 04:07:00,639 [error] com.codacy Failed to upload report: Not Found -``` - -Even after doing all of the above troubleshooting steps in case you still encounter the same error - -``` -2015-11-20 04:07:00,639 [error] com.codacy Failed to upload report: Not Found -``` - -Please try running the command with a --prefix option with path to your code as shown below , it helps to locate the files for which code coverage is desired - -``` -codacy-coverage-reporter report -l Java -r PATH_TO_COVERAGE/coverage.xml --prefix PATH_TO_THE_DIRECTORY -``` - -Example - -``` -codacy-coverage-reporter report -l Java -r api/target/site/jacoco/jacoco.xml --prefix api/src/main/java/ -``` - -### `SubstrateSegfaultHandler caught signal 11` - -If you are experiencing segmentation faults uploading the coverage (due to [oracle/graal#624](https://github.com/oracle/graal/issues/624)), do this before running the reporter, as a workaround: - -```sh -echo "$(dig +short api.codacy.com | tail -n1) api.codacy.com" >> /etc/hosts -``` - -### `coverage-xml/index.xml generated an empty result` - -If you are using PHPUnit version 5 or above to generate your coverage report, you must output the report using the clover format. The codacy-coverage-reporter supports the PHPUnit xml format only for versions equal or lower than 4. -You can change the output format by replacing the `--coverage-xml ` flag by `--coverage-clover `. - -For more information on the PHPUnit command line check [here](https://phpunit.readthedocs.io/en/9.1/textui.html). +[Get started](http://docs.dev.codacy.org/coverage-reporter) ## What is Codacy? diff --git a/docs/advanced/authenticating-using-account-token.md b/docs/advanced/authenticating-using-account-token.md new file mode 100644 index 00000000..5386334e --- /dev/null +++ b/docs/advanced/authenticating-using-account-token.md @@ -0,0 +1,17 @@ +# Authenticating using an Account API token + +If you'd like to automate uploading coverage for multiple repositories you can authenticate using an Account API Token: + +1. Create an Account API token on Codacy. You can find the token in *Your account* → *API tokens*. +1. Set the API token in your terminal, replacing `%API_Token%` with your own token. +1. Set your repository name in your terminal, replacing `%Repo_Name%`. +1. Set your username in your terminal, replacing `%Username%`. + +```bash +export CODACY_API_TOKEN=%API_Token% +export CODACY_PROJECT_NAME=%Repo_Name% +export CODACY_USERNAME=%Username% +``` + +!!! warning + You should keep your API token well protected, as it grants owner permissions to your projects. diff --git a/docs/installation.md b/docs/advanced/installation-methods.md similarity index 95% rename from docs/installation.md rename to docs/advanced/installation-methods.md index d7ca2542..51f1607b 100644 --- a/docs/installation.md +++ b/docs/advanced/installation-methods.md @@ -1,21 +1,27 @@ -# Installation +# Installation methods -## Automatic script +## Automatic script (recommended) -Requirements: bash, curl, glibc. +For Ubuntu: -```bash +```curl bash <(curl -Ls https://coverage.codacy.com/get.sh) ``` -To specify a coverage reporter version, use `CODACY_REPORTER_VERSION` environment variable. +For Alpine Linux: + +```sh +wget -qO - https://coverage.codacy.com/get.sh | sh +``` + +> To specify a coverage reporter version, use `CODACY_REPORTER_VERSION` environment variable. ## CircleCI orb If you want to use Codacy with CircleCI and report coverage generated from your tests ran in CircleCI, you can use our [coverage reporter orb](https://circleci.com/orbs/registry/orb/codacy/coverage-reporter): -Example: - +!!! example + ```yaml jobs: send-coverage-report: steps: @@ -27,6 +33,7 @@ Example: coverage-example: jobs: - send-coverage-report + ``` ## GitHub Action diff --git a/docs/advanced/multiple-reports.md b/docs/advanced/multiple-reports.md new file mode 100644 index 00000000..a0b4377a --- /dev/null +++ b/docs/advanced/multiple-reports.md @@ -0,0 +1,19 @@ +# Multiple coverage reports for the same language + +In order to send multiple reports for the same language, you need to upload each report separately with the flag `--partial` and then notify Codacy, after all reports were sent, with the `final` command. + +**_Example_** + +1. `codacy-coverage-reporter report -l Java -r report1.xml --partial` +1. `codacy-coverage-reporter report -l Java -r report2.xml --partial` +1. `codacy-coverage-reporter final` + +**_Using the script_** + +1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report1.xml --partial` +1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report2.xml --partial` +1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) final` + +If you are sending reports with the partial flag for a certain language you should use it in all reports for that language to ensure the correct calculation of the coverage. + +It might also be possible to merge the reports before uploading them to Codacy, since most coverage tools support merge/aggregation, example: http://www.eclemma.org/jacoco/trunk/doc/merge-mojo.html. diff --git a/docs/authentication.md b/docs/authentication.md deleted file mode 100644 index c3facd34..00000000 --- a/docs/authentication.md +++ /dev/null @@ -1,18 +0,0 @@ -# Authentication - -## Authenticating using an Account API token - -If you'd like to automate uploading coverage for multiple repositories you can authenticate using an Account API Token: - -1. Create an Account API token on Codacy. You can find the token in *Your account* → *API tokens* -1. Set the API token in your terminal, replacing *%API_Token%* with your own token -1. Set your repository name in your terminal, replacing *%Repo_Name%* -1. Set your username in your terminal, replacing *%Username%* - -``` -export CODACY_API_TOKEN=%API_Token% -export CODACY_PROJECT_NAME=%Repo_Name% -export CODACY_USERNAME=%Username% -``` - -⚠️ **You should keep your API token well protected, as it grants owner permissions to your projects.** diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..d587540f --- /dev/null +++ b/docs/index.md @@ -0,0 +1,84 @@ +# Getting started + +## Authentication + +1. Find and copy a *Project API Token*. You can find the token within a repository *Settings* → *Integrations* → *Project API*. +1. Set the *Project API Token* in your terminal, replacing `%Project_Token%` with your own: + +```bash +export CODACY_PROJECT_TOKEN=%Project_Token% +``` + +!!! warning + You should keep your API token well protected, as it grants owner permissions to your projects. + +!!! hint + If you'd like to automate this process for multiple repositories you can [authenticate using an Account API Token](advanced/authenticating-using-account-token.md). + +!!! note + To upload coverage to a self-hosted installation of Codacy you need to set your installation URL: + + ```bash + export CODACY_API_BASE_URL=:16006 + ``` + + Or use the flag: `--codacy-api-base-url :16006`. + +## Running Codacy Coverage Reporter + +The easiest way to get starting is by using the self-contained script that downloads and runs the reporter: + +```bash +bash <(curl -Ls https://coverage.codacy.com/get.sh) +``` + +### Choose a specific version +The script uses by default the latest version. + +If you want to specify a coverage reporter version, use `CODACY_REPORTER_VERSION` environment variable. + +You can find all versions in the [Releases tab](https://github.com/codacy/codacy-coverage-reporter/releases). + +### Manual Installation + +Using CircleCI? Check out the [codacy/coverage-reporter orb](advanced/installation-methods.md#circleci-orb). + +Using GitHub Actions? Check out the [codacy/coverage-coverage-reporter action](https://github.com/codacy/codacy-coverage-reporter-action#codacy-coverage-reporter-action). + +If the automated script does not cover your use case, [check the manual installation methods](advanced/installation-methods.md#manually-downloading-the-native-binary). + +## Supported formats + +The following table contains the formats supported and which coverage tools generate them: + +| Language | Coverage tools (examples) | Formats | Filename | +| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | +| Java | [JaCoCo](http://eclemma.org/jacoco/)
[Cobertura](http://cobertura.github.io/cobertura/) | JaCoCo
Cobertura | jacoco*.xml
cobertura.xml | +| Scala | [sbt-jacoco](https://www.scala-sbt.org/sbt-jacoco/)
[scoverage](http://scoverage.org/) | JaCoCo
Cobertura | jacoco*.xml
cobertura.xml | +| Javascript | [Istanbul](https://github.com/gotwarlost/istanbul)
[Poncho](https://github.com/deepsweet/poncho)
[Mocha](http://mochajs.org/) + [Blanket.js](https://github.com/alex-seville/blanket) | LCOV | lcov.info, lcov.dat, *.lcov | +| Python | [Coverage.py](https://coverage.readthedocs.io/en/coverage-5.0.3/) | Cobertura | cobertura.xml | +| PHP | [PHPUnit](https://phpunit.readthedocs.io/en/8.5/code-coverage-analysis.html) | PHPUnit XML (version <= 4)
[Clover](https://confluence.atlassian.com/clover/using-clover-for-php-420973033.html) | coverage-xml/index.xml
clover.xml | +| Ruby | [SimpleCov](https://github.com/colszowka/simplecov) | [Cobertura](https://github.com/dashingrocket/simplecov-cobertura)
[LCOV](https://github.com/fortissimo1997/simplecov-lcov) | cobertura.xml
lcov.info, lcov.dat, *.lcov | +| C# | [OpenCover](https://github.com/OpenCover/opencover)
[DotCover CLI](https://www.jetbrains.com/dotcover/) | OpenCover
DotCover-DetailedXML | opencover.xml
dotcover.xml | +| Swift/Objective-C | XCode Coverage | [Check here information about reports for this language](troubleshooting/swift-objectivec.md) | | + +The reporter assumes the coverage reports filename follow the name convention. Otherwise, you must define the report's location with the flag `-r`. + +!!! note + If your coverage reports are in a different format you can use a format converter, such as [ReportGenerator](https://danielpalme.github.io/ReportGenerator/), to generate a supported format. + +### Unsuported Languages + +If your language is not in the list of supported languages, you can still send coverage to Codacy. You can do it by providing the correct `--language` name and then add the `--force-language` flag. + +## Commit SHA hash detection + +Codacy automatically detects a commit SHA hash from CI workflows, the git repository or command line arguments. See [all supported environments](troubleshooting/commit-detection.md). + +## Multiple coverage reports for the same language + +You can upload multiple reports if your test suite is split in different modules or ran in parallel. See [how to uploasd multiple coverage reports](advanced/multiple-reports.md). + +## Other commands + +For a complete list of commands and options: `--help` diff --git a/docs/commit_detection.md b/docs/troubleshooting/commit-detection.md similarity index 100% rename from docs/commit_detection.md rename to docs/troubleshooting/commit-detection.md diff --git a/docs/troubleshooting/common-issues.md b/docs/troubleshooting/common-issues.md new file mode 100644 index 00000000..65decc11 --- /dev/null +++ b/docs/troubleshooting/common-issues.md @@ -0,0 +1,26 @@ +# Common issues + +## `JsonParseException` while uploading C# coverage data + +If you're using dotCover to generate coverage reports for your C# projects, you should [exclude xUnit files](https://www.jetbrains.com/help/dotcover/Running_Coverage_Analysis_from_the_Command_LIne.html#filters_cmd) from the coverage analysis as follows: + +```bash +dotCover.exe cover ... /Filters=-:xunit* +``` + +By default, dotCover includes xUnit files in the coverage analysis and this results in larger coverage reports. This filter helps ensure that the resulting coverage data does not exceed the size limit accepted by the Codacy API when uploading the results. + +## `SubstrateSegfaultHandler caught signal 11` + +If you are experiencing segmentation faults uploading the coverage (due to [oracle/graal#624](https://github.com/oracle/graal/issues/624)), do this before running the reporter, as a workaround: + +```sh +echo "$(dig +short api.codacy.com | tail -n1) api.codacy.com" >> /etc/hosts +``` + +## `coverage-xml/index.xml generated an empty result` + +If you are using PHPUnit version 5 or above to generate your coverage report, you must output the report using the clover format. The codacy-coverage-reporter supports the PHPUnit xml format only for versions equal or lower than 4. +You can change the output format by replacing the `--coverage-xml ` flag by `--coverage-clover `. + +For more information on the PHPUnit command line check [here](https://phpunit.readthedocs.io/en/9.1/textui.html). diff --git a/docs/swift_objectivec.md b/docs/troubleshooting/swift-objectivec.md similarity index 58% rename from docs/swift_objectivec.md rename to docs/troubleshooting/swift-objectivec.md index 14313c77..4df8fd81 100644 --- a/docs/swift_objectivec.md +++ b/docs/troubleshooting/swift-objectivec.md @@ -1,13 +1,17 @@ -## Swift/Objective-C +# Swift & Objective-C support To use Swift/Objective-C and XCode coverage reporter, you should use [Slather](https://github.com/SlatherOrg/slather) to convert XCode report into Cobertura format. This can be achieve by running this commands on the CI: - gem install slather - slather coverage -x --output-directory --scheme .xcodeproj +```bash +gem install slather +slather coverage -x --output-directory --scheme .xcodeproj +``` This will generate a `cobertura.xml` inside `` folder. After this, call our script: - bash <(curl -Ls https://coverage.codacy.com/get.sh) +```bash +bash <(curl -Ls https://coverage.codacy.com/get.sh) +``` diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 00000000..3e9bcb09 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,28 @@ +site_name: coverage-reporter + +strict: true + +theme: + name: "material" + +markdown_extensions: + - admonition + - codehilite: + guess_lang: false + linenums: true + - footnotes + - meta + - pymdownx.superfences + - toc: + permalink: true + +nav: + - "index.md" + - "Advanced": + - "advanced/authenticating-using-account-token.md" + - "advanced/multiple-reports.md" + - "advanced/installation-methods.md" + - "Troubleshooting": + - "Common issues": "troubleshooting/common-issues.md" + - "Commit detection": "troubleshooting/commit-detection.md" + - "Swift & Objective-C support": "troubleshooting/swift-objectivec.md" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..da15d928 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +mkdocs==1.1 +mkdocs-material==5.1.0 From f626ecd7f1c890a02482690a886ce04513d2db71 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 17 Apr 2020 12:04:33 +0100 Subject: [PATCH 2/4] Simplify mkdocs.yml nav tree It's easier to maintain page titles if we don't define them explicitly on mkdocs.yml --- mkdocs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index 3e9bcb09..c8c132ff 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -23,6 +23,6 @@ nav: - "advanced/multiple-reports.md" - "advanced/installation-methods.md" - "Troubleshooting": - - "Common issues": "troubleshooting/common-issues.md" - - "Commit detection": "troubleshooting/commit-detection.md" - - "Swift & Objective-C support": "troubleshooting/swift-objectivec.md" + - "troubleshooting/common-issues.md" + - "troubleshooting/commit-detection.md" + - "troubleshooting/swift-objectivec.md" From 4600213b20629c375f087bc76ecf056bbe526696 Mon Sep 17 00:00:00 2001 From: Paulo Ribeiro Date: Fri, 17 Apr 2020 12:14:08 +0100 Subject: [PATCH 3/4] Minor improvements to formatting and readability --- docs/advanced/multiple-reports.md | 22 +++++++++++++--------- docs/index.md | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/docs/advanced/multiple-reports.md b/docs/advanced/multiple-reports.md index a0b4377a..27dbce15 100644 --- a/docs/advanced/multiple-reports.md +++ b/docs/advanced/multiple-reports.md @@ -2,18 +2,22 @@ In order to send multiple reports for the same language, you need to upload each report separately with the flag `--partial` and then notify Codacy, after all reports were sent, with the `final` command. -**_Example_** +Example: -1. `codacy-coverage-reporter report -l Java -r report1.xml --partial` -1. `codacy-coverage-reporter report -l Java -r report2.xml --partial` -1. `codacy-coverage-reporter final` +```bash +codacy-coverage-reporter report -l Java -r report1.xml --partial +codacy-coverage-reporter report -l Java -r report2.xml --partial +codacy-coverage-reporter final +``` -**_Using the script_** +Using the script: -1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report1.xml --partial` -1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report2.xml --partial` -1. `bash <(curl -Ls https://coverage.codacy.com/get.sh) final` +```bash +bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report1.xml --partial +bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r report2.xml --partial +bash <(curl -Ls https://coverage.codacy.com/get.sh) final +``` If you are sending reports with the partial flag for a certain language you should use it in all reports for that language to ensure the correct calculation of the coverage. -It might also be possible to merge the reports before uploading them to Codacy, since most coverage tools support merge/aggregation, example: http://www.eclemma.org/jacoco/trunk/doc/merge-mojo.html. +It might also be possible to merge the reports before uploading them to Codacy, since most coverage tools support merge/aggregation, for example: . diff --git a/docs/index.md b/docs/index.md index d587540f..c2a428dc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,27 +2,26 @@ ## Authentication -1. Find and copy a *Project API Token*. You can find the token within a repository *Settings* → *Integrations* → *Project API*. -1. Set the *Project API Token* in your terminal, replacing `%Project_Token%` with your own: +1. Find and copy a *Project API Token*. You can find the token within a repository *Settings* → *Integrations* → *Project API*. -```bash -export CODACY_PROJECT_TOKEN=%Project_Token% -``` + !!! warning + You should keep your API token well protected, as it grants owner permissions to your projects. -!!! warning - You should keep your API token well protected, as it grants owner permissions to your projects. +1. Set the *Project API Token* in your terminal, replacing `%Project_Token%` with your token: -!!! hint - If you'd like to automate this process for multiple repositories you can [authenticate using an Account API Token](advanced/authenticating-using-account-token.md). + ```bash + export CODACY_PROJECT_TOKEN=%Project_Token% + ``` -!!! note - To upload coverage to a self-hosted installation of Codacy you need to set your installation URL: + To upload coverage to a self-hosted installation of Codacy you also need to set your installation URL, replacing `%Codacy_instance_URL%` with your URL: ```bash - export CODACY_API_BASE_URL=:16006 + export CODACY_API_BASE_URL=%Codacy_instance_URL%:16006 ``` - Or use the flag: `--codacy-api-base-url :16006`. +!!! hint + If you'd like to automate this process for multiple repositories you can [authenticate using an Account API Token](advanced/authenticating-using-account-token.md). + ## Running Codacy Coverage Reporter @@ -33,6 +32,7 @@ bash <(curl -Ls https://coverage.codacy.com/get.sh) ``` ### Choose a specific version + The script uses by default the latest version. If you want to specify a coverage reporter version, use `CODACY_REPORTER_VERSION` environment variable. From 1b830789be8c23e9eef0257e5a7079af75781382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Cort=C3=AAs?= Date: Fri, 17 Apr 2020 13:14:06 +0100 Subject: [PATCH 4/4] Update README.md Co-Authored-By: Paulo Ribeiro <60105800+pauloribeiro-codacy@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 365a2b38..9df9b934 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Multi-language coverage reporter for Codacy https://www.codacy.com ## Setup -[Get started](http://docs.dev.codacy.org/coverage-reporter) +[Get started](https://github.com/codacy/codacy-coverage-reporter/tree/master/docs/index.md) ## What is Codacy?