Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30dc6f8

Browse files
committed
Adding validation to html doc and fixing some minor issues around html reporter
1 parent 004b14c commit 30dc6f8

3 files changed

Lines changed: 28 additions & 3 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ before_script:
9797

9898
script:
9999
- if [[ ! $TRAVIS_TAG ]]; then bash test/install_and_run_tests.sh; fi
100+
- if [[ ! $TRAVIS_TAG ]]; then bash .travis/validate_report_files.sh
100101
- if [[ ! $TRAVIS_TAG ]] && [ "${TRAVIS_REPO_SLUG}" = "${UTPLSQL_REPO}" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then sonar-scanner; fi
101102
- if [[ ! $TRAVIS_TAG ]]; then bash .travis/coveralls_uploader.sh; fi
102103
- bash .travis/build_docs.sh

.travis/validate_report_files.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
3+
echo "validate html"
4+
5+
HTML_FILENAME="coverage.html"
6+
#Exclude existing issue with OL nested in PRE
7+
EXCLUSION_REGEX=".*Element\s.?ol.?\snot\sallowed\sas\schild\sof\selement\s.?pre.*"
8+
HTML_VALIDATOR_URL="https://validator.w3.org/nu/"
9+
VALIDATOR_OUT="gnu"
10+
WARNING_REGEX="info warning:"
11+
ERROR_REGEX="error:"
12+
13+
VALIDATION_RESULTS=$(curl -H "Content-Type: text/html; charset=utf-8" --data-binary @$HTML_FILENAME "$HTML_VALIDATOR_URL?out=$VALIDATOR_OUT&filterpattern=$EXCLUSION_REGEX")
14+
15+
ERROR_COUNT=`echo $VALIDATION_RESULTS | grep -c "$ERROR_REGEX"`
16+
WARNING_COUNT=`echo $VALIDATION_RESULTS | grep -c "$WARNING_REGEX"`
17+
18+
echo "There are $ERROR_COUNT errors, $WARNING_COUNT warning in $HTML_FILENAME"
19+
20+
if [ $ERROR_COUNT -gt 0 ]; then
21+
exit 1
22+
else
23+
exit 0
24+
fi

source/reporters/ut_coverage_report_html_helper.pkb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ function get_details_file_content(a_object_id varchar2, a_unit ut_object_name, a
241241
'<span class="' ||line_hits_css_class(executions_per_line(a_coverage.executions
242242
,a_coverage.uncovered_lines + a_coverage.covered_lines)) || '">' ||
243243
executions_per_line(a_coverage.executions, a_coverage.uncovered_lines + a_coverage.covered_lines)
244-
|| '</span></span> hits/line)</h2>' || '<a name="' || l_id || '"></a>' || '<div><b>' ||
244+
|| '</span></span> hits/line)</h2>' || '<a id="a_' || l_id || '"></a>' || '<div><b>' ||
245245
a_coverage.objects.count || '</b> files in total. </div><div>' || '<b>' ||
246246
(a_coverage.uncovered_lines + a_coverage.covered_lines)
247247
|| '</b> relevant lines. ' || '<span class="green"><b>' || a_coverage.covered_lines ||
@@ -306,9 +306,9 @@ function get_details_file_content(a_object_id varchar2, a_unit ut_object_name, a
306306
--TODO - build main file containing total run data and per schema data
307307
l_file_part := '<!DOCTYPE html><html xmlns=''http://www.w3.org/1999/xhtml''><head>' || '<title>' || l_title ||
308308
'</title>' || '<meta http-equiv="content-type" content="text/html; charset=utf-8" />' ||
309-
'<script src=''' || a_assets_path || 'application.js'' type=''text/javascript''></script>' ||
309+
'<script src=''' || a_assets_path || 'application.js''></script>' ||
310310
'<link href=''' || a_assets_path ||
311-
'application.css'' media=''screen, projection, print'' rel=''stylesheet'' type=''text/css''/>' ||
311+
'application.css'' media=''screen, print'' rel=''stylesheet'' type=''text/css''/>' ||
312312
'<link rel="shortcut icon" type="image/png" href="' || a_assets_path || 'favicon_' ||
313313
coverage_css_class(l_coverage_pct) || '.png" />' || '<link rel="icon" type="image/png" href="' ||
314314
a_assets_path || 'favicon_' || coverage_css_class(l_coverage_pct) || '.png" />' || '</head>' ||

0 commit comments

Comments
 (0)