timbeadle/grunt-tv4

View on GitHub

Showing 14 of 32 total issues

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

module.exports = function (grunt) {
    // Load all npm grunt tasks
    require('load-grunt-tasks')(grunt);

    grunt.loadTasks('tasks');
Severity: Major
Found in Gruntfile.js - About 1 day to fix

    Function getRunner has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

    const getRunner = (tv4, loader, out, style) => {
    
        const getContext = (options) => {
            const context = {};
            context.tv4 = (options.fresh ? tv4.freshApi() : tv4);
    Severity: Minor
    Found in lib/runner.js - About 1 day 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 getRunner has 238 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const getRunner = (tv4, loader, out, style) => {
    
        const getContext = (options) => {
            const context = {};
            context.tv4 = (options.fresh ? tv4.freshApi() : tv4);
    Severity: Major
    Found in lib/runner.js - About 1 day to fix

      File Gruntfile.js has 391 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Grunt wrapper for tv4 - grunt-tv4
       * https://github.com/timbeadle/grunt-tv4
       *
       * Copyright (c) 2013 Bart van der Schoor
      Severity: Minor
      Found in Gruntfile.js - About 5 hrs to fix

        File runner.js has 322 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable unicorn/prefer-module, no-warning-comments, node/prefer-global/process */
        // Bulk validation core: composites with tv4, miniwrite, ministyle and loaders
        
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        
        
        Severity: Minor
        Found in lib/runner.js - About 3 hrs to fix

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

          module.exports = (grunt) => {
          
              const out = miniwrite.grunt(grunt);
              const style = ministyle.grunt();
              const report = reporter.getReporter(out, style);
          Severity: Major
          Found in tasks/tv4.js - About 3 hrs to fix

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

                const doValidateObject = (job, object, callback) => {
                    if (!object.root) {
                        // TODO handle this better
                        job.error = new Error('no explicit root schema');
            
            
            Severity: Minor
            Found in lib/runner.js - About 1 hr to fix

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

              module.exports = function (grunt) {
                  // Load all npm grunt tasks
                  require('load-grunt-tasks')(grunt);
              
                  grunt.loadTasks('tasks');
              Severity: Minor
              Found in Gruntfile.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 getContext has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  const getContext = (options) => {
                      const context = {};
                      context.tv4 = (options.fresh ? tv4.freshApi() : tv4);
                      context.options = {};
              
              
              Severity: Minor
              Found in lib/runner.js - About 1 hr to fix

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

                    const recursiveTest = (job, object, callback) => {
                        const { options } = job.context;
                        if (job.context.options.multi) {
                            object.result = job.context.tv4.validateMultiple(
                                object.value,
                Severity: Minor
                Found in lib/runner.js - About 1 hr to fix

                  Function loadHTTP has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const loadHTTP = (uri, options, callback) => {
                      const options_ = {
                          timeout: options ? options.timeout : 5000
                      };
                  
                  
                  Severity: Minor
                  Found in lib/loader.js - About 1 hr to fix

                    Function loadSchemaList has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        const loadSchemaList = (job, uris, callback) => {
                            uris = uris.filter((value) => {
                                return Boolean(value);
                            });
                    
                    
                    Severity: Minor
                    Found in lib/runner.js - About 1 hr to fix

                      Function copyProps has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const copyProps = (target, source, recursive) => {
                          if (source) {
                              const sourceKeys = Object.keys(source);
                              for (const key of sourceKeys) {
                                  if (recursive && typeof source[key] === 'object') {
                      Severity: Minor
                      Found in lib/runner.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 forAsync has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const forAsync = (items, iter, callback) => {
                          const keys = Object.keys(items);
                      
                          const step = (error, callback) => {
                              nextTick(() => {
                      Severity: Minor
                      Found in lib/runner.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