nooline/nooline

View on GitHub

Showing 48 of 48 total issues

Function loadIndex has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  N.Models.Category.prototype.loadIndex = function (error, data) {
    var fs;
    var info;
    var error404;
    var snippetList;
Severity: Minor
Found in common/js/nooline/models/category/load-index.js - About 1 hr to fix

Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  N.Views.CategoryView.prototype.render = function () {
    var error404;
    var config;
    var content;
    var info;
Severity: Minor
Found in common/js/nooline/views/category-view/render.js - About 1 hr to fix

Function putSnippet has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function putSnippet (req, res) {

  var ContentSnippet = require(__root
    + '/common/js/nooline/models/content-snippet'
  );
Severity: Minor
Found in routes/put-snippet.js - About 1 hr to fix

Function bootstrap has 32 lines of code (exceeds 25 allowed). Consider refactoring.
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.
Severity: Minor
Found in routes/bootstrap.js - About 1 hr to fix

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    constructor: function CategoryView () {

      Backbone.View.apply(this, arguments);

      if (typeof module !== 'undefined') {
Severity: Major
Found in common/js/nooline/views/category-view.js and 2 other locations - About 1 hr to fix
common/js/nooline/collections/content-categories.js on lines 29..38
common/js/nooline/collections/snippets.js on lines 29..37

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function bootstrap has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
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.
Severity: Minor
Found in routes/bootstrap.js - About 1 hr to fix

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    constructor: function Snippets () {
      Backbone.Collection.apply(this, arguments);

      if (typeof module !== 'undefined') {
        require('./snippets/setup');
Severity: Major
Found in common/js/nooline/collections/snippets.js and 2 other locations - About 1 hr to fix
common/js/nooline/collections/content-categories.js on lines 29..38
common/js/nooline/views/category-view.js on lines 31..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    constructor: function ContentCategories () {
      Backbone.Collection.apply(this, arguments);

      if (typeof module !== 'undefined') {
        require('./content-categories/setup');
Severity: Major
Found in common/js/nooline/collections/content-categories.js and 2 other locations - About 1 hr to fix
common/js/nooline/collections/snippets.js on lines 29..37
common/js/nooline/views/category-view.js on lines 31..40

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 60.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function addPermission has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _.each(data.permissions, function addPermission (permission) {

      permissions[permission] = true;

      _.each(N.controls['control-locations'],
Severity: Minor
Found in common/js/nooline/build-controls.js - About 1 hr to fix

Function commitChanges has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Nooline.commitChanges = function (files, repo) {

  var process;
  var exec = require('child_process').exec;
  var config = require(__root + '/sites/' + repo + '/config/site.json');
Severity: Minor
Found in controllers/commit-changes.js - About 1 hr to fix

Function createSnippet has 28 lines of code (exceeds 25 allowed). Consider refactoring.
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;
Severity: Minor
Found in common/js/nooline/models/category/create-snippet.js - About 1 hr to fix

Function error404 has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function error404 (error, info) {

  console.error(error);

  // TODO: These options, particularly the partials and startPath,
Severity: Minor
Found in routes/error-404.js - About 1 hr to fix

Function addControl has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function addControl (types, spot) {

        var $button;
        var $container;

Severity: Minor
Found in common/js/nooline/build-controls.js - About 1 hr to fix

Function create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  N.Views.ContentSnippetView.prototype.create = function () {

    var category = this.model.get('type');
    var $el;
    var $article;
Severity: Minor
Found in common/js/nooline/views/content-snippet-view/create.js - About 1 hr to fix

Function globalEvents has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function globalEvents () {

  var N = this.Nooline;

  // TODO: Refactor this.
Severity: Minor
Found in common/js/nooline/assign-listeners.js - About 1 hr to fix

Function loadMeta has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  N.Models.Category.prototype.loadMeta = function (error, data) {
    var fs;
    var errorMessage;
    var error404;
      
Severity: Minor
Found in common/js/nooline/models/category/load-meta.js - About 1 hr to fix

Function saveContent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function saveContent (category, info) {
  var snippets = category.get('snippets');
  var fs = require('fs');
  var path;

Severity: Minor
Found in controllers/save-content.js - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      this.$verifyButton = $(buttonTag)
      .appendTo(this.$verifyPanel)
      .attr({
        class: verifyButtonClassNames,
        title: verifyButtonText
Severity: Minor
Found in common/js/nooline/views/content-snippet-view/enable-editing.js and 1 other location - About 55 mins to fix
common/js/nooline/views/content-snippet-view/enable-editing.js on lines 98..104

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      this.$cancelVerifyButton = $(buttonTag)
      .appendTo(this.$verifyPanel)
      .attr({
        class: cancelVerifyClassNames,
        title: cancelVerifyButtonText
Severity: Minor
Found in common/js/nooline/views/content-snippet-view/enable-editing.js and 1 other location - About 55 mins to fix
common/js/nooline/views/content-snippet-view/enable-editing.js on lines 90..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

({ define: typeof define === "function"
  ? define
  : function(name, deps, func) { 
    exports = module.exports = func(); 
  } 
common/js/nooline/collections/content-categories/render-categories.js on lines 2..51
common/js/nooline/models/category/count-snippets.js on lines 2..26
common/js/nooline/models/category/report-snippets.js on lines 2..23
common/js/nooline/views/category-view/bind-events.js on lines 2..35
common/js/nooline/views/category-view/create-snippet.js on lines 2..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language