Jam3/adviser

View on GitHub

Showing 18 of 2,428 total issues

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

  render() {
    const { config: siteConfig, language = '' } = this.props;
    const { baseUrl } = siteConfig;

    const Block = props => (
Severity: Major
Found in docusaurus/website/pages/en/index.js - About 3 hrs to fix

    Function execute has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      execute(args, callback) {
        let currentOptions;
        let errorCode = 0;
    
        try {
    Severity: Major
    Found in src/cli/cli.js - About 3 hrs to fix

      File config.test.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict';
      
      const path = require('path');
      const cosmiconfig = require('cosmiconfig');
      const Config = require('../../src/core/config/config');
      Severity: Minor
      Found in __tests__/core/config.test.js - About 3 hrs to fix

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

          render() {
            return (
              <footer className="nav-footer" id="footer">
                <section className="sitemap">
                  <a href={this.props.config.baseUrl} className="nav-home">
        Severity: Major
        Found in docusaurus/website/core/Footer.js - About 2 hrs to fix

          Function base has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function base(results, rules) {
            let output = `\n  ${chalk.blue('Output')} \n\n`;
            let summaryColor = 'yellow';
          
            if (results.items.length === 0) {
          Severity: Major
          Found in src/core/formatters/base.js - About 2 hrs to fix

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

              render() {
                const { siteConfig, language = '' } = this.props;
                const { baseUrl, docsUrl } = siteConfig;
                const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
                const langPart = `${language ? `${language}/` : ''}`;
            Severity: Minor
            Found in docusaurus/website/pages/en/index.js - About 1 hr to fix

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

                async runLifeCycle(currentDirectory, verboseMode, reportCallback, asyncCallback) {
                  if (this.severity === SeverityEnum.Off) {
                    asyncCallback();
                    return;
                  }
              Severity: Minor
              Found in src/core/rule/rule.js - About 1 hr to fix

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

                  _formatSchemaErrors(errors) {
                    const filteredRules = [];
                
                    return errors
                      .map(error => {
                Severity: Minor
                Found in src/core/config/schema-validator.js - About 1 hr to fix

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

                  function Help(props) {
                    const { config: siteConfig, language = '' } = props;
                    const { baseUrl, docsUrl } = siteConfig;
                    const docsPart = `${docsUrl ? `${docsUrl}/` : ''}`;
                    const langPart = `${language ? `${language}/` : ''}`;
                  Severity: Minor
                  Found in docusaurus/website/pages/en/help.js - About 1 hr to fix

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

                      _loadRules() {
                        this.emit(EVENTS.ENGINE.LOAD_RULES);
                    
                        const configRules = this.config.getRules();
                    
                    
                    Severity: Minor
                    Found in src/core/engine.js - About 1 hr to fix

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

                        constructor(filePath = null, fileExplorer = null) {
                          this._config = null;
                      
                          this._configFileExplorer = fileExplorer || cosmiconfig(MODULE_NAME);
                      
                      
                      Severity: Minor
                      Found in src/core/config/config.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

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

                        onError(exceptionError) {
                          if (typeof exceptionError.messageTemplate === 'string' && exceptionError.messageTemplate.length > 0) {
                            templateLoader.setTemplateId(exceptionError.messageTemplate);
                            const packageVersion = packageInfo.getVersion();
                      
                      
                      Severity: Minor
                      Found in src/core/errors/error-handler.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

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

                        execute(args, callback) {
                          let currentOptions;
                          let errorCode = 0;
                      
                          try {
                      Severity: Minor
                      Found in src/cli/cli.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

                      Avoid too many return statements within this function.
                      Open

                                return `"${field}" ${error.message} [${error.params.allowedValues}]`;
                      Severity: Major
                      Found in src/core/config/schema-validator.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
                        Severity: Major
                        Found in src/core/config/schema-validator.js - About 30 mins to fix

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

                            async run(sandbox) {
                              const files = await this._readRootDirectory();
                          
                              const requiredFiles = this.context.options['required'];
                              if (requiredFiles) {
                          Severity: Minor
                          Found in src/core/built-in/rules/root-files.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

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

                            async runLifeCycle(currentDirectory, verboseMode, reportCallback, asyncCallback) {
                              if (this.severity === SeverityEnum.Off) {
                                asyncCallback();
                                return;
                              }
                          Severity: Minor
                          Found in src/core/rule/rule.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

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

                            run(sandbox) {
                              const packagejson = this._getPackageJsonPath();
                          
                              const requiredProps = this.context.options['required'];
                              if (requiredProps) {
                          Severity: Minor
                          Found in src/core/built-in/rules/package-json-properties.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