mkungla/atom-aframe

View on GitHub
src/autocomplete/provider.js

Summary

Maintainability
D
2 days
Test Coverage

File provider.js has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use babel'

import APRIMITIVES from '../../data/primitives.json'
import AATTRIBUTES from '../../data/attributes.json'
import ACOMPONENTS from '../../data/components.json'
Severity: Minor
Found in src/autocomplete/provider.js - About 4 hrs to fix

    Function buildMappingAttributeCompletion has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      buildMappingAttributeCompletion (attribute, tag, options, v) {
        let description, value, url, cp
        if (this.attributeDefaults) {
          value = v != null && typeof v !== 'undefined' ? v.value : null
          if (value == null && options != null && options.mapping != null) {
    Severity: Minor
    Found in src/autocomplete/provider.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

    AutocompleteProvider has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class AutocompleteProvider {
      constructor () {
        // selector (required): Defines the scope selector(s) (can be comma-separated)
        // for which your provider should receive suggestion requests
        this.selector = '.text.html, .source.js'
    Severity: Minor
    Found in src/autocomplete/provider.js - About 2 hrs to fix

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

        buildMappingAttributeCompletion (attribute, tag, options, v) {
          let description, value, url, cp
          if (this.attributeDefaults) {
            value = v != null && typeof v !== 'undefined' ? v.value : null
            if (value == null && options != null && options.mapping != null) {
      Severity: Minor
      Found in src/autocomplete/provider.js - About 1 hr to fix

        Function getComponentOrAttributeNameCompletions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          getComponentOrAttributeNameCompletions ({ prefix, editor, bufferPosition }) {
            const completions = []
            const tag = this.getPreviousTag(editor, bufferPosition)
            const tagAttributes = this.getTagAttributes(tag)
        
        
        Severity: Minor
        Found in src/autocomplete/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 getComponentOrAttributeNameCompletions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getComponentOrAttributeNameCompletions ({ prefix, editor, bufferPosition }) {
            const completions = []
            const tag = this.getPreviousTag(editor, bufferPosition)
            const tagAttributes = this.getTagAttributes(tag)
        
        
        Severity: Minor
        Found in src/autocomplete/provider.js - About 1 hr to fix

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

            isComponentOrAttributeStart ({
              prefix,
              scopeDescriptor,
              bufferPosition,
              editor
          Severity: Minor
          Found in src/autocomplete/provider.js - About 1 hr to fix

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

              getComponentValue (component) {
                if (component.value != null) {
                  return component.value
                }
                if (this.componentDefaults) {
            Severity: Minor
            Found in src/autocomplete/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