rbeer/nodebb-plugin-smoothshorts

View on GitHub

Showing 6 of 12 total issues

Function exports has 230 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
  'use strict';

  var fs = require('fs');
  var symlink = fs.symlink;
Severity: Major
Found in Gruntfile.js - About 1 day to fix

    Function hashMissing has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    sockets.admin.hashMissing = function(socket, cb) {
      async.parallel({
        postIds: function(next) {
          db.getSortedSetRevRange('posts:pid', 0, -1, next);
        },
    Severity: Major
    Found in lib/sockets.js - About 2 hrs to fix

      Function renderAdmin has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function renderAdmin(req, res, next) {
        async.parallel({
          postCount: function(next) {
            db.sortedSetCard('posts:pid', next);
          },
      Severity: Minor
      Found in lib/routes.js - About 1 hr to fix

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

        hashing.resolveHash = function(req, res, cb) {
          var hash = req.params.hash;
        
          async.parallel({
            isPost: function(next) {
        Severity: Minor
        Found in lib/hashing.js - About 1 hr to fix

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

              function parseAjaxifyData() {
                var data = ajaxify.data;
                var dataKey = data.topics ? 'topics' : data.categories ? 'categories' : null;
                var pageData = dataKey ? data[dataKey] : void 0;
                var hashedObjects = {
          Severity: Minor
          Found in public/scripts/controller.js - About 1 hr to fix

            Function parseBools has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function parseBools(obj) {
              for (var name in obj) {
                if (obj.hasOwnProperty(name)) {
                  if (obj[name] === 'true') obj[name] = true;
                  if (obj[name] === 'false') obj[name] = false;
            Severity: Minor
            Found in lib/settings.js - About 55 mins 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

            Severity
            Category
            Status
            Source
            Language