Function updateIcons
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
updateIcons:function(itemType, fileList){
var item;
var $fileList;
var currentDir;
if (!fileList && OCA.Files) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File share.js
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* global escapeHTML */
/**
* @namespace
*/
Function markFileAsShared
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
markFileAsShared: function($tr, hasShares, hasLink) {
var action = $tr.find('.fileactions .action[data-action="Share"]');
var type = $tr.data('type');
var icon = action.find('.icon');
var message;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function updateIcons
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateIcons:function(itemType, fileList){
var item;
var $fileList;
var currentDir;
if (!fileList && OCA.Files) {
Function markFileAsShared
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
markFileAsShared: function($tr, hasShares, hasLink) {
var action = $tr.find('.fileactions .action[data-action="Share"]');
var type = $tr.data('type');
var icon = action.find('.icon');
var message;
Function share
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, callback, errorCallback) {
// Add a fallback for old share() calls without expirationDate.
// We should remove this in a later version,
// after the Apps have been updated.
if (typeof callback === 'undefined' &&
Function loadIcons
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadIcons:function(itemType, fileList, callback) {
var path = fileList.dirInfo.path;
if (path === '/') {
path = '';
}
Function share
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
share:function(itemType, itemSource, shareType, shareWith, permissions, itemSourceName, expirationDate, callback, errorCallback) {
Avoid deeply nested control flow statements. Open
while (path != last) {
if (path === data.path && !data.link) {
var actions = $fileList.find('.fileactions .action[data-action="Share"]');
var files = $fileList.find('.filename');
var i;
Function loadItem
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
loadItem:function(itemType, itemSource, callback) {
var data = '';
var checkReshare = true;
var async = !_.isUndefined(callback);
if (typeof OC.Share.statuses[itemSource] === 'undefined') {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function showDropDown
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
showDropDown:function(itemType, itemSource, appendTo, link, possiblePermissions, filename) {
Function unshare
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
unshare:function(itemType, itemSource, shareType, shareWith, callback) {
Function _formatRemoteShare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_formatRemoteShare: function(remoteAddress) {
var parts = this._REMOTE_OWNER_REGEXP.exec(remoteAddress);
if (!parts) {
// display as is, most likely to be a simple owner name
return escapeHTML(remoteAddress);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"