fossasia/loklak_webclient

View on GitHub
iframely/lib/loader/pluginLoader.js

Summary

Maintainability
D
2 days
Test Coverage

File pluginLoader.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function(pluginLoader) {

    var fs = require('fs'),
        path = require('path'),
        _ = require('underscore'),
Severity: Minor
Found in iframely/lib/loader/pluginLoader.js - About 4 hrs to fix

    Function loadPluginFile has 113 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function loadPluginFile(pluginPath) {
    
            var bits = pluginPath.split(path.sep);
    
            if (pluginPath.match(/\.js$/i)) {
    Severity: Major
    Found in iframely/lib/loader/pluginLoader.js - About 4 hrs to fix

      Function scanModulesForPlugins has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function scanModulesForPlugins() {
      
              // Scan node_modules dir.
              var modulesRootPath = path.resolve('node_modules');
              var modules_listing = fs.readdirSync(modulesRootPath).map(function(module_name) { return path.resolve(modulesRootPath, module_name); });
      Severity: Major
      Found in iframely/lib/loader/pluginLoader.js - About 3 hrs to fix

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

            function getPluginMethods(pluginPath,plugin) {
                var methods = {};
                for (var name in plugin) {
                    var func = plugin[name];
                    if (typeof func === "function" && PLUGIN_METHODS.indexOf(name) > -1) {
        Severity: Minor
        Found in iframely/lib/loader/pluginLoader.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                                      if (error) {
                                          console.error(error.reason);
                                          if (error.evidence) {
                                              console.error(error.evidence+'\n');
                                          }
          Severity: Major
          Found in iframely/lib/loader/pluginLoader.js - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                                return;
            Severity: Major
            Found in iframely/lib/loader/pluginLoader.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return;
              Severity: Major
              Found in iframely/lib/loader/pluginLoader.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return;
                Severity: Major
                Found in iframely/lib/loader/pluginLoader.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return;
                  Severity: Major
                  Found in iframely/lib/loader/pluginLoader.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return;
                    Severity: Major
                    Found in iframely/lib/loader/pluginLoader.js - About 30 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status