-
Notifications
You must be signed in to change notification settings - Fork 246
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
Report download #235
Open
pmcelhaney
wants to merge
3
commits into
squizlabs:master
Choose a base branch
from
pmcelhaney:report-download
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Report download #235
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,45 @@ | |
* | ||
*/ | ||
|
||
|
||
/** | ||
* Runs the sniffs and downloads the results to a text file | ||
* | ||
*/ | ||
_global.downloadHTMLCS = function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be part of the HTMLCS object. |
||
|
||
function q(s) { | ||
return '"' + (s || "").toString().replace(/"/g, '""') + '"'; | ||
} | ||
|
||
function elementToString(element) { | ||
if(!element) { | ||
return ""; | ||
} | ||
var html = element.outerHTML; | ||
if (!html) { | ||
return ""; | ||
} | ||
if (html.length > 100) { | ||
return html.substring(0, 100) + "..."; | ||
} | ||
return html; | ||
} | ||
|
||
HTMLCS.run(function() { | ||
|
||
var header = '"Type", Code","Message","Element","Data"'; | ||
var body = this.getMessages().map(function (m) { | ||
return [m.type, q(m.code), q(m.msg), q(elementToString(m.element)), q(m.data)].join(",") | ||
}).join("\n"); | ||
var csvContents = header + "\n" + body; | ||
|
||
var filename = "HTML_Codesniffer" + Math.random() + ".csv"; | ||
|
||
saveAs(new Blob([csvContents], { type: "text/plain;charset=utf-8" }), filename); | ||
}) | ||
} | ||
|
||
_global.HTMLCS = new function() | ||
{ | ||
var _standards = {}; | ||
|
@@ -22,8 +61,9 @@ _global.HTMLCS = new function() | |
var _messages = []; | ||
var _msgOverrides = {}; | ||
|
||
|
||
/* | ||
Message type constants. | ||
Message type constants. | ||
*/ | ||
this.ERROR = 1; | ||
this.WARNING = 2; | ||
|
@@ -243,6 +283,7 @@ _global.HTMLCS = new function() | |
* @returns {Array} Array of message objects. | ||
*/ | ||
this.getMessages = function() { | ||
|
||
return _messages.concat([]); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ _global.translation['en'] = { | |
,"auditor_select_types" : 'Select the types of issues to include in the report' | ||
,"auditor_home" : 'Home' | ||
,"auditor_view_report" : 'View Report' | ||
,"auditor_download_report": 'Download Report' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can go. I ended up making the label "CSV" which is language-independent. |
||
,"auditor_report" : 'Report' | ||
,"auditor_back_to_report" : 'Back to Report' | ||
,"auditor_previous_issue" : 'Previous Issue' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This whole section needs to be deleted.