Giter Site home page Giter Site logo

cover-checker's Introduction

Coverage Checker Build Status

CoverChecker provides a test coverage for new added lines of code. If you create new pull request, CoverChecker would give feedback regarding how much of the new lines your test code has covered.

Good Test code makes people find bug more efficiently before service release and prevents service from being disabled. To check the test code quality, most of developers refer the code coverage status as an important index. This is why most of them spend their resources to update their test code to achieve more code coverage whenever they add new lines of code. However, it has been hard to check and improve the code coverage as there are lots of old legacy codes which is not within the scope of the current test code.

Spring REST doc is one of spring component. it makes api document from test code.

CoverChecker provides a feature to check the code coverage for new added code, not a whole code. It will reduce the pressure to cover the whole and help you to achieve more coverage steadly and efficiently. Makes your code more durable!

CoverChecker do...

example

  • Find new code line from pull request
  • Get test coverage each file from coverage report
  • Combine information and check test code cover new code line
  • Write report on pull request
  • CoverChecker will fail when coverage doesn't satisfy your goal

Run with jenkins

  1. Install jdk 8 on your ci
  2. Build CoverChecker
  3. Fix your project to generate test coverage report(CoverChecker only Jacoco or Cobertura)
  4. Execute CoverChecker in you build job

How to build

Use maven wrapper

./gradlew clean build jar

then maven would make jar cover-checker-console/build/libs/cover-checker-${version}-all.jar

Create access token

Create an access token

Execute with parameter

java -jar cover-checker-console/build/libs/cover-checker-${version}-all.jar \
    --cover ${coverageReportPath} \
    [--cover ${otherCoverageReportPath}] \
    --github-token ${githubAccessToken} \
    --repo ${githubRepositoryPath} \
    --threshold ${coverageThreshold} \
    --github-url ${githubHost} \
    --pr ${pullrequestNo} \
    [-type (jacoco | cobertura)]

Note that both the --cover and -type parameters can be specified multiple times and are associated positionally.

For example, if you have two coverage reports in different formats, you can specify them like this:

java -jar cover-checker-console/build/libs/cover-checker-${version}-all.jar \
    -type jacoco --cover jacoco.xml \
    -type cobertura --cover cobertura.xml \
    ... # other parameters

Parameter

usage: coverchecker.jar -c <arg> [-d <arg>] [-dt <arg>] [-ft <arg>] [-g <arg>]
       [-p <arg>] [-r <arg>] -t <arg> [-type <arg>] [-u <arg>]
-c,--cover <arg>          coverage report paths(absolute recommend), coverage
                          report path can take multiple paths for multi-module
                          project
-d,--diff <arg>           diff file path(absolute recommend)
-dt,--diff-type <arg>     diff type (github | file)
-ft,--file-threshold <arg>coverage report type (jacoco | cobertura) default is
                          jacoco
-g,--github-token <arg>   github oauth token
-p,--pr <arg>             github pr number
-r,--repo <arg>           github repo
-t,--threshold <arg>      coverage pass threshold
-type <arg>               coverage report type (jacoco | cobertura) default is
                          jacoco
-u,--github-url <arg>     The url when you working on github enterprise url.
                          default is api.github.com

License

Copyright 2018 NAVER Corp.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

cover-checker's People

Contributors

amunra avatar ksmail13 avatar nesoy-kwon avatar wicksome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cover-checker's Issues

support github checks

안녕하세요.

현재 결과 리포트가 PR의 issue comment로 기록이 되는데요.
이 부분을 github app을 이용해서 github checks에 리포트 되도록 지원되면 더욱 좋을 것 같습니다.

감사합니다.

Use travis ci

Use travis ci for pr test

  • test build
  • use coverchecker after test build

Add jar files in release

maven package를 하지 않고,
바로 release에서 다운받아 사용할 수 있도록 jar파일이 추가되면 좋을 것 같습니다.

커버리지 결과에서 hit 수가 많을 경우 Exception이 발생하는 문제

안녕하세요.

이번에 cover-checker 1.4.0 에서 아래와 같은 Comment 와 Exception이 발생 하였습니다.
image

15:12:26.367 [main] INFO  (CoverChecker.java:47) Check new line of code coverage by XmlCoverageReportParser
15:12:26.376 [main] INFO  (CoverChecker.java:53) read diff by GithubDiffReader
15:12:26.381 [ForkJoinPool.commonPool-worker-87] INFO  (GithubDiffManager.java:40) get diff video-tech1/MediaComparator/135
15:12:26.410 [main] INFO  (ConsoleReporter.java:28) coverage check result
15:12:26.412 [main] ERROR (ConsoleReporter.java:36) result error occurred
java.util.concurrent.CompletionException: java.lang.NumberFormatException: For input string: "2338181480"
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1702)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: java.lang.NumberFormatException: For input string: "2338181480"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.base/java.lang.Integer.parseInt(Integer.java:652)
	at java.base/java.lang.Integer.parseInt(Integer.java:770)
	at com.naver.nid.cover.cobertura.CoberturaCoverageReportHandler.getCoverageStatus(CoberturaCoverageReportHandler.java:94)
	at com.naver.nid.cover.cobertura.CoberturaCoverageReportHandler.initLine(CoberturaCoverageReportHandler.java:80)
	at com.naver.nid.cover.cobertura.CoberturaCoverageReportHandler.startElement(CoberturaCoverageReportHandler.java:60)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
	at java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:731)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1397)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
	at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:330)
	at com.naver.nid.cover.parser.coverage.XmlCoverageReportParser.parse(XmlCoverageReportParser.java:50)
	at com.naver.nid.cover.parser.coverage.CoverageReportParser.parse(CoverageReportParser.java:31)
	at com.naver.nid.cover.CoverChecker.lambda$null$5(CoverChecker.java:74)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	... 6 common frames omitted

커버리지 xml 을 확인해보니, 특정 라인들의 hit 수가 20억번 이상과 같이 매우 큰 값이 되어 발생하는 것 같습니다.

<class branch-rate="0.763157894737" complexity="0.0" filename="src/analyzer/quality/PsnrCalculator.cpp" line-rate="0.931034482759" name="PsnrCalculator_cpp">
<methods/>
<lines>
<line branch="false" hits="23231" number="7"/>
<line branch="true" condition-coverage="50% (2/4)" hits="23231" number="8">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="50% (2/4)" hits="46462" number="9">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="100% (2/2)" hits="6745431" number="11">
<conditions>
<condition coverage="100%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="100% (2/2)" hits="2338181480" number="12">
<conditions>
<condition coverage="100%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="50% (1/2)" hits="2331459280" number="13">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="50% (1/2)" hits="2331459280" number="14">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="100% (2/2)" hits="9325837120" number="15">
<conditions>
<condition coverage="100%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="50% (1/2)" hits="6994377840" number="16">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>
<line branch="true" condition-coverage="50% (1/2)" hits="6994377840" number="17">
<conditions>
<condition coverage="50%" number="0" type="jump"/>
</conditions>
</line>

우선 해당 파일을 커버리지에서 제외 처리하거나, 유닛 테스트를 수정해서 좀 덜 호출되도록 하는 방향으로 진행 중입니다.

감사합니다^^

NullPointerException when parsing multiple Cobertura files

I've started debugging this.

It turns out it's a multi-threading race:

  • The parsing of two files is concurrent and starts on two separate threads.
  • Both threads, however call the parse method on the same XmlCoverageReportParser object.
  • There is a race condition where one thread thread calls CoberturaCoverageReportHandler.endElement after a </class>.
    • This ends up setting lineReports = null;
  • Another thread, still processing a class calls the initLine handler and raises a NullPointerException here lineReports.add(lineCoverageReport); since lineReports is null.

I'm not entirely sure what the best way to fix this bug would be given the current code.

Fix Maven project structure

for #2

Divide project for core, executor project

Core module must takes
  • com.naver.nid.cover.checker
  • com.naver.nid.cover.github
  • com.naver.nid.cover.parser
  • com.naver.nid.cover.reporter
Executor module must take
  • Command line executor (like com.naver.nid.cover.CoverChecker)

Use Gradle as build tool

Use Gradle as a build tool

Maven is the most famous build tool in the Java environment(and language that is based on JVM).
However, Maven is inconvenient in a multi-module project.

1. Versioning

Maven doesn't share project version from root project to sub projects.
So I fix all versions in every pom.xmls when I update the application version.

2. Readability

Gradle uses Groovy to define a build. It provides to read much easier than XML.

3. Multi-module

Gradle easy to define dependencies between sub-modules.

C++ 프로젝트 적용 문의

안녕하세요 : )
다름이 아니라, 저희 프로젝트는 C++로 되어 있는데요.
아래 이슈도 그렇고, Java 프로젝트만 분석을 지원하는 것 같은데 맞는지 궁금합니다.
처음에는 이에 대해서 잘 모르고 연동을 시작해서 우선 진행해보았는데요.

아래와 같이 분석 결과가 항상 0/0 100으로 나오고 PR Comment도 동일한데, C++을 지원하지 않기 때문에 그런 것인지, 아니면 다른 부분을 살펴볼 수 있을지 궁금합니다.
만약 C++ 을 지원하지 않아서 그런 것이라면, 혹시 C++ 대해서도 분석을 지원하실 계획이 있으신지 궁금합니다.

+  java -jar /home1/irteamsu/CI/coverchecker-1.3.3-jar-with-dependencies.jar -c /home1/irteamsu/jenkins_home/workspace/nmss-pr-pipeline/cobertura-coverage.xml -g <TOKEN> -r videocell-tech/NMSS -t 5 -u oss.navercorp.com -p 1445 -type cobertura
19:02:14.445 [main] INFO  [CoverChecker.java:59] Check new line of code coverage by XmlCoverageReportParser
19:02:14.453 [main] INFO  [CoverChecker.java:63] read diff by GithubRawDiffReader
19:02:14.462 [ForkJoinPool.commonPool-worker-50] INFO  [GithubDiffManager.java:40] get diff videocell-tech/NMSS/1445
19:02:14.633 [ForkJoinPool.commonPool-worker-50] INFO  [GithubRawDiffReader.java:58] get file MediaServer/Common/Utils/VttToTtml.cpp
19:02:14.637 [ForkJoinPool.commonPool-worker-50] INFO  [DiffMapper.java:53] parse diff / Optional[MediaServer/Common/Utils/VttToTtml.cpp]
19:02:14.647 [ForkJoinPool.commonPool-worker-50] INFO  [GithubRawDiffReader.java:58] get file MediaServer/Common/Utils/VttToTtml.h
19:02:14.648 [ForkJoinPool.commonPool-worker-50] INFO  [DiffMapper.java:53] parse diff / Optional[MediaServer/Common/Utils/VttToTtml.h]
19:02:14.670 [main] INFO  [ConsoleReporter.java:29] coverage check result
19:02:14.671 [main] INFO  [ConsoleReporter.java:31] 0/0 100
19:02:15.670 [main] INFO  [CoverChecker.java:71] check result pass 

위와 같이 분석이 안되서 다른 방법으로 -d 하고 -dt file 옵션을 사용해 봤는데요.
이 경우 아래와 같이 Exception이 발생 하였습니다.

+ java -jar /home1/irteamsu/CI/coverchecker-1.3.3-jar-with-dependencies.jar -c /home1/irteamsu/jenkins_home/workspace/nmss-pr-pipeline/cobertura-coverage.xml -d /home1/irteamsu/jenkins_home/workspace/nmss-schedule-pipeline/cobertura-coverage.xml -dt file -g <TOKEN> -r videocell-tech/NMSS -t 1 -u oss.navercorp.com -p 1448 -type cobertura

<생략>
18:20:21.864 [main] INFO  [ConsoleReporter.java:29] coverage check result
18:20:21.866 [main] ERROR [ConsoleReporter.java:37] result error occurred
java.lang.NullPointerException: null
        at com.naver.nid.cover.checker.NewCoverageChecker.lambda$check$0(NewCoverageChecker.java:49)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
        at com.naver.nid.cover.checker.NewCoverageChecker.check(NewCoverageChecker.java:54)
        at com.naver.nid.cover.CoverChecker.check(CoverChecker.java:68)
        at com.naver.nid.cover.CoverChecker.main(CoverChecker.java:97)

지금 팀에 Java 프로젝트가 없고 익숙하지 않다보니 Java는 현재 환경에서 정상적으로 동작하는지 테스트를 해보지 못한 부분이 아쉽긴 한데요. 시간 내서 한번 테스트를 진행해보도록 하겠습니다.

감사합니다.

OpenCppCoverage의 cobertura 형식 지원

안녕하세요 : )

이번에 Windows 환경의 애플리케이션을 개발하다보니 gcovr을 사용할 수 없어서 OpenCppCoverage (https://github.com/OpenCppCoverage/OpenCppCoverage) 를 사용하여 cobertura 리포트를 산출 하였는데요.
산출 후 jenkins cobertura 플러그인과 sonarqube 에서는 정상적으로 커버리지 리포트가 노출되지만, cover-checker와 연동을 시도 하였는데 형식이 조금 달라서 그런지 Exception이 발생하거나 0% 로만 나오는 문제가 있었습니다.

산출되는 리포트 형식 관련해서는 아래 내용을 참고 부탁드립니다.
https://github.com/OpenCppCoverage/OpenCppCoverage/wiki/Jenkins

0% 로만 나오는 문제를 해결하기 위해 몇 가지 실행 옵션들을 수정하면서 테스트 하였는데, 이후 아래와 같이 Exception이 계속 발생하였습니다.

C:\Program Files (x86)\Jenkins\workspace\core-build>"C:\Program Files\Java\jdk-11.0.7\bin\java.exe" -jar c:\cover-checker-console-1.4.0-jar-with-dependencies.jar -c C:\UnitTestDCoverage.xml -g $token -r video-tech1/Core -t 10 -u oss.navercorp.com -p ${ghprbPullId} -type cobertura

20:44:29.224 [main] INFO  (CoverChecker.java:47) Check new line of code coverage by XmlCoverageReportParser
20:44:29.224 [main] INFO  (CoverChecker.java:53) read diff by GithubDiffReader
20:44:29.240 [ForkJoinPool.commonPool-worker-7] INFO  (GithubDiffManager.java:40) get diff video-tech1/Core/55
20:44:29.287 [main] INFO  (ConsoleReporter.java:28) coverage check result
20:44:29.287 [main] ERROR (ConsoleReporter.java:36) result error occurred
java.util.concurrent.CompletionException: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1702)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at com.naver.nid.cover.cobertura.CoberturaCoverageReportHandler.initClass(CoberturaCoverageReportHandler.java:120)
	at com.naver.nid.cover.cobertura.CoberturaCoverageReportHandler.startElement(CoberturaCoverageReportHandler.java:56)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1397)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324)
	at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:330)
	at com.naver.nid.cover.parser.coverage.XmlCoverageReportParser.parse(XmlCoverageReportParser.java:50)
	at com.naver.nid.cover.parser.coverage.CoverageReportParser.parse(CoverageReportParser.java:31)
	at com.naver.nid.cover.CoverChecker.lambda$null$5(CoverChecker.java:74)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	... 6 common frames omitted

감사합니다.

Report shows 0/0 100% coverage on not empty chanages

Awesome tool, thanks for open sourcing it!

I had a strange code coverage report here
questdb/questdb#1025

The coverage report file is here
https://dev.azure.com/questdb/questdb/_build/results?buildId=1197&view=artifacts&pathAsName=false&type=publishedArtifacts

and the log is

16:39:14.400 [main] INFO  (CoverChecker.java:47) Check new line of code coverage by JacocoReportParser
16:39:14.409 [main] INFO  (CoverChecker.java:53) read diff by GithubDiffReader
16:39:14.441 [Thread-2] INFO  (GithubDiffManager.java:40) get diff questdb/questdb/1029
16:39:14.706 [Thread-2] INFO  (GithubDiffReader.java:59) get file core/src/main/java/io/questdb/cutlass/line/tcp/LineTcpMeasurementScheduler.java
16:39:14.714 [Thread-2] INFO  (DiffMapper.java:56) parse diff / Optional[core/src/main/java/io/questdb/cutlass/line/tcp/LineTcpMeasurementScheduler.java]
16:39:14.720 [Thread-2] INFO  (GithubDiffReader.java:59) get file core/src/test/java/io/questdb/cutlass/line/tcp/LineTcpConnectionContextTest.java
16:39:14.720 [Thread-2] INFO  (DiffMapper.java:56) parse diff / Optional[core/src/test/java/io/questdb/cutlass/line/tcp/LineTcpConnectionContextTest.java]
16:39:14.721 [Thread-2] INFO  (GithubDiffReader.java:59) get file core/src/test/java/io/questdb/cutlass/line/tcp/LineTcpServerTest.java
16:39:14.723 [Thread-2] INFO  (DiffMapper.java:56) parse diff / Optional[core/src/test/java/io/questdb/cutlass/line/tcp/LineTcpServerTest.java]
16:39:14.750 [main] INFO  (ConsoleReporter.java:28) coverage check result
16:39:14.757 [main] INFO  (ConsoleReporter.java:30) 0/0 100
16:39:17.051 [main] INFO  (CoverChecker.java:61) check result pass

https://dev.azure.com/questdb/questdb/_build/results?buildId=1197&view=logs&j=55742375-e338-54e5-b4e4-08a24a4c7b3d&t=8306d4b1-7a02-5def-a13e-6cf8bb46e3ff

Would be good to find out what this is, maybe a known limitation of some sort.

OpenCppCoverage의 cobertura 리포트 사용 시 커버리지 측정 문제

안녕하세요 : )
1.4.1 버전을 릴리즈 해주셔서 감사합니다!

1.4.1 버전으로 #24 이슈를 다시 테스트 해보았는데요.
제가 테스트 한 환경은 이전과 같게 Windows에서 OpenCppCoverage를 사용해서 cobertura 형식의 Report 파일을 산출하였습니다.
해당 케이스에서 이전처럼 Exception이 발생하지는 않지만, 커버리지가 항상 0% 로 측정되는 문제가 있는 것 같습니다.

출력 로그

아래는 실행 시 출력 로그입니다.
BufferMgr.cpp 와 CoreMain.cpp 에서 여러 코드를 수정했지만, 수정한 코드 라인이 0으로 출력되고 있습니다.

18:42:56.200 [main] INFO  (CoverChecker.java:47) Check new line of code coverage by XmlCoverageReportParser
18:42:56.216 [main] INFO  (CoverChecker.java:53) read diff by GithubDiffReader
18:42:56.232 [ForkJoinPool.commonPool-worker-5] INFO  (GithubDiffManager.java:40) get diff video-tech1/P2PCore/338
18:42:56.299 [ForkJoinPool.commonPool-worker-5] INFO  (GithubDiffReader.java:59) get file src/core/BufferMgr.cpp
18:42:56.299 [ForkJoinPool.commonPool-worker-5] INFO  (DiffMapper.java:53) parse diff / Optional[src/core/BufferMgr.cpp]
18:42:56.314 [ForkJoinPool.commonPool-worker-5] INFO  (GithubDiffReader.java:59) get file src/core/CoreMain.cpp
18:42:56.314 [ForkJoinPool.commonPool-worker-5] INFO  (DiffMapper.java:53) parse diff / Optional[src/core/CoreMain.cpp]
18:42:56.346 [main] INFO  (ConsoleReporter.java:28) coverage check result
18:42:56.346 [main] INFO  (ConsoleReporter.java:30) 0/0 100
18:42:57.507 [main] INFO  (CoverChecker.java:61) check result pass

OpenCppCoverage 로 산출 된 cobertura 포멧

아래는 OpenCppCoverage 으로 산출 된 cobertura 포멧의 일부입니다.
일부 내용은 보안을 위해 삭제하였습니다.
UnitTestCoverage_sample.zip

Jenkins cobertura plugin 스크린샷

위 xml 을 사용해서 Jenkins cobertura plugin과 연동 하였을 때, 커버리지가 정상적으로 노출됩니다.

  • image
  • image

시간 되실 때 한번 검토 부탁드리겠습니다.
항상 감사드립니다 : ) 👍

Diff coverage is not correct

The result of coverage check is always 0/0 (0%) even if the pull request has made some modification and some lines are not covered by tests.

What I Did:

java -jar target/coverchecker-1.3.3-jar-with-dependencies.jar -c /home/eungjun/mysrc/diff-cov-sample/build/reports/jacoco/test/jacocoTestReport.xml -r eungjun-yi/diff-cov-sample -p 4 -g <my-personal-access-token> -t 1

What I Expected:

1/2 (50.0%)

Actual Result:
image

Here is the correct report by codecov on the pull request.

image

Parse exception converting JSON to object

 java -jar cover-checker-console-1.4.0-jar-with-dependencies.jar \
    --cover /api/target/site/jacoco/jacoco.xml \
    --github-token ${token} \
    --repo GabrielBB/** \
    --threshold 80 \
    --github-url github.com \
    --pr 1 \
    -type jacoco
Exception in thread "main" java.lang.IllegalStateException: java.io.IOException: Parse exception converting JSON to object
        at com.naver.nid.cover.github.manager.GithubPullRequestManager.<init>(GithubPullRequestManager.java:52)
        at com.naver.nid.cover.github.manager.GithubPullRequestManager.<init>(GithubPullRequestManager.java:38)
        at com.naver.nid.cover.util.ObjectFactory.getPrManager(ObjectFactory.java:71)
        at com.naver.nid.cover.util.ObjectFactory.getDiffReader(ObjectFactory.java:46)
        at com.naver.nid.cover.Launcher.main(Launcher.java:15)
Caused by: java.io.IOException: Parse exception converting JSON to object
        at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:478)
        at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:457)
        at org.eclipse.egit.github.core.client.GitHubClient.parseError(GitHubClient.java:568)
        at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:601)
        at org.eclipse.egit.github.core.client.GitHubClient.get(GitHubClient.java:799)
        at org.eclipse.egit.github.core.service.PullRequestService.getPullRequest(PullRequestService.java:115)
        at com.naver.nid.cover.github.manager.GithubPullRequestManager.<init>(GithubPullRequestManager.java:50)
        ... 4 more
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
        at com.google.gson.Gson.fromJson(Gson.java:927)
        at com.google.gson.Gson.fromJson(Gson.java:892)
        at org.eclipse.egit.github.core.client.GitHubClient.parseJson(GitHubClient.java:476)
        ... 10 more
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
        at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:385)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
        ... 13 more

Error Bad credentials (401) when Pull Request is from a fork repository

I noticed that the cover-checker does not work when it is set for a pull request from a forked repository. The failure is

Exception in thread "main" java.lang.IllegalStateException: org.eclipse.egit.github.core.client.RequestException: Bad credentials (401)
	at com.naver.nid.cover.github.manager.GithubPullRequestManager.<init>(GithubPullRequestManager.java:52)
	at com.naver.nid.cover.github.manager.GithubPullRequestManager.<init>(GithubPullRequestManager.java:38)
	at com.naver.nid.cover.util.ObjectFactory.getPrManager(ObjectFactory.java:71)
	at com.naver.nid.cover.util.ObjectFactory.getDiffReader(ObjectFactory.java:46)
	at com.naver.nid.cover.Launcher.main(Launcher.java:15)
Caused by: org.eclipse.egit.github.core.client.RequestException: Bad credentials (401)
	at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:606)
	at org.eclipse.egit.github.core.client.GitHubClient.get(GitHubClient.java:799)
	at org.eclipse.egit.github.core.service.PullRequestService.getPullRequest(PullRequestService.java:115)
	at com.naver.nid.cover.github.manager.GithubPullRequestManager.<init>(GithubPullRequestManager.java:50)
	... 4 more

Full log is here

https://dev.azure.com/questdb/questdb/_build/results?buildId=1357&view=logs&j=55742375-e338-54e5-b4e4-08a24a4c7b3d&t=8306d4b1-7a02-5def-a13e-6cf8bb46e3ff

This happens in all cross repo PRs:

and does not happen with PRs when branch is in the same repo as the target:

https://github.com/questdb/questdb/pulls?q=is%3Apr+is%3Aclosed

even though github token is the same in the Azure pipeline.

Would be good to have a hint of how to avoid 401 error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.