contentascode/docsmith

View on GitHub

Showing 11 of 25 total issues

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

module.exports = function(config, overrides, callback) {
  const name = basename(config, extname(config));
  debug('name', name);
  const dir = resolve(process.cwd(), dirname(config));
  debug('dir', dir);
Severity: Major
Found in src/docsmith/utils/metalsmith.js - About 4 hrs to fix

    Function create_travis_yml has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function create_travis_yml(gh_token) {
      return new Promise(function(resolve, reject) {
        // This builds the yaml in memory including the secure token and writes the file
        // It could also use a moustache style template in integration/travis/.travis.yml
    
    
    Severity: Major
    Found in src/docsmith-install.js - About 2 hrs to fix

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

      module.exports = function(config, overrides, callback) {
        const name = basename(config, extname(config));
        debug('name', name);
        const dir = resolve(process.cwd(), dirname(config));
        debug('dir', dir);
      Severity: Minor
      Found in src/docsmith/utils/metalsmith.js - About 2 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

      File docsmith-install.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/usr/bin/env node
      
      /**
       * Module dependencies.
       */
      Severity: Minor
      Found in src/docsmith-install.js - About 2 hrs to fix

        Function npm_build has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function npm_build(src, dest) {
          const load_npm_build_yaml = new Promise(function(resolve) {
            resolve(yaml.safeLoad(fs.readFileSync(path.join(templates.path, src), 'utf8')));
          });
        
        
        Severity: Minor
        Found in src/docsmith-install.js - About 2 hrs to fix

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

          function init(template = 'metalsmith') {
            // Built in templates
            if (template == 'jekyll' || template == 'metalsmith') {
              try {
                debug('template file', path.join(templates_path, 'init-' + template));
          Severity: Minor
          Found in templates.js - About 1 hr to fix

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

            function init(template = 'metalsmith') {
              // Built in templates
              if (template == 'jekyll' || template == 'metalsmith') {
                try {
                  debug('template file', path.join(templates_path, 'init-' + template));
            Severity: Minor
            Found in src/docsmith/init/templates.js - About 1 hr to fix

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

                const read_package_json = function(yaml) {
                  const check_package_json = new Promise(function(resolve, reject) {
                    fs.stat(dest, function(err, stats) {
                      if (err) {
                        resolve(false);
              Severity: Minor
              Found in src/docsmith-install.js - About 1 hr to fix

                Function deploy has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const deploy = function deploy(workspaces, repository, done) {
                  debug('workspaces', workspaces);
                  debug('repository', repository);
                  debug('pwd', process.cwd());
                  async.reduce(
                Severity: Minor
                Found in src/docsmith/init/workspaces.js - About 1 hr to fix

                  Function npm_build has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function npm_build(src, dest) {
                    const load_npm_build_yaml = new Promise(function(resolve) {
                      resolve(yaml.safeLoad(fs.readFileSync(path.join(templates.path, src), 'utf8')));
                    });
                  
                  
                  Severity: Minor
                  Found in src/docsmith-install.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 start has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function start({
                    workspace,
                    config,
                    link = false,
                    source,
                  Severity: Minor
                  Found in src/docsmith/start.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