MaxMilton/ekscss

View on GitHub

Showing 15 of 20 total issues

Function tokenize has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
Open

export function tokenize(
  input: Input & { error: (message: string, pos?: number) => void },
  options: TokenizeOptions = {},
): Tokenizer {
  const css = input.css.valueOf();
Severity: Minor
Found in packages/postcss-ekscss/src/tokenize.ts - About 2 days 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 tokenize has 238 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function tokenize(
  input: Input & { error: (message: string, pos?: number) => void },
  options: TokenizeOptions = {},
): Tokenizer {
  const css = input.css.valueOf();
Severity: Major
Found in packages/postcss-ekscss/src/tokenize.ts - About 1 day to fix

    Function nextToken has 175 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function nextToken(opts?: { ignoreUnclosed?: boolean }): Token | void {
        if (returned.length > 0) return returned.pop();
        if (pos >= len) return undefined;
    
        const ignoreUnclosed = opts ? opts.ignoreUnclosed : false;
    Severity: Major
    Found in packages/postcss-ekscss/src/tokenize.ts - About 7 hrs to fix

      Function exports has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = async (src, dest, opts) => {
        // Load user defined config or fall back to default file locations
        const result = await joycon.load(opts.config ? [opts.config] : undefined);
      
        if (!result.path && !opts.quiet) {
      Severity: Major
      Found in packages/cli/index.js - About 3 hrs to fix

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

        // eslint-disable-next-line @typescript-eslint/ban-ts-comment
        // @ts-nocheck 😢
        /* eslint-disable @typescript-eslint/no-unsafe-call */
        /* eslint-disable @typescript-eslint/no-unsafe-member-access */
        /* eslint-disable @typescript-eslint/no-unsafe-return */
        Severity: Minor
        Found in packages/framework/config.js - About 3 hrs to fix

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

          module.exports = async (src, dest, opts) => {
            // Load user defined config or fall back to default file locations
            const result = await joycon.load(opts.config ? [opts.config] : undefined);
          
            if (!result.path && !opts.quiet) {
          Severity: Minor
          Found in packages/cli/index.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

          File tokenize.ts has 286 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Based on https://github.com/postcss/postcss-scss/blob/f540beae6530b7c9632f954e4d6915359a54f25f/lib/scss-tokenize.js
          
          // TODO: Tokenize xcss tagged template literals within XCSS expressions
          
          import type { Input } from 'postcss';
          Severity: Minor
          Found in packages/postcss-ekscss/src/tokenize.ts - About 2 hrs to fix

            Function accessorsProxy has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            export function accessorsProxy<
              T extends Record<string, unknown> | UndefinedProperty,
            >(obj: T, parentPath: string): T {
              for (const key in obj) {
                if (has.call(obj, key)) {
            Severity: Minor
            Found in packages/ekscss/src/helpers.ts - 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

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

            export function xcss(
              template: TemplateStringsArray,
              ...expressions: XCSSExpression[]
            ): string {
              const strings = template.raw;
            Severity: Minor
            Found in packages/ekscss/src/helpers.ts - 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 accessorsProxy has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function accessorsProxy<
              T extends Record<string, unknown> | UndefinedProperty,
            >(obj: T, parentPath: string): T {
              for (const key in obj) {
                if (has.call(obj, key)) {
            Severity: Minor
            Found in packages/ekscss/src/helpers.ts - About 1 hr to fix

              Function xcss has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function xcss(
                template: TemplateStringsArray,
                ...expressions: XCSSExpression[]
              ): string {
                const strings = template.raw;
              Severity: Minor
              Found in packages/ekscss/src/helpers.ts - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if (
                          escape &&
                          code !== SLASH &&
                          code !== SPACE &&
                          code !== NEWLINE &&
                Severity: Major
                Found in packages/postcss-ekscss/src/tokenize.ts - About 1 hr to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (brackets === 0) break;
                  Severity: Major
                  Found in packages/postcss-ekscss/src/tokenize.ts - About 45 mins to fix

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

                    export function compile(
                      code: string,
                      {
                        from,
                        to,
                    Severity: Minor
                    Found in packages/ekscss/src/compiler.ts - 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 resolveGlobals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function resolveGlobals(obj) {
                      /** @type {ResolvedExpressionOrNested} */
                      const resolved = {};
                    
                      // eslint-disable-next-line no-restricted-syntax
                    Severity: Minor
                    Found in packages/framework/utils.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