mkungla/atom-aframe

View on GitHub

Showing 13 of 13 total issues

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 listen has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        listen (cp) {
          if (!this.subscriptions) {
            this.subscriptions = new CompositeDisposable()
          } else {
            this.subscriptions.dispose()
      Severity: Minor
      Found in src/pjw.js - About 1 hr 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 check has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            check () {
              this.clear()
              return new Promise((resolve, reject) => {
                let c
                if (this.pkgj.existsSync()) {
          Severity: Minor
          Found in src/pjw.js - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              static openWebsite () {
                return atom.commands.add(
                  'atom-workspace',
                  'atom-aframe:open-website',
                  () => {
            Severity: Major
            Found in src/commands.js and 1 other location - About 1 hr to fix
            src/commands.js on lines 38..49

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              static openGithub () {
                return atom.commands.add(
                  'atom-workspace',
                  'atom-aframe:open-github',
                  () => {
            Severity: Major
            Found in src/commands.js and 1 other location - About 1 hr to fix
            src/commands.js on lines 26..36

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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

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

                async function updateVersions (npmData) {
                  console.info('updating versions...')
                  const versions = {}
                  let docsVer = 'master'
                
                
                Severity: Minor
                Found in scripts/update.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