-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Implement XML-based reports #713
Conversation
@@ -0,0 +1,91 @@ | |||
# Hand-written stub for lxml.etree as used by mypy.report. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that your str
annotations could (should?) be AnyStr
.
Changed That reminds me, Also implemented |
travis says: This is a bug in other parts of mypy, since this code should be okay: |
8f52f35
to
7baba51
Compare
@spkersten Okay, I've figured out that we don't wany |
79f6dc3
to
e61e781
Compare
Ah, I didn't realize there were two copies of |
e84e4f2
to
124a4b5
Compare
I'll look at this now that the test driver PR was merged. |
I rebased and pushed the PR, after having tweaked the CSS a little further. I find XSLT painful to use and most contributors won't be familiar with it (see https://www.google.com/trends/explore#q=xslt), so I'd like to get rid of it eventually, but we can live with it for a while (I created an issue for it: #909, but it's not really urgent). |
This implements a new reporting framework and uses it to implement XML reports using
lxml
. The old HTML report is still available using--old-html-report <dir>
.The new reports implement
--xml-report <dir>
and--xslt-html-report <dir>
, and makes--html-report <dir>
an alias for the latter. It is anticipated that--xslt-txt-report <dir>
could be written, and also that a 3rd party might write their own XSLT file that combinesmypy
's report withcoverage
's report in a single HTML document.The XML report embeds a reference to the XSLT document, so it can be viewed directly in most browsers. However, WebKit-based browsers (such as Google Chrome) have a bug that prevents this from working on
file:
URLs. For this and text-based browsers, the XSLT-based html report internally performs the transforms, and also rewrites the extension of the links from.xml
to.html
. An improved external CSS stlylesheet is used regardless of who does the XSLT step.A single XML document is constructed in memory (potentially useful directly for unit tests, though this patch doesn't include any) if any of the new transformations are requested, and written or translated during output. If none of the new reports are requested,
lxml
does not need to be installed.A very minimal stub for
lxml.etree
is included at top-level. It should probably go somewhere else, but there is no precedent for a non-standard-library stub.While writing this, I noticed that it would be useful to use python3.4's
enum
(which is backported asenum34
). This likely requires special support because it uses a metaclass to do weird stuff.This PR includes the commits from #711 since it should be merged ASAP, and also some fixes to
stubgen
that could be refactored into a separate PR since I didn't end up using them because they ended up crashing mypy once I started specifying some of the arguments it couldn't detect.