Showing 11 of 13 total issues
Function ordinal
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
Open
ordinal : function (number) {
return number === 1 ? 'er' :
number === 2 ? 'do' :
number === 3 ? 'ro' :
number === 4 ? 'to' :
- 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 server.js
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"use strict";
// APP
var _ = require('lodash');
Function template
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
template: function(locals, done){
if(locals.directory.match(/\/$/)){
locals.directory=locals.directory.replace(/\/$/,'');
}
var pathParts=locals.directory.split('/');
Function loadFrames
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function loadFrames(){
var pattern=/^((https?:\/\/)?[-a-z.0-9]+(:\d+)?)\/file(\/|$)/;
actualFrames.forEach(function(frame){
frame.controlTagLateral.textContent='T';
if(!frame.codenautas_info){
Function onload
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onload:function(text){
if(element.textContent==='...'){
element.textContent='';
}
element.title=text;
Function onload
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
onload:function(e){
var info=JSON.parse(this.responseText);
frame.codenautas_info.originFileName=info.originFileName;
if(frame.codenautas_info.mtime!='ignored' && frame.codenautas_info.mtime<info.mtime){
frame.controlTagLateral.textContent='R';
Function serveConvert
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var serveConvert=function serveConvert(root, opts, adapter){
if(!adapter){
adapter=function(){ return function(x){ return x; }; };
}
return function(req,res,next){
Consider simplifying this complex logical expression. Open
Open
if(converter && (req.query.fds || converter.auto || converter.others)){
var fileName=root+'/'+req.path;
var exts=[ext].concat(converter.others||[]);
var p=Promise.resolve({pending:true});
var fdsFormat = req.query.fds=='auto' && converter.auto || req.query.fds || converter.auto || 'auto';
Function onload
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
frame.onload=function(){
var insideFrame=false;
try{
insideFrame=pattern.test(frame.contentDocument.URL);
}catch(err){
Avoid deeply nested control flow statements. Open
Open
if(element){
addDirEntryIcon(element,{
icon:response.icon,
value:property,
property:property
Function ajaxSimple
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function ajaxSimple(params){
var ajax = new XMLHttpRequest();
params.onerror=params.onerror||function(err){ alert(err); };
ajax.open(params.method||'get',params.url);
ajax.onload=function(e){
- 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"