Showing 21 of 57 total issues

File __helpers.js has 305 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const figlet = require('figlet');
const chalk = require('chalk');
const path = require('path');
const fs = require('fs');
const handlebars = require('handlebars');
Severity: Minor
Found in helper_scripts/CL_commands/__helpers.js - About 3 hrs to fix

    Function askQuestions has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function askQuestions() {
      const questions = [
        {
          name: 'filename',
          type: 'input',
    Severity: Major
    Found in helper_scripts/CL_commands/create_component.js - About 2 hrs to fix

      Function mergeObjects has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      export function mergeObjects(...args) {
        const dst = {};
        let src;
        let p;
        const aargs = [].splice.call(args, 0);
      Severity: Minor
      Found in libraries/helpers.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

      Function webpack has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

        webpack: (config, { dev, isServer }) => {
          const prod = !dev;
      
          config.plugins.push(new Dotenv({ path: './public.env' }));
          config.plugins.push(new IgnorePlugin(/^\.\/locale$/, /moment$/));
      Severity: Minor
      Found in next.config.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

      Function askQuestions has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function askQuestions() {
        const questions = [
          {
            name: 'filename',
            type: 'input',
      Severity: Minor
      Found in helper_scripts/CL_commands/create_page.js - About 1 hr to fix

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

        function askQuestions() {
          const questions = [
            {
              name: 'filename',
              type: 'input',
        Severity: Minor
        Found in helper_scripts/CL_commands/create_page.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 askQuestions has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function askQuestions() {
          const questions = [
            {
              name: 'filename',
              type: 'list',
        Severity: Minor
        Found in helper_scripts/CL_commands/create_route.js - About 1 hr to fix

          Function AuthFields has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const AuthFields = (props: Props) => {
            const {
              selectFields,
              fields,
              handleTouch,
          Severity: Minor
          Found in components/AuthFields/index.js - About 1 hr to fix

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

                static async getInitialProps(ctx: Context) {
                  let apolloState = {};
                  let serverState = {};
            
                  const headers = ctx.req ? ctx.req.headers : {};
            Severity: Minor
            Found in libraries/withData.js - About 1 hr to fix

              Function handleSubmit has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                handleSubmit(e: SyntheticEvent<HTMLButtonElement>, valuesPack) {
                  e.preventDefault();
              
                  // reset state
                  this.setState({
              Severity: Minor
              Found in components/SignUpForm/index.js - About 1 hr to fix

                Function askQuestions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                function askQuestions() {
                  const questions = [
                    {
                      name: 'filename',
                      type: 'input',
                Severity: Minor
                Found in helper_scripts/CL_commands/create_component.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 render has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const fields = this.formFields;
                    // Packing all the necessary auth field states
                    const valuesPack = {};
                
                
                Severity: Minor
                Found in components/SignInForm/index.js - About 1 hr to fix

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

                    render() {
                      const fields = this.formFields;
                      // Packing all the necessary auth field states
                      const valuesPack = {};
                  
                  
                  Severity: Minor
                  Found in components/SignUpForm/index.js - About 1 hr to fix

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

                    function afterPageCreation(filename, prettyurl = null) {
                      process.stdout.write('\n');
                      process.stdout.write(`New Page ${filename} is created and ready!`);
                      process.stdout.write('\n');
                      if (prettyurl) {
                    Severity: Minor
                    Found in helper_scripts/CL_commands/create_page.js - About 1 hr to fix

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

                      function askQuestions() {
                        const questions = [
                          {
                            name: 'filename',
                            type: 'input',
                      Severity: Minor
                      Found in helper_scripts/CL_commands/create_container.js - About 1 hr to fix

                        Function getFilesOnDir has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        modules.getFilesOnDir = function getFilesOnDir(startPath) {
                          if (!fs.existsSync(startPath)) {
                            return [];
                          }
                        
                        
                        Severity: Minor
                        Found in helper_scripts/CL_commands/__helpers.js - About 55 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 askQuestions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function askQuestions() {
                          const questions = [
                            {
                              name: 'filename',
                              type: 'input',
                        Severity: Minor
                        Found in helper_scripts/CL_commands/create_container.js - About 55 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

                        Avoid deeply nested control flow statements.
                        Open

                                  if (toString.call(src[p]) === '[object Object]') {
                                    dst[p] = mergeObjects(dst[p] || {}, src[p]);
                                  } else {
                                    dst[p] = src[p];
                                  }
                        Severity: Major
                        Found in libraries/helpers.js - About 45 mins to fix

                          Function addTexttoFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            filePath,
                            from,
                            text,
                            cb,
                            before = true
                          Severity: Minor
                          Found in helper_scripts/CL_commands/__helpers.js - About 35 mins to fix

                            Function PostList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const PostList = ({ data, loadMorePosts }: Props) => {
                              if (data.allPosts && data.allPosts.length) {
                                const areMorePosts = data.allPosts.length < data._allPostsMeta.count;
                                return (
                                  <Main>
                            Severity: Minor
                            Found in components/PostList/index.js - About 35 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