How to disable check in codeclimate? - code-climate

Сan you please guide me on how to reduce the full test coverage threshold in the config file in the repository? I had 33% full coverage in some project, my edits reduced it to 0.2, and I would like to say to codeclimate that this is acceptable
I have my golang repo and .codeclimate.yml in root:
version: "2" # required to adjust maintainability checks
checks:
return-statements:
enabled: false

as pointed here there is no configuration to modify that.
Extracted from the docs
If the overall test coverage percentage of your repository will decrease (by 0.1% >or more) by merging the PR, Code Climate will send a failed status to Github.
If I'm understanding correctly, you would like to increase that threshold to lets say 0.5%, so for the case of your edits codeclimate doesn't raise a flag. If that's the case, then again, that's not configurable.
Under your Repo -> Settings, you can enable or disable sending pass/fail statuses >on your total coverage.

Check this document. You can disable the Enforce Diff Coverage and Enforce Totoal Coverage checks in codeclimate so that these reports are not run for your commits.

Related

Pytest coverage with line coverage and minimum limits like karma/Istanbul

In Instanbul coverage module for Karma you can set thresholds for different kind of coverages. If some coverage doesnt meet its minimum then instanbul throws an error. This is very usefull when building the project with jenkins and you have to keep such limits. Is it possible to get similar functionality with pytest-cov or any other module?
https://ibb.co/y4J3JrG
pytest-cov generates only statements coverage. Is it possible to get line/code coverage as well?
Coverage.py (which is the engine for pytest-cov) has thresholds for total coverage, but not separate thresholds for different measurements. Look at the --fail-under option.
Coverage.py can measure statement coverage and branch coverage. You mention "line" coverage and "code" coverage: I don't know how those differ from statement coverage.
you can find the option you need as follows:
pytest --help
--cov-fail-under=MIN Fail if the total coverage is less than MIN.

Detect unit test code coverage of a commit

Let's say that the language I use is Java and I do a specific commit, is there a way how I can tell the code coverage of a commit or even if it was done? When a user commits to the repository, I want to have multiple statistics about the commit, including unit test coverage on that specific commit. Is this even possible? Are there already such tools out there or do I need to think about something custom?
I am using Git hosted under Gitblit, I alread saw the hook mechanism by Gitblit, thus it is just a matter of how to do this.
I am working now on that same problem, and I've come out with this approach:
My projects are Java and Maven based. Every one of them inherits from a common parent.
In the common parent pom I've set the jacoco-maven-plugin at integration-test phase to calculate the unit tests coverage. The produced report is stored in the same project along with the source code.
Every time a developer does a commit to the Source Control System, he/she also commits the report, so that I shall query the coverage state for every commit that has been done.
This is already done and working. My next step will be to develop a tool to query the Source Control System (which is SVN in my case) to get the coverage statistics: by date, project, and even by user.
Note that the report generated by Jacoco is absolute, not incremental. If you want it incremental (as I want, too), you have to compute the difference between one report and the previous one.
To query SVN I'm currently using org.tmatesoft.svnkit:svnkit:1.3.8.
The same procedure can be applied to other code metrics: rules compliance, etc.

Force Jenkins to fail if it cannot find a given number of test reports

Is there any way to force a Jenkins build to fail if a minimum number of unit tests have not been executed? For instance, say I had 300 unit tests being ran by Jenkins and I changed something (generating failsafe-reports before, but now are generating surefire-reports) so that Jenkins only found 3 test reports and could not find the remaining 297 reports. Can I specify a minimum number of tests being ran in order to have the build be successful?
The Conditional BuildStep Plugin might be the solution you are looking for.

TeamCity: How do you report low unit test coverage?

We use TeamCity 7 (upgrade to 8 is possible) for continuous integration and we set ourselves a target of unit test coverage 90%. I know how to fail the build if the coverage is lower, but I'd not like to do so, as a missing test will slow down all the development.
On the other hand, I'd like to have clear visibility on the build overview page that the coverage is low - the only option I see is a service message like this one:
##teamcity[buildStatus status='SUCCESS' text='WARN: Test coverage only 89% {build.status.text}']
But that won't send any notification. Do you have any other suggestions, please?
Set the coverage html as artifact and link to it from Teamcity. IE setup a new tab, it will look something like this.

Branch coverage with JaCoCo, Emma from IntelliJ

I am trying to measure branch coverage of unit tests for a large Grails application. I am using JaCoCo, Emma and IDEA to collect the metrics from inside IntelliJ, I am getting the following:
JaCoCo (no metrics are shown even for line coverage)
Emma (produces method and line coverage)
IDEA (produces class, method and line coverage)
I am mostly interested in JaCoCo as it should give me Branch Coverage by default. Could someone point me to some tips on how to troubleshoot this?
Actually IntelliJ code coverage tool supports branch coverage though it does not show the results on the summary. Check this article to see how it can be configured and how you can check your branch coverage: https://confluence.jetbrains.com/display/IDEADEV/IDEA+Coverage+Runner
The key is to use Tracing instead of Sampling.