JonAbrams/synth

View on GitHub

Showing 15 of 15 total issues

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

exports = module.exports = function (options) {
  options = options || {};
  var defaultResourceDir = path.join(process.cwd(), 'back/resources');
  var defaultServiceDir = path.join(process.cwd(), 'back/services');
  var viewDir = options.viewDir || path.join(process.cwd(), 'front');
Severity: Major
Found in synth.js - About 3 hrs to fix

    Function show has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.show = function (command) {
      var helpMsg = ['synth version ' + pkg.version, ''];
    
      switch (command) {
        case 'new':
    Severity: Major
    Found in lib/help.js - About 3 hrs to fix

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

        if (nodeModuleIndex || both) {
          var nodeModules = getModules(args, nodeModuleIndex);
      
          process.chdir('back');
          npm.load({ save: true }, function (err) {
      Severity: Major
      Found in lib/commands.js and 1 other location - About 1 hr to fix
      lib/commands.js on lines 144..151

      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 73.

      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

        if (nodeModuleIndex || both) {
          var nodeModules = getModules(args, nodeModuleIndex);
      
          process.chdir('back');
          npm.load({ save: true }, function (err) {
      Severity: Major
      Found in lib/commands.js and 1 other location - About 1 hr to fix
      lib/commands.js on lines 183..190

      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 73.

      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 index has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.index = function (req, res) {
        var handler = req.handler,
            dataPromise = Promise.cast(null),
            htmlPromise = Promise.cast(null);
      
      
      Severity: Minor
      Found in lib/frontendRenderer.js - About 1 hr to fix

        Function startServer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.startServer = function (mode, port) {
          var server;
          var restarted = false;
          var connections = [];
          var serverRunning = false;
        Severity: Minor
        Found in lib/commands.js - About 1 hr to fix

          Function getComponentFiles has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          var getComponentFiles = exports.getComponentFiles = function (installed) {
            var componentLists = {}, jsFiles, cssFiles;
            var rootPath = '../bower_components/';
          
            componentLists.jsFiles = jsFiles = [];
          Severity: Minor
          Found in lib/bowerSupport.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

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

          exports.uninstall = function (command, args) {
            var nodeModuleIndex = args.indexOf('-b') + 1;
            var bowerComponentIndex = args.indexOf('-f') + 1;
            var both = !!(nodeModuleIndex && bowerComponentIndex);
          
          
          Severity: Minor
          Found in lib/commands.js - About 1 hr to fix

            Function applyTemplate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function applyTemplate ( direction, template, dest ) {
              var destDirection =  (direction == 'root') ? '' : direction;
              var appName = dest.replace(/.*\//g, '');
              var templatePath = path.join(__dirname, '../templates', direction, template);
              var destPath = path.join(dest, destDirection);
            Severity: Minor
            Found in lib/commands.js - About 1 hr to fix

              Function createNewApp has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.createNewApp = function (dirName) {
                var args = nopt({
                  'front': String,
                  'back': String,
                  'root': String
              Severity: Minor
              Found in lib/commands.js - About 1 hr to fix

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

                var init = function (type) {
                  var filesRaw;
                  var relPath = path.join(cwd, 'front', type, type + 'Files');
                
                  if (initialized[type]) return;
                Severity: Minor
                Found in lib/assets.js - About 1 hr to fix

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

                    app.use(
                      st({
                        url: '/',
                        path: path.join(process.cwd(), 'front/misc'),
                        passthrough: true,
                  Severity: Minor
                  Found in synth.js and 1 other location - About 50 mins to fix
                  synth.js on lines 67..74

                  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 51.

                  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

                    app.use(
                      st({
                        url: '/images',
                        path: path.join(process.cwd(), 'front/images'),
                        passthrough: true,
                  Severity: Minor
                  Found in synth.js and 1 other location - About 50 mins to fix
                  synth.js on lines 57..64

                  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 51.

                  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 startServer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.startServer = function (mode, port) {
                    var server;
                    var restarted = false;
                    var connections = [];
                    var serverRunning = false;
                  Severity: Minor
                  Found in lib/commands.js - About 45 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

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

                  exports = module.exports = function (options) {
                    options = options || {};
                    var defaultResourceDir = path.join(process.cwd(), 'back/resources');
                    var defaultServiceDir = path.join(process.cwd(), 'back/services');
                    var viewDir = options.viewDir || path.join(process.cwd(), 'front');
                  Severity: Minor
                  Found in synth.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