From fe1dadced6b44fce5f109bf8f919d99832ea09a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Mon, 6 Mar 2017 00:48:07 +0000 Subject: [PATCH 1/4] Fixing sonar configuration to allow running on Travis. --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 142cefdd0..483e9e1ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,10 @@ addons: - oracle-java8-set-default sonarqube: token: - secure: AmQdR1Fm0tvA9Ees1wz1RqnUl49lZrGdhWCkx7SnIzz+/1Lm2L9aH/e4bL60wIqkJ+AK8tJ1YX4L2B+i7/t5dBSH9Nj8JgbJFwHMqHdMCmaqKpvT5eJRzhbgr0kccm8ECHWTWBL+mIyXXYUm4f/tuRnnngfZS/bxtUpFUDvotcEybuuGUvKSbmc6ew5tfBuX79G/lXbFBceO6EQStoi8SeIHDkgeX/BoQQin0BFVMcsuWKPuQ5P5B19KfxubEk6tiHLZffoaF1q+RbsFcwpr4nyXHiusTRdtLmHb5DvlSQsy15qaakJP6AA073sGjnKxcGiGvP48HbC07tQmtBiZY2Ybkqj9i4aRq0hzX/VXRuZOV/rQARjItS4MKTmD9gET9XkYzc/P8VxSGRFT97guF3f6qtPzcGCu3TbFQpgeP+mgcePLvDl5j/AL+tZAAwSj3mPhEGncr5j+QkcLhl+mM5TymNeJn828qb8I7+mSdqbmPwytc//hwJLeqFJDX2GGnXZD4VkMZDvUO6gq2bQXy0hLgdI7uIQpIzIUlAGoYG6MK4SuHxnx+ZNwsW/nrMGVCJrK67Ii/R++Fg4et5QshTaTbkcQ3Deroady/pnGwlD5FR59LYpjqOVQ+4ey2bf92eGx0j0NWCz+CfirKSXd3o1hESSqamyi8KtOqkqiLEg= - + secure: ${SONAR_TOKEN} + branches: + - develop + - testing_sonar env: global: - ORACLE_COOKIE=sqldev @@ -69,7 +71,7 @@ script: # - bash .travis/build_docs.sh # - bash .travis/push_docs_to_gh_pages.sh - sonar-scanner - - bash .travis/coveralls_uploader.sh + - bash .travis/coveralls_uploader.sh deploy: provider: releases From 5b0d591ca6be49df8623d71013382bc033777789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Mon, 6 Mar 2017 01:05:28 +0000 Subject: [PATCH 2/4] Fixing sonar reporter bug that was causing sonar analysis to fail. --- source/reporters/ut_coverage_sonar_reporter.tpb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/reporters/ut_coverage_sonar_reporter.tpb b/source/reporters/ut_coverage_sonar_reporter.tpb index 4f2d4acfb..07e172950 100644 --- a/source/reporters/ut_coverage_sonar_reporter.tpb +++ b/source/reporters/ut_coverage_sonar_reporter.tpb @@ -84,7 +84,7 @@ create or replace type body ut_coverage_sonar_reporter is function get_lines_xml(a_unit_coverage ut_coverage.t_unit_coverage) return clob is l_file_part varchar2(32767); l_result clob; - c_no_lines constant varchar2(30) := ''||chr(10); + c_no_lines constant varchar2(100) := ''||chr(10); l_line_no binary_integer; begin dbms_lob.createtemporary(l_result, true); From a0e14c920bd2468f003f4c893dd40730f2984345 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Mon, 6 Mar 2017 02:00:35 +0000 Subject: [PATCH 3/4] Adding language and file suffixes for sonar. --- sonar-project.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonar-project.properties b/sonar-project.properties index 008c385f8..dfee285bb 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -14,6 +14,8 @@ sonar.links.issue=https://github.com/utPLSQL/utPLSQL/issues sonar.links.ci=https://travis-ci.org/utPLSQL/utPLSQL sonar.links.homepage=https://github.com/utPLSQL/utPLSQL sonar.projectDescription=PL/SQL Unit Testing Framework +sonar.plsql.file.suffixes=sql,tab,pkb,tpb +sonar.language=plsql # Encoding of the source code. Default is default system encoding #sonar.sourceEncoding=UTF-8 From c2b670c57ccb859b4f228e5ef37b3a017cf6f434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacek=20G=C4=99bal?= Date: Mon, 6 Mar 2017 02:20:41 +0000 Subject: [PATCH 4/4] Updated coveralls and sonar reporters to report on files uncovered as 100% uncovered. --- source/reporters/ut_coverage_sonar_reporter.tpb | 6 ++++-- source/reporters/ut_coveralls_reporter.tpb | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/reporters/ut_coverage_sonar_reporter.tpb b/source/reporters/ut_coverage_sonar_reporter.tpb index 07e172950..2b9f2975f 100644 --- a/source/reporters/ut_coverage_sonar_reporter.tpb +++ b/source/reporters/ut_coverage_sonar_reporter.tpb @@ -84,13 +84,15 @@ create or replace type body ut_coverage_sonar_reporter is function get_lines_xml(a_unit_coverage ut_coverage.t_unit_coverage) return clob is l_file_part varchar2(32767); l_result clob; - c_no_lines constant varchar2(100) := ''||chr(10); l_line_no binary_integer; begin dbms_lob.createtemporary(l_result, true); l_line_no := a_unit_coverage.lines.first; if l_line_no is null then - dbms_lob.writeappend(l_result, length(c_no_lines), c_no_lines); + for i in 1 .. a_unit_coverage.total_lines loop + l_file_part := ''||chr(10); + dbms_lob.writeappend(l_result, length(l_file_part), l_file_part); + end loop; else while l_line_no is not null loop l_file_part := diff --git a/source/reporters/ut_coveralls_reporter.tpb b/source/reporters/ut_coveralls_reporter.tpb index cb71b6410..7972b62d1 100644 --- a/source/reporters/ut_coveralls_reporter.tpb +++ b/source/reporters/ut_coveralls_reporter.tpb @@ -93,7 +93,13 @@ create or replace type body ut_coveralls_reporter is dbms_lob.writeappend(l_result, length(c_coverage_header), c_coverage_header); l_last_line_no := a_unit_coverage.lines.last; - if l_last_line_no is not null then + if l_last_line_no is null then + l_last_line_no := a_unit_coverage.total_lines - 1; + for i in 1 .. l_last_line_no loop + dbms_lob.writeappend(l_result, 2, '0,'); + end loop; + dbms_lob.writeappend(l_result, 1, '0'); + else for line_no in 1 .. l_last_line_no loop l_file_part := case