riot/compiler

View on GitHub

Showing 13 of 13 total issues

File utils.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  BINDING_REDUNDANT_ATTRIBUTE_KEY,
  BINDING_SELECTOR_KEY,
  BINDING_SELECTOR_PREFIX,
  BINDING_TEMPLATE_KEY,
Severity: Minor
Found in src/generators/template/utils.js - About 5 hrs to fix

    Function javascript has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function javascript(sourceNode, source, meta, ast) {
      const preprocessorName = getPreprocessorTypeByAttribute(sourceNode)
      const javascriptNode = addLinesOffset(
        sourceNode.text.text,
        source,
    Severity: Minor
    Found in src/generators/javascript/index.js - About 1 hr to fix

      Function createEachBinding has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function createEachBinding(
        sourceNode,
        selectorAttribute,
        sourceFile,
        sourceCode,
      Severity: Minor
      Found in src/generators/template/bindings/each.js - About 1 hr to fix

        Function createTagBinding has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function createTagBinding(
          sourceNode,
          selectorAttribute,
          sourceFile,
          sourceCode,
        Severity: Minor
        Found in src/generators/template/bindings/tag.js - About 1 hr to fix

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

          export function compile(source, opts = {}) {
            const meta = createMeta(source, opts)
            const { options } = meta
            const { code, map } = runPreprocessor(
              'template',
          Severity: Minor
          Found in src/index.js - About 1 hr to fix

            Function addComponentInterfaceToExportedObject has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function addComponentInterfaceToExportedObject(ast, componentInterface) {
              const body = getProgramBody(ast)
              const RiotComponentWrapperImportSpecifier = builders.importSpecifier(
                builders.identifier(RIOT_INTERFACE_WRAPPER_NAME),
              )
            Severity: Minor
            Found in src/generators/javascript/utils.js - About 1 hr to fix

              Function css has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function css(sourceNode, source, meta, ast) {
                const preprocessorName = getPreprocessorTypeByAttribute(sourceNode)
                const { options } = meta
                const preprocessorOutput = preprocess(
                  'css',
              Severity: Minor
              Found in src/generators/css/index.js - About 1 hr to fix

                Function createSlotBinding has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function createSlotBinding(
                  sourceNode,
                  selectorAttribute,
                  sourceFile,
                  sourceCode,
                Severity: Minor
                Found in src/generators/template/bindings/slot.js - About 1 hr to fix

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

                  function createTagWithBindings(sourceNode, sourceFile, sourceCode) {
                    const bindingsSelector = isRootNode(sourceNode)
                      ? null
                      : createBindingSelector()
                    const cloneNode = createBindingsTag(sourceNode, bindingsSelector)
                  Severity: Minor
                  Found in src/generators/template/builder.js - About 1 hr to fix

                    Function build has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function build(sourceNode, sourceFile, sourceCode, state) {
                      if (!sourceNode)
                        panic(
                          "Something went wrong with your tag DOM parsing, your tag template can't be created",
                        )
                    Severity: Minor
                    Found in src/generators/template/builder.js - About 1 hr to fix

                      Function nodeToString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function nodeToString(node) {
                        const attributes = staticAttributesToString(node)
                      
                        switch (true) {
                          case isTagNode(node):
                      Severity: Minor
                      Found in src/generators/template/utils.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 createExpression has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        sourceNode,
                        sourceFile,
                        sourceCode,
                        childNodeIndex,
                        parentNode,
                      Severity: Minor
                      Found in src/generators/template/expressions/index.js - About 35 mins to fix

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

                        export default function javascript(sourceNode, source, meta, ast) {
                          const preprocessorName = getPreprocessorTypeByAttribute(sourceNode)
                          const javascriptNode = addLinesOffset(
                            sourceNode.text.text,
                            source,
                        Severity: Minor
                        Found in src/generators/javascript/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