Showing 25 of 48 total issues
Function enableEditing
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Views.ContentSnippetView.prototype.enableEditing = function () {
var buttonTag = '<button></button>';
var panelTag = '<div></div>';
var panelTextTag = '<span></span>';
- Create a ticketCreate a ticket
Function showLoginPanel
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.showLoginPanel = function showLoginPanel (e) {
var $loginButton = $(e.target);
var $panel = $('<section id="main-login" class="login hidden"></section>');
- Create a ticketCreate a ticket
Function matchLogin
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function matchLogin (data, info) {
var errorLogin = require('./error-login');
var crypto = require('crypto-js/core');
var startSession = require('./start-session');
- Create a ticketCreate a ticket
Function start
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
;(function start() {
/**
* @constructor Nooline
* The base constructor which we decorate with various modules, governing
- Create a ticketCreate a ticket
Function loadSnippets
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Models.Category.prototype.loadSnippets = function (error, data, index) {
var error404;
var ContentSnippet;
var snippet;
- Create a ticketCreate a ticket
Function bindEvents
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Views.ContentSnippetView.prototype.bindEvents = function (element) {
var _this = this;
_this.setElement(element);
- Create a ticketCreate a ticket
Function Nooline
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Nooline () {
requirejs.config({
baseUrl: '/',
shim: {
'node_modules/backbone/backbone': {
- Create a ticketCreate a ticket
Function buildControls
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.buildControls = function buildControls (data) {
var allSnippets = N.contentCategories.findAllContent();
var permissions = {};
- Create a ticketCreate a ticket
Function loadIndex
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Models.Category.prototype.loadIndex = function (error, data) {
var fs;
var info;
var error404;
var snippetList;
- Create a ticketCreate a ticket
Function render
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Views.CategoryView.prototype.render = function () {
var error404;
var config;
var content;
var info;
- Create a ticketCreate a ticket
Function putSnippet
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function putSnippet (req, res) {
var ContentSnippet = require(__root
+ '/common/js/nooline/models/content-snippet'
);
- Create a ticketCreate a ticket
Function bootstrap
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function bootstrap (req, res) {
/**
* Check to see if both settings files have finished loading. If so, send
* the settings back to the client.
- Create a ticketCreate a ticket
Function bootstrap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function bootstrap (req, res) {
/**
* Check to see if both settings files have finished loading. If so, send
* the settings back to the client.
- Read upRead up
- Create a ticketCreate a ticket
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 addPermission
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_.each(data.permissions, function addPermission (permission) {
permissions[permission] = true;
_.each(N.controls['control-locations'],
- Create a ticketCreate a ticket
Function commitChanges
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Nooline.commitChanges = function (files, repo) {
var process;
var exec = require('child_process').exec;
var config = require(__root + '/sites/' + repo + '/config/site.json');
- Create a ticketCreate a ticket
Function createSnippet
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Models.Category.prototype.createSnippet = function () {
var snippets = this.get('snippets');
var index = 1 + N.contentCategories.reduce(function (memo, category) {
return memo + category.get('snippets').length;
- Create a ticketCreate a ticket
Function error404
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function error404 (error, info) {
console.error(error);
// TODO: These options, particularly the partials and startPath,
- Create a ticketCreate a ticket
Function addControl
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addControl (types, spot) {
var $button;
var $container;
- Create a ticketCreate a ticket
Function create
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
N.Views.ContentSnippetView.prototype.create = function () {
var category = this.model.get('type');
var $el;
var $article;
- Create a ticketCreate a ticket
Function globalEvents
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function globalEvents () {
var N = this.Nooline;
// TODO: Refactor this.
- Create a ticketCreate a ticket