Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI updates #2098

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions a.xaml/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml-stylesheet type="text/xsl" href="mypy-html.xslt"?><mypy-report-index name="index"><file module="project" name="example-project/project/__init__.py" total="14" any="2" empty="9" imprecise="0" precise="3" unanalyzed="0"/></mypy-report-index>
116 changes: 116 additions & 0 deletions a.xaml/mypy-html.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* CSS for type check coverage reports */

/*
Used by both summary and file.
*/
body {
font-family: 'Helvetica Neue', sans-serif;
}

/*
Used only by summary.
*/

h1 {
text-align: center;
font-size: 135%;
margin: 20px;
}

table.summary {
border-collapse: collapse;
margin-left: 7%;
margin-right: 7%;
width: 85%;
}

table caption {
margin: 1em;
}

table.summary,
tr.summary,
th.summary,
td.summary {
border: 1px solid #aaa;
}

th.summary,
td.summary {
padding: 0.4em;
}

td.summary a {
text-decoration: none;
}

.summary-quality-0 {
background-color: #dfd;
}

.summary-quality-1 {
background-color: #ffa;
}

.summary-quality-2 {
background-color: #faa;
}

td.summary-filename,
th.summary-filename {
text-align: left;
}

td.summary-filename {
width: 50%;
}

.summary-precision {
text-align: center;
}

.summary-lines {
text-align: center;
}

/*
Used only by file.
*/

td.table-lines {
text-align: right;
padding-right: 0.5em;
}

td.table-code {
}

span.lineno {
text-align: right;
}

a:link.lineno,
a:visited.lineno {
color: #999;
text-decoration: none;
}

a:hover.lineno,
a:active.lineno {
color: #000;
text-decoration: underline;
}

.line-empty,
.line-precise {
background-color: #dfd;
}

.line-imprecise {
background-color: #ffa;
}

.line-any,
.line-unanalyzed {
background-color: #faa;
}
81 changes: 81 additions & 0 deletions a.xaml/mypy-html.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- vim: set sts=2 sw=2: -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="ext" select="'xml'"/>
<xsl:output method="html"/>
<xsl:variable name="xml_stylesheet_pi" select="string(//processing-instruction('xml-stylesheet'))"/>
<xsl:variable name="stylesheet_name" select="substring($xml_stylesheet_pi, 23, string-length($xml_stylesheet_pi) - 28)"/>
<xsl:template match="/mypy-report-index">
<html>
<head>
<link rel="stylesheet" type="text/css" href="{$stylesheet_name}.css"/>
</head>
<body>
<h1>Mypy Type Check Coverage Summary</h1>
<table class="summary">
<caption>Summary from <xsl:value-of select="@name"/></caption>
<thead>
<tr class="summary">
<th class="summary">File</th>
<th class="summary">Imprecision</th>
<th class="summary">Lines</th>
</tr>
</thead>
<tfoot>
<xsl:variable name="bad_lines" select="sum(file/@imprecise|file/@any)"/>
<xsl:variable name="total_lines" select="sum(file/@total)"/>
<xsl:variable name="global_score" select="$bad_lines div ($total_lines + not(number($total_lines)))"/>
<xsl:variable name="global_quality" select="string(number(number($global_score) &gt; 0.00) + number(number($global_score) &gt;= 0.20))"/>
<tr class="summary summary-quality-{$global_quality}">
<th class="summary summary-filename">Total</th>
<th class="summary summary-precision"><xsl:value-of select="format-number($global_score, '0.00%')"/> imprecise</th>
<th class="summary summary-lines"><xsl:value-of select="$total_lines"/> LOC</th>
</tr>
</tfoot>
<tbody>
<xsl:for-each select="file">
<xsl:variable name="local_score" select="(@imprecise + @any) div (@total + not(number(@total)))"/>
<xsl:variable name="local_quality" select="string(number(number($local_score) &gt; 0.00) + number(number($local_score) &gt;= 0.20))"/>
<tr class="summary summary-quality-{$local_quality}">
<td class="summary summary-filename"><a href="{$ext}/{@name}.{$ext}"><xsl:value-of select="@module"/></a></td>
<td class="summary summary-precision"><xsl:value-of select="format-number($local_score, '0.00%')"/> imprecise</td>
<td class="summary summary-lines"><xsl:value-of select="@total"/> LOC</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="/mypy-report-file">
<html>
<head>
<link rel="stylesheet" type="text/css" href="{$stylesheet_name}.css"/>
</head>
<body>
<h2><xsl:value-of select="@module"/></h2>
<table>
<caption><xsl:value-of select="@name"/></caption>
<tbody>
<tr>
<td class="table-lines">
<pre>
<xsl:for-each select="line">
<span id="L{@number}" class="lineno"><a class="lineno" href="#L{@number}"><xsl:value-of select="@number"/></a></span><xsl:text>&#10;</xsl:text>
</xsl:for-each>
</pre>
</td>
<td class="table-code">
<pre>
<xsl:for-each select="line">
<span class="line-{@precision}" title="{@any_info}"><xsl:value-of select="@content"/></span><xsl:text>&#10;</xsl:text>
</xsl:for-each>
</pre>
</td>
</tr>
</tbody>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
16 changes: 16 additions & 0 deletions a.xaml/xml/example-project/project/__init__.py.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml-stylesheet type="text/xsl" href="../../../mypy-html.xslt"?>
<mypy-report-file name="example-project/project/__init__.py" module="project">
<line any_info="No Anys on this line!" content="&quot;&quot;&quot;" number="1" precision="empty"/>
<line any_info="No Anys on this line!" content="Example project." number="2" precision="empty"/>
<line any_info="No Anys on this line!" content="&quot;&quot;&quot;" number="3" precision="empty"/>
<line any_info="No Anys on this line!" content="" number="4" precision="empty"/>
<line any_info="No Anys on this line!" content="import abc" number="5" precision="precise"/>
<line any_info="No Anys on this line!" content="" number="6" precision="empty"/>
<line any_info="No Anys on this line!" content="" number="7" precision="empty"/>
<line any_info="No Anys on this line!" content="class Animal(abc.ABC):" number="8" precision="precise"/>
<line any_info="No Anys on this line!" content=" @abc.abstractmethod" number="9" precision="empty"/>
<line any_info="No Anys on this line!" content=" def make_sound(self):" number="10" precision="any"/>
<line any_info="No Anys on this line!" content=" pass" number="11" precision="any"/>
<line any_info="No Anys on this line!" content="" number="12" precision="empty"/>
<line any_info="No Anys on this line!" content="" number="13" precision="empty"/>
<line any_info="No Anys on this line!" content="sheep = Animal() # [abstract-class-instantiated]" number="14" precision="precise"/></mypy-report-file>
Empty file added json
Empty file.
Loading