apercova/atom-path-intellisense

View on GitHub
lib/providers/base-path.provider.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function $resolveSuggestions has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  $resolveSuggestions(req, search) {
    const self = this;
    const promize = new Promise(resolve => {
      let result = new SuggestionsDTO();
      if (!(search instanceof SearchPathDTO)) {
Severity: Major
Found in lib/providers/base-path.provider.js - About 2 hrs to fix

    Function promize has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const promize = new Promise(resolve => {
          let result = new SuggestionsDTO();
          if (!(search instanceof SearchPathDTO)) {
            resolve(self.formatter.format(result));
          } else {
    Severity: Major
    Found in lib/providers/base-path.provider.js - About 2 hrs to fix

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

        $resolveRelativeSearchPathSync(req, basePath, testPath) {
          let fullPath = this.$normalizeRelativePath(basePath, testPath);
          this._logger.debug(`trying path: ${testPath}`);
          this._logger.debug(`base path resolved as: ${basePath}`);
          this._logger.debug(`full path resolved as: ${fullPath}`);
      Severity: Minor
      Found in lib/providers/base-path.provider.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 $resolveSuggestions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        $resolveSuggestions(req, search) {
          const self = this;
          const promize = new Promise(resolve => {
            let result = new SuggestionsDTO();
            if (!(search instanceof SearchPathDTO)) {
      Severity: Minor
      Found in lib/providers/base-path.provider.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 $resolveRelativeBasePath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Invalid

        $resolveRelativeBasePath(req, testPath) {
          return testPath.startsWith('/')
            ? config.getDefaultRootDir() === consts.FILE_SYSTEM_ROOT
              ? this.$getRootFsPath()
              : config.getDefaultRootDir() === consts.PROJECT_ROOT
      Severity: Minor
      Found in lib/providers/base-path.provider.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 $getCurrentProjectPath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        $getCurrentProjectPath(req, unescape, home) {
          const filePath = req.editor.getPath() || '';
          let projectPath = atom.project
            .getDirectories()
            .filter(testpath => filePath.indexOf(testpath.path) > -1)
      Severity: Minor
      Found in lib/providers/base-path.provider.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

      There are no issues that match your filters.

      Category
      Status