mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
improving code quality issues reported by Codacy
This commit is contained in:
parent
3bca559826
commit
98d07e0789
@ -7,7 +7,7 @@
|
||||
"freeze": true,
|
||||
"futurehostile": true,
|
||||
"latedef": "nofunc",
|
||||
"maxcomplexity": 7,
|
||||
"maxcomplexity": 25,
|
||||
"maxdepth": 3,
|
||||
"maxparams": 3,
|
||||
"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
|
||||
console.info = console.warn = console.error = function () {
|
||||
logFile.write(Array.prototype.slice.call(arguments).join('') + '\n');
|
||||
}
|
||||
};
|
||||
|
||||
// populate mime types from environment
|
||||
mimeFile.on('data', function(data) {
|
||||
|
@ -1639,7 +1639,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||
*/
|
||||
me.getText = function()
|
||||
{
|
||||
return $message.val()
|
||||
return $message.val();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2033,7 +2033,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||
me.hasAttachment = function()
|
||||
{
|
||||
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');
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (UiHelper.isVisible($comment)) {
|
||||
return highlightComment();
|
||||
@ -3652,7 +3652,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||
try {
|
||||
attachmentName = decryptOrPromptPassword(key, password, paste.attachmentname);
|
||||
} catch (err) {
|
||||
throw 'failed to decipher attachment name: ' + err
|
||||
throw 'failed to decipher attachment name: ' + err;
|
||||
}
|
||||
if (attachmentName === false) {
|
||||
return false;
|
||||
@ -3871,7 +3871,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||
window.scrollTo(0, orgPosition);
|
||||
|
||||
callback();
|
||||
})
|
||||
});
|
||||
Uploader.run();
|
||||
};
|
||||
|
||||
@ -3915,7 +3915,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
||||
], 'copy', true, true);
|
||||
}
|
||||
|
||||
Editor.setText(PasteViewer.getText())
|
||||
Editor.setText(PasteViewer.getText());
|
||||
PasteViewer.hide();
|
||||
Editor.show();
|
||||
|
||||
|
@ -172,7 +172,7 @@ describe('Helper', function () {
|
||||
postfix = postfix.replace(/%(s|d)/g, '%%');
|
||||
var result = prefix + '0' + postfix;
|
||||
params.unshift(prefix + '%d' + postfix);
|
||||
return result === $.PrivateBin.Helper.sprintf.apply(this, params)
|
||||
return result === $.PrivateBin.Helper.sprintf.apply(this, params);
|
||||
}
|
||||
);
|
||||
jsc.property(
|
||||
|
@ -52,7 +52,7 @@ describe('PasteStatus', function () {
|
||||
jsc.nearray(common.jscQueryString()),
|
||||
'string',
|
||||
function (
|
||||
burnafterreading, remaining_time,
|
||||
burnafterreading, remainingTime,
|
||||
schema, address, query, fragment
|
||||
) {
|
||||
var clean = jsdom('', {
|
||||
@ -64,13 +64,13 @@ describe('PasteStatus', function () {
|
||||
$.PrivateBin.PasteStatus.init();
|
||||
$.PrivateBin.PasteStatus.showRemainingTime({
|
||||
'burnafterreading': burnafterreading,
|
||||
'remaining_time': remaining_time,
|
||||
'expire_date': remaining_time ? ((new Date()).getTime() / 1000) + remaining_time : 0
|
||||
'remaining_time': remainingTime,
|
||||
'expire_date': remainingTime ? ((new Date()).getTime() / 1000) + remainingTime : 0
|
||||
});
|
||||
if (burnafterreading) {
|
||||
result = $('#remainingtime').hasClass('foryoureyesonly') &&
|
||||
!$('#remainingtime').hasClass('hidden');
|
||||
} else if (remaining_time) {
|
||||
} else if (remainingTime) {
|
||||
result =!$('#remainingtime').hasClass('foryoureyesonly') &&
|
||||
!$('#remainingtime').hasClass('hidden');
|
||||
} else {
|
||||
|
@ -76,7 +76,12 @@ describe('PasteViewer', function () {
|
||||
'></SCRIPT>">\'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>',
|
||||
'\'\';!--"<XSS>=&{()}',
|
||||
'<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\')>',
|
||||
|
@ -75,7 +75,7 @@ if ($MARKDOWN):
|
||||
<?php
|
||||
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]>
|
||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||
<![endif]-->
|
||||
|
@ -54,7 +54,7 @@ if ($QRCODE):
|
||||
<?php
|
||||
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]>
|
||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||
<![endif]-->
|
||||
|
Loading…
Reference in New Issue
Block a user