Skip to content

Commit

Permalink
Improve HTML report css (#4447)
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierSegoviaCordoba committed Jan 3, 2022
1 parent 3850d34 commit 4f8761f
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 121 deletions.
205 changes: 145 additions & 60 deletions detekt-report-html/src/main/resources/default-html-report-template.html
@@ -1,72 +1,157 @@
<!DOCTYPE html>
<html lang="en">
<head>
<style>
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');
</style>
<meta charset="utf-8">
<title>detekt report</title>
<style>
h2 {
background-color: #666666;
padding: 0.2em;
color: #ffffff;
}
h3 {
background-color:#f8dfdf;
padding:0.5em;
}
.rule {
background-color: #dddddd;
padding: 0.3em;
font-weight: bold;
}
.description {
color:#000000;
padding:0.3em;
}
.location {
color: #690505;
font-family: monospace;
display: block;
}
.message {
font-size: 0.8em;
color: #444444;
display: block;
margin-top: 1pt;
}
.rule-container {
border: 0.1em dashed #dddddd;
padding: 0.1em;
line-height: 1.5em;
margin-bottom: 8px;
margin-top: 8px;
}
pre {
border: 1px solid #e0e0e0;
overflow: scroll;
}
.lineno {
color: #999999;
background-color: #f0f0f0;
}
.error {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AwCFR4T/3uLMgAAADxJREFUCNdNyLERQEAABMCjL4lQwIzcjErpguAL+C9AvgKJDbeD/PRpLdm35Hm+MU+cB+tCKaJW4L4YBy+CAiLJrFs9mgAAAABJRU5ErkJggg==) bottom repeat-x;
}
.exception {
color: #b60808;
display: inline-block;
background-color: #ecdada;
border-color: #b60808;
border-radius: 10px;
border: solid 2px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 16px;
}
</style>

body {
font-family: Arial, sans-serif;
font-weight: 400;
}

h1 {
font-family: Arial, sans-serif;
font-weight: 600;
width: fit-content;
background: -webkit-linear-gradient(left, rgba(105, 33, 224, 1), rgba(247, 44, 67, 1));
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}

h2 {
font-family: Arial, sans-serif;
font-weight: 400;
background: rgb(105, 33, 224);
background: linear-gradient(90deg, rgba(105, 33, 224, 0.8) 0%, rgba(158, 41, 156, 0.8) 50%, rgba(247, 44, 67, 0.8) 100%);
padding: 0.2em;
color: #ffffff;
border-radius: 4px;
}

h3 {
font-family: Arial, sans-serif;
background: linear-gradient(90deg, rgba(105, 33, 224, 0.4) 0%, rgba(158, 41, 156, 0.4) 50%, rgba(247, 44, 67, 0.4) 100%);
padding: 0.5em;
border-radius: 4px;
}

.rule-container {
background: linear-gradient(90deg, rgba(105, 33, 224, 0.2) 0%, rgba(158, 41, 156, 0.2) 100%);
border-radius: 4px;
padding-left: 1em;
padding-bottom: 0.3em;
padding-top: 0.3em;
padding-right: 1em;
line-height: 1.5em;
margin-bottom: 8px;
margin-top: 8px;
}

.rule {
font-family: Arial, sans-serif;
padding: 0.3em;
font-weight: 600;
border-radius: 3px;
}

.description {
font-family: Arial, sans-serif;
color: #000000;
padding: 0.3em;
}

.location {
font-family: Jetbrains Mono, monospace;
font-weight: 500;
color: #000000;
display: block;
}

.message {
font-family: Arial, sans-serif;
font-size: 0.8em;
color: #444444;
display: block;
margin-top: 1pt;
}

code {
font-family: JetBrains Mono, monospace;
font-weight: 400;
}

pre {
font-family: JetBrains Mono, monospace;
font-weight: 500;
border: 1px solid #e0e0e0;
overflow: auto;
}

.lineno {
margin-right: 24px;
color: #9771c3;
background-color: rgba(230, 211, 243, 0.51);
}

.error {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AwCFR4T/3uLMgAAADxJREFUCNdNyLERQEAABMCjL4lQwIzcjErpguAL+C9AvgKJDbeD/PRpLdm35Hm+MU+cB+tCKaJW4L4YBy+CAiLJrFs9mgAAAABJRU5ErkJggg==) bottom repeat-x;
}

.exception {
color: #b60808;
display: inline-block;
background-color: #ecdada;
border-color: #b60808;
border-radius: 10px;
border: solid 2px;
padding-left: 16px;
padding-right: 16px;
margin-bottom: 16px;
}
</style>
</head>
<body>

<h1>detekt report</h1>
<svg xmlns="http://www.w3.org/2000/svg" width="225" height="53" viewBox="0 0 225 53" fill="none"
style="padding-top: 8px">
<path d="M88.8883 42.2665V7.99487H81.6954V20.389C79.9918 18.3703 77.6257 16.6332 73.7926 16.6332C67.7828 16.6332 62.2461 21.2341 62.2461 29.6377V29.7316C62.2461 38.1352 67.8774 42.736 73.7926 42.736C77.5311 42.736 79.9445 40.9989 81.6954 38.6516V42.2665H88.8883ZM81.79 29.7316C81.79 33.9099 78.998 36.6798 75.6382 36.6798C72.2783 36.6798 69.439 33.9099 69.439 29.7316V29.6377C69.439 25.4124 72.2783 22.6894 75.6382 22.6894C78.998 22.6894 81.79 25.4593 81.79 29.6377V29.7316Z"
fill="#222222"/>
<path d="M120.325 30.3888V30.2949C120.325 23.1589 116.444 16.6332 107.974 16.6332C100.591 16.6332 95.4334 22.5486 95.4334 29.7316V29.8254C95.4334 37.5248 101.065 42.8299 108.683 42.8299C113.274 42.8299 116.681 41.0459 119.047 38.1352L114.93 34.5202C112.942 36.3511 111.192 37.1023 108.778 37.1023C105.56 37.1023 103.289 35.4122 102.579 32.1728H120.23C120.277 31.5156 120.325 31.093 120.325 30.3888ZM113.321 27.7128H102.484C103.052 24.4734 104.992 22.3608 107.974 22.3608C111.002 22.3608 112.895 24.5204 113.321 27.7128Z"
fill="#222222"/>
<path d="M141.278 41.2337V35.5061C140.237 36.0695 139.054 36.3981 137.729 36.3981C136.12 36.3981 135.41 35.6 135.41 33.9568V23.2059H141.373V17.1027H135.41V10.6709H128.217V17.1027H125.189V23.2059H128.217V35.1305C128.217 40.952 131.199 42.6891 135.599 42.6891C138.013 42.6891 139.764 42.1257 141.278 41.2337Z"
fill="#222222"/>
<path d="M172.008 30.3888V30.2949C172.008 23.1589 168.128 16.6332 159.657 16.6332C152.275 16.6332 147.117 22.5486 147.117 29.7316V29.8254C147.117 37.5248 152.748 42.8299 160.367 42.8299C164.958 42.8299 168.365 41.0459 170.731 38.1352L166.614 34.5202C164.626 36.3511 162.875 37.1023 160.462 37.1023C157.244 37.1023 154.973 35.4122 154.263 32.1728H171.914C171.961 31.5156 172.008 31.093 172.008 30.3888ZM165.005 27.7128H154.168C154.736 24.4734 156.676 22.3608 159.657 22.3608C162.686 22.3608 164.579 24.5204 165.005 27.7128Z"
fill="#222222"/>
<path d="M203.278 42.2665L193.293 27.0086L202.947 17.1027H194.334L185.911 26.2574V7.99487H178.718V42.2665H185.911V34.6141L188.419 31.985L195.044 42.2665H203.278Z"
fill="#222222"/>
<path d="M224.905 41.2337V35.5061C223.864 36.0695 222.681 36.3981 221.356 36.3981C219.747 36.3981 219.037 35.6 219.037 33.9568V23.2059H225V17.1027H219.037V10.6709H211.844V17.1027H208.816V23.2059H211.844V35.1305C211.844 40.952 214.826 42.6891 219.227 42.6891C221.64 42.6891 223.391 42.1257 224.905 41.2337Z"
fill="#222222"/>
<path fill-rule="evenodd" clip-rule="evenodd"
d="M2.18611 0C0.978755 0 0 0.978755 0 2.18611V40.771C0 41.9783 0.978755 42.9571 2.18611 42.9571H24.2534C25.6525 42.9571 26.6258 41.5473 26.3774 40.1705C26.2109 39.2481 26.124 38.2981 26.124 37.3279C26.124 28.5443 33.2445 21.4239 42.028 21.4239C42.8689 21.4239 43.6945 21.4892 44.5001 21.6149C45.8578 21.8268 47.22 20.8585 47.22 19.4844V2.18611C47.22 0.978755 46.2412 0 45.0339 0H2.18611Z"
fill="url(#paint0_linear)"/>
<path d="M55.3358 48.6166L54.7673 48.0481L53.2421 46.5229L52.9516 46.2324C52.2427 45.5234 52.1855 44.4067 52.673 43.5306C53.6299 41.8109 54.1762 39.833 54.1762 37.7293C54.1762 32.9104 51.3147 28.7499 47.2029 26.8501C46.5196 26.5344 45.8024 26.2808 45.0573 26.0974C44.3636 25.9268 43.6467 25.8164 42.9118 25.7727C42.6749 25.7587 42.4369 25.7495 42.1966 25.7495C38.5166 25.7495 35.2203 27.4188 33.0211 30.0381C31.9784 31.2802 31.1838 32.7357 30.7114 34.3293C30.3916 35.4079 30.217 36.5481 30.217 37.7291C30.217 38.0293 30.2319 38.3259 30.2537 38.6205C30.3082 39.3559 30.4265 40.0733 30.6082 40.766C30.8038 41.5117 31.0689 42.2296 31.3974 42.9116C33.3332 46.9295 37.4465 49.7089 42.1967 49.7089C43.957 49.7089 45.6291 49.3259 47.1357 48.6403C47.9841 48.2543 49.0046 48.3536 49.6636 49.0127L50.0894 49.4385L51.6301 50.9794L52.3016 51.6509C52.7205 52.0699 53.2697 52.2794 53.8186 52.2794C54.3677 52.2794 54.9169 52.0699 55.3357 51.6509C56.1738 50.8129 56.1738 49.4544 55.3358 48.6166ZM42.1967 45.418C39.9525 45.418 37.93 44.451 36.5232 42.9122C35.9485 42.2836 35.4772 41.5594 35.135 40.7667C34.845 40.0954 34.6493 39.3746 34.5617 38.6211C34.5277 38.3283 34.5084 38.0314 34.5084 37.7297C34.5084 33.4903 37.9574 30.0413 42.1968 30.0413C42.4379 30.0413 42.6762 30.0539 42.912 30.0756C43.6638 30.1455 44.3837 30.3242 45.0576 30.5956C45.8458 30.9127 46.5689 31.3564 47.2031 31.902C48.8434 33.3131 49.8852 35.4015 49.8852 37.7297C49.885 41.9688 46.4361 45.418 42.1967 45.418Z"
fill="url(#paint1_linear)"/>
<path d="M9.9936 25.6979C9.34217 25.6979 8.84618 25.4958 8.50566 25.0914C8.16514 24.6709 7.99487 24.1695 7.99487 23.5873V23.4903C7.99487 22.908 8.16514 22.4147 8.50566 22.0104C8.84618 21.5899 9.34217 21.3796 9.9936 21.3796C10.645 21.3796 11.141 21.5899 11.4815 22.0104C11.8221 22.4147 11.9923 22.908 11.9923 23.4903V23.5873C11.9923 24.1695 11.8221 24.6709 11.4815 25.0914C11.141 25.4958 10.645 25.6979 9.9936 25.6979ZM8.17254 10.8158V7.99487H11.8147V10.8158L10.6598 19.1612H9.32736L8.17254 10.8158Z"
fill="white"/>
<path d="M20.2729 25.6979C19.6215 25.6979 19.1255 25.4958 18.785 25.0914C18.4444 24.6709 18.2742 24.1695 18.2742 23.5873V23.4903C18.2742 22.908 18.4444 22.4147 18.785 22.0104C19.1255 21.5899 19.6215 21.3796 20.2729 21.3796C20.9243 21.3796 21.4203 21.5899 21.7608 22.0104C22.1014 22.4147 22.2716 22.908 22.2716 23.4903V23.5873C22.2716 24.1695 22.1014 24.6709 21.7608 25.0914C21.4203 25.4958 20.9243 25.6979 20.2729 25.6979ZM18.4518 10.8158V7.99487H22.094V10.8158L20.9391 19.1612H19.6067L18.4518 10.8158Z"
fill="white"/>
<defs>
<linearGradient id="paint0_linear" x1="5.222e-07" y1="41.3361" x2="51.982" y2="33.29"
gradientUnits="userSpaceOnUse">
<stop stop-color="#7942EE"/>
<stop offset="1" stop-color="#FF4651"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="53.0121" y1="51.5465" x2="60.9801" y2="30.2423"
gradientUnits="userSpaceOnUse">
<stop stop-color="#7942EE"/>
<stop offset="1" stop-color="#FF4651"/>
</linearGradient>
</defs>
</svg>

<h2>Metrics</h2>

Expand Down
Expand Up @@ -38,7 +38,6 @@ class HtmlOutputReportSpec : Spek({
assertThat(result).startsWith("<!DOCTYPE html>\n<html lang=\"en\">")
assertThat(result).endsWith("</html>\n")

assertThat(result).contains("<h1>detekt report</h1>")
assertThat(result).contains("<h2>Metrics</h2>")
assertThat(result).contains("<h2>Complexity Report</h2>")
assertThat(result).contains("<h2>Findings</h2>")
Expand Down

0 comments on commit 4f8761f

Please sign in to comment.