Showing 32 of 52 total issues
Function render
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
render: function() {
// TODO: DRY this up
var navState = this.state.get("currentState");
var availableRoutes = this.state.get("availableRoutes");
var documentTitle = this.state.get("documentTitle");
- 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 exports
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (object){
// initialise the list of objects and size
var objects = [object];
var size = 0;
- 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 render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
// TODO: DRY this up
var navState = this.state.get("currentState");
var availableRoutes = this.state.get("availableRoutes");
var documentTitle = this.state.get("documentTitle");
Function render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
// Show message if available
var msg;
if (this.state.session.get("msg")) {
msg = (
Function get
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
get(path, localOnly) {
// Check for hydrated data
var hydratedData = dataProvider.getDataByPath(path);
if(Object.getOwnPropertyNames(hydratedData).length !== 0 || localOnly){
this.response = hydratedData;
- 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 exports
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (passport) {
passport.serializeUser(function (user, done) {
done(null,{
id: user.get("id"),
username: user.get("username")
Function render
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
// Show message if available
var msg;
if (this.state.session.get("msg")) {
msg = (
Function renderApp
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderApp: function(req, res) {
var authenticated = req.isAuthenticated();
try {
if (enableHtmlCache && _.has(htmlCache, req.path) && !authenticated) {
console.log("Cache hit!");
Function render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
return (
<footer className="footer">
<div className="row full-width">
<div className="small-6 medium-6 large-6 xlarge-6 columns">
Function exports
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (listenable, key) {
return {
getInitialState: function () {
if (!_.isFunction(listenable.getInitialState)) {
return {};
- 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 createUser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
createUser: function(username, password) {
var deferred = q.defer();
// Check if user already exists
if (this.getByUsername(username)) {
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (listenable, key) {
return {
getInitialState: function () {
if (!_.isFunction(listenable.getInitialState)) {
return {};
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (object){
// initialise the list of objects and size
var objects = [object];
var size = 0;
Function renderApp
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
renderApp: function(req, res) {
var authenticated = req.isAuthenticated();
try {
if (enableHtmlCache && _.has(htmlCache, req.path) && !authenticated) {
console.log("Cache hit!");
- 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 render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var view = this;
// Questions
var questions = <ReactSpinner/>;
Function login
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
login: function(req, res, next) {
passport.authenticate('local-login', function (err, user) {
if (user) {
// Create session
req.logIn(user, function(err) {
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
return (
<DocumentTitle title="New question">
<div className="row">
<div className="large-12 columns">
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render: function() {
var view = this;
// Questions
var questions = <ReactSpinner/>;
- 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 initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
initialize: function(data, options) {
if (options) {
if (options.parentCollection) {
this._parentCollection = options.parentCollection;
}
- 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 render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var profileLink = (this.state.session.get("auth")) ? (<NavLink to="/profile" title="Profile" className="profile"/>) : "";
var loginoutLink = (this.state.session.get("auth")) ? (<li className="logout"><LogoutLink/></li>) : (<NavLink to="/login" title="Login" className="login"/>);
// Dev settings toolbar