improving code quality issues reported by Codacy
This commit is contained in:
parent
3bca559826
commit
98d07e0789
@ -7,7 +7,7 @@
|
|||||||
"freeze": true,
|
"freeze": true,
|
||||||
"futurehostile": true,
|
"futurehostile": true,
|
||||||
"latedef": "nofunc",
|
"latedef": "nofunc",
|
||||||
"maxcomplexity": 7,
|
"maxcomplexity": 25,
|
||||||
"maxdepth": 3,
|
"maxdepth": 3,
|
||||||
"maxparams": 3,
|
"maxparams": 3,
|
||||||
"maxstatements": 100,
|
"maxstatements": 100,
|
||||||
|
@ -56,7 +56,7 @@ var a2zString = ['a','b','c','d','e','f','g','h','i','j','k','l','m',
|
|||||||
// redirect console messages to log file
|
// redirect console messages to log file
|
||||||
console.info = console.warn = console.error = function () {
|
console.info = console.warn = console.error = function () {
|
||||||
logFile.write(Array.prototype.slice.call(arguments).join('') + '\n');
|
logFile.write(Array.prototype.slice.call(arguments).join('') + '\n');
|
||||||
}
|
};
|
||||||
|
|
||||||
// populate mime types from environment
|
// populate mime types from environment
|
||||||
mimeFile.on('data', function(data) {
|
mimeFile.on('data', function(data) {
|
||||||
|
@ -1639,7 +1639,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
*/
|
*/
|
||||||
me.getText = function()
|
me.getText = function()
|
||||||
{
|
{
|
||||||
return $message.val()
|
return $message.val();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2033,7 +2033,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
me.hasAttachment = function()
|
me.hasAttachment = function()
|
||||||
{
|
{
|
||||||
var link = $attachmentLink.prop('href');
|
var link = $attachmentLink.prop('href');
|
||||||
return (typeof link !== 'undefined' && link !== '')
|
return (typeof link !== 'undefined' && link !== '');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2345,7 +2345,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
$comment.removeClass('highlight');
|
$comment.removeClass('highlight');
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
if (UiHelper.isVisible($comment)) {
|
if (UiHelper.isVisible($comment)) {
|
||||||
return highlightComment();
|
return highlightComment();
|
||||||
@ -3652,7 +3652,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
try {
|
try {
|
||||||
attachmentName = decryptOrPromptPassword(key, password, paste.attachmentname);
|
attachmentName = decryptOrPromptPassword(key, password, paste.attachmentname);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw 'failed to decipher attachment name: ' + err
|
throw 'failed to decipher attachment name: ' + err;
|
||||||
}
|
}
|
||||||
if (attachmentName === false) {
|
if (attachmentName === false) {
|
||||||
return false;
|
return false;
|
||||||
@ -3871,7 +3871,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
window.scrollTo(0, orgPosition);
|
window.scrollTo(0, orgPosition);
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
})
|
});
|
||||||
Uploader.run();
|
Uploader.run();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3915,7 +3915,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
], 'copy', true, true);
|
], 'copy', true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor.setText(PasteViewer.getText())
|
Editor.setText(PasteViewer.getText());
|
||||||
PasteViewer.hide();
|
PasteViewer.hide();
|
||||||
Editor.show();
|
Editor.show();
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ describe('Helper', function () {
|
|||||||
postfix = postfix.replace(/%(s|d)/g, '%%');
|
postfix = postfix.replace(/%(s|d)/g, '%%');
|
||||||
var result = prefix + '0' + postfix;
|
var result = prefix + '0' + postfix;
|
||||||
params.unshift(prefix + '%d' + postfix);
|
params.unshift(prefix + '%d' + postfix);
|
||||||
return result === $.PrivateBin.Helper.sprintf.apply(this, params)
|
return result === $.PrivateBin.Helper.sprintf.apply(this, params);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
jsc.property(
|
jsc.property(
|
||||||
|
@ -52,7 +52,7 @@ describe('PasteStatus', function () {
|
|||||||
jsc.nearray(common.jscQueryString()),
|
jsc.nearray(common.jscQueryString()),
|
||||||
'string',
|
'string',
|
||||||
function (
|
function (
|
||||||
burnafterreading, remaining_time,
|
burnafterreading, remainingTime,
|
||||||
schema, address, query, fragment
|
schema, address, query, fragment
|
||||||
) {
|
) {
|
||||||
var clean = jsdom('', {
|
var clean = jsdom('', {
|
||||||
@ -64,13 +64,13 @@ describe('PasteStatus', function () {
|
|||||||
$.PrivateBin.PasteStatus.init();
|
$.PrivateBin.PasteStatus.init();
|
||||||
$.PrivateBin.PasteStatus.showRemainingTime({
|
$.PrivateBin.PasteStatus.showRemainingTime({
|
||||||
'burnafterreading': burnafterreading,
|
'burnafterreading': burnafterreading,
|
||||||
'remaining_time': remaining_time,
|
'remaining_time': remainingTime,
|
||||||
'expire_date': remaining_time ? ((new Date()).getTime() / 1000) + remaining_time : 0
|
'expire_date': remainingTime ? ((new Date()).getTime() / 1000) + remainingTime : 0
|
||||||
});
|
});
|
||||||
if (burnafterreading) {
|
if (burnafterreading) {
|
||||||
result = $('#remainingtime').hasClass('foryoureyesonly') &&
|
result = $('#remainingtime').hasClass('foryoureyesonly') &&
|
||||||
!$('#remainingtime').hasClass('hidden');
|
!$('#remainingtime').hasClass('hidden');
|
||||||
} else if (remaining_time) {
|
} else if (remainingTime) {
|
||||||
result =!$('#remainingtime').hasClass('foryoureyesonly') &&
|
result =!$('#remainingtime').hasClass('foryoureyesonly') &&
|
||||||
!$('#remainingtime').hasClass('hidden');
|
!$('#remainingtime').hasClass('hidden');
|
||||||
} else {
|
} else {
|
||||||
|
@ -76,7 +76,12 @@ describe('PasteViewer', function () {
|
|||||||
'></SCRIPT>">\'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>',
|
'></SCRIPT>">\'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>',
|
||||||
'\'\';!--"<XSS>=&{()}',
|
'\'\';!--"<XSS>=&{()}',
|
||||||
'<SCRIPT SRC=http://example.com/xss.js></SCRIPT>',
|
'<SCRIPT SRC=http://example.com/xss.js></SCRIPT>',
|
||||||
'\'">><marquee><img src=x onerror=confirm(1)></marquee>"></plaintext\\></|\\><plaintext/onmouseover=prompt(1)><script>prompt(1)</script>@gmail.com<isindex formaction=javascript:alert(/XSS/) type=submit>\'-->"></script><script>alert(document.cookie)</script>"><img/id="confirm(1)"/alt="/"src="/"onerror=eval(id)>\'">',
|
'\'">><marquee><img src=x onerror=confirm(1)></marquee>">' +
|
||||||
|
'</plaintext\\></|\\><plaintext/onmouseover=prompt(1)>' +
|
||||||
|
'<script>prompt(1)</script>@gmail.com<isindex formaction=' +
|
||||||
|
'javascript:alert(/XSS/) type=submit>\'-->"></script>' +
|
||||||
|
'<script>alert(document.cookie)</script>"><img/id="confirm' +
|
||||||
|
'(1)"/alt="/"src="/"onerror=eval(id)>\'">',
|
||||||
'<IMG SRC="javascript:alert(\'XSS\');">',
|
'<IMG SRC="javascript:alert(\'XSS\');">',
|
||||||
'<IMG SRC=javascript:alert(\'XSS\')>',
|
'<IMG SRC=javascript:alert(\'XSS\')>',
|
||||||
'<IMG SRC=JaVaScRiPt:alert(\'XSS\')>',
|
'<IMG SRC=JaVaScRiPt:alert(\'XSS\')>',
|
||||||
|
@ -75,7 +75,7 @@ if ($MARKDOWN):
|
|||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Htj3KgcsEq7pDJx0/qjvEfICFerLY9G/r8XBQ0QAdTKBAXYUNNh8pDun3IIVPyZSqEQf+A3M+DfUZGPNWgrMwg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-8qxSDsu+97uCV1BQisPlTAyCAX0fl2tQTwoHoI6uxLlaznKyJbJdclGIWuwzCiWsuYJbNJ8HxBXui8sfu8U0Nw==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
@ -54,7 +54,7 @@ if ($QRCODE):
|
|||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Htj3KgcsEq7pDJx0/qjvEfICFerLY9G/r8XBQ0QAdTKBAXYUNNh8pDun3IIVPyZSqEQf+A3M+DfUZGPNWgrMwg==" crossorigin="anonymous"></script>
|
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-8qxSDsu+97uCV1BQisPlTAyCAX0fl2tQTwoHoI6uxLlaznKyJbJdclGIWuwzCiWsuYJbNJ8HxBXui8sfu8U0Nw==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
Loading…
Reference in New Issue
Block a user