ubenzer/metaltext

View on GitHub

Showing 10 of 17 total issues

Function plugin has 169 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function plugin(opts) {
  opts = normalize(opts);

  return function(files, metalsmith, done) {
    // normalize each collections' backend options
Severity: Major
Found in metalsmith/collections.js - About 6 hrs to fix

    Function getBlockCompilerOnSteroids has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    function getBlockCompilerOnSteroids(opts) {
      opts = normalize(opts);
    
      return function blockCompilerOnSteroids(files, file, data) {
        return rhoSteroid(
    Severity: Minor
    Found in metalsmith/rhoRenderHelpers.js - About 3 hrs 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

    Function getBlockCompilerOnSteroids has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getBlockCompilerOnSteroids(opts) {
      opts = normalize(opts);
    
      return function blockCompilerOnSteroids(files, file, data) {
        return rhoSteroid(
    Severity: Major
    Found in metalsmith/rhoRenderHelpers.js - About 2 hrs to fix

      Function blockCompilerOnSteroids has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        return function blockCompilerOnSteroids(files, file, data) {
          return rhoSteroid(
            {
              renderImg: function(escapedAlt, src, flags) {
                if (checkOwnUrl(src)) {
      Severity: Major
      Found in metalsmith/rhoRenderHelpers.js - About 2 hrs to fix

        Function registerPostOnCategory has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function registerPostOnCategory(collectionId, categoryName, postData) {
              // check if exists, if not append it to proper tree
              var categoryHierarchy = getCollectionContentHierarchy(categoryName);
              var collection = _.findWhere(collections, {id: collectionId});
        
        
        Severity: Major
        Found in metalsmith/collections.js - About 2 hrs to fix

          Function build has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function build() {
            if (config.args.skipBackend === true) {
              debug("Skipping backend build because it is disabled by parameters.");
              return Promise.resolve();
            }
          Severity: Minor
          Found in app/backend.js - About 1 hr to fix

            Function plugin has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function plugin(options) {
              options = normalize(options);
            
              return function(files, metalsmith, done) {
                var processedCollections = metalsmith.metadata().collections;
            Severity: Minor
            Found in metalsmith/createCollectionJson.js - About 1 hr to fix

              Function downloadFrontendAssets has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function downloadFrontendAssets() {
                if (config.args.skipFrontend === true) {
                  debug("Skipping frontend asset generation due to config.");
                  return Promise.resolve();
                }
              Severity: Minor
              Found in app/frontend.js - About 1 hr to fix

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

                    function normalizeUrl(urlWithReference) {
                      var surlWithReference = s(urlWithReference);
                      var atCount = surlWithReference.count("@");
                      if (atCount === 1 || atCount > 2) {
                        throw new Error("Can't parse id identifiers: " + urlWithReference);
                Severity: Minor
                Found in metalsmith/rhoRenderHelpers.js - About 1 hr to fix

                  Function getConfig has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getConfig() {
                    if (cachedConfig === null) {
                      var customConfig = {};
                      var defaultConfig = require("../conf/default.js");
                  
                  
                  Severity: Minor
                  Found in app/program.js - About 25 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