aurelia/aurelia

View on GitHub

Showing 1,020 of 5,369 total issues

Avoid too many return statements within this function.
Open

        return new AST.ArrowFunction(this.hydrate(raw.parameters), this.hydrate(raw.body), this.hydrate(raw.rest));
Severity: Major
Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return new AST.ForOfStatement(this.hydrate(expr.declaration), this.hydrate(expr.iterable), this.hydrate(expr.semiIdx));
    Severity: Major
    Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return new AST.DestructuringAssignmentExpression(this.hydrate(raw.$kind), this.hydrate(raw.list), this.hydrate(raw.source), this.hydrate(raw.initializer));
      Severity: Major
      Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return new AST.PrimitiveLiteralExpression(this.hydrate(expr.value));
        Severity: Major
        Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return new AST.UnaryExpression(expr.operation, this.hydrate(expr.expression));
          Severity: Major
          Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return new AST.ObjectBindingPattern(this.hydrate(expr.keys), this.hydrate(expr.values));
            Severity: Major
            Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return new AST.TemplateExpression(this.hydrate(expr.cooked), this.hydrate(expr.expressions));
              Severity: Major
              Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return new AST.BindingBehaviorExpression(this.hydrate(expr.expression), expr.name, this.hydrate(expr.args));
                Severity: Major
                Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return new AST.Interpolation(this.hydrate(expr.cooked), this.hydrate(expr.expressions));
                  Severity: Major
                  Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return new AST.DestructuringAssignmentRestExpression(this.hydrate(raw.target), this.hydrate(raw.indexOrProperties));
                    Severity: Major
                    Found in packages/validation/src/ast-serialization.ts - About 30 mins to fix

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

                        private async handle<T extends ResponseConstructor>(p: Promise<Response>, Type?: T, handleValidationErrors?: true): Promise<ReturnType<T['create']> | ErrorRecordResponse | void> {
                          const response = await p;
                          if (response.status >= 200 && response.status < 400) {
                            if (Type === undefined) {
                              this.logger.trace(`handle() - ignoring response body`, response);
                      Severity: Minor
                      Found in examples/realworld-conventions/src/api.ts - 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

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

                        async load(slug = ''): Promise<void> {
                          if (slug === this.nextSlug) {
                            return this.loadPromise ?? undefined;
                          }
                      
                      
                      Severity: Minor
                      Found in examples/realworld-advanced/src/state.ts - 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

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

                        private async handle<T extends ResponseConstructor>(p: Promise<Response>, Type?: T, handleValidationErrors?: true): Promise<ReturnType<T['create']> | ErrorRecordResponse | void> {
                          const response = await p;
                          if (response.status >= 200 && response.status < 400) {
                            if (Type === undefined) {
                              this.logger.trace(`handle() - ignoring response body`, response);
                      Severity: Minor
                      Found in examples/realworld/src/api.ts - 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

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

                        async loading({ mode, page, tag, name }: Parameters, instruction: RoutingInstruction): Promise<void> {
                          // Component serves as three so set the right name
                          this.componentName = instruction.component.name ?? 'article-list';
                      
                          // Set the right filter to name based on component
                      Severity: Minor
                      Found in examples/realworld-conventions/src/_shared/article-list.ts - 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

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

                      export function getHooks(deferUntil, swapStrategy, phase, ...siblingTransitions) {
                        const siblingHooks: string[][] = siblingTransitions.map(sibling => getNonSiblingHooks(deferUntil, swapStrategy, phase, sibling));
                      
                        if (deferUntil === 'guard-hooks' || deferUntil === 'load-hooks') {
                          // for (let i = 0; i <= siblingHooks.length - 2; i++) {
                      Severity: Minor
                      Found in packages/__tests__/src/router/_shared/hooks.ts - 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

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

                      export function verifyRules(invocations: string[], swapStrategy: SwapStrategy, phase: string, root: string, from: string, to: string): boolean {
                        const {
                          viewports,
                          topViewport,
                          fromViewports,
                      Severity: Minor
                      Found in packages/__tests__/src/router/_shared/hook-rules.ts - 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

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

                      function assertHandlerPath(expectedPhases: number[], actualPhases: ReturnType<typeof eventPropertiesShallowClone>[]): void {
                        const expectedLen = expectedPhases.length;
                        const actualLen = actualPhases.length;
                        const errors: string[] = [];
                        if (expectedLen !== actualLen) {
                      Severity: Minor
                      Found in packages/__tests__/src/compat-v1/event-delegator.spec.ts - 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

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

                        public constructor(
                          keyConfiguration: I18nKeyConfiguration = resolve(I18nKeyConfiguration),
                          ea: EventAggregator = resolve(IEventAggregator),
                        ) {
                          super(undefined, []);
                      Severity: Minor
                      Found in packages/validation-i18n/src/localization.ts - 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

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

                        private activeChild(): boolean {
                          if (this.children) {
                            for (const child of this.children) {
                              if (child.active.startsWith('nav-active') || child.activeChild()) {
                                return true;
                      Severity: Minor
                      Found in packages/router-html/src/nav-route.ts - 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

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

                      function logOutcome(actual: any, expected: any): any {
                        const outcome = [];
                        let leftMax = 0;
                        for (let i = 0, ii = Math.max(actual.length, expected.length); i < ii; i++) {
                          // outcome.push(actual[i] !== expected[i] ? `${actual[i]} <-> ${expected[i]}` : actual[i]);
                      Severity: Minor
                      Found in packages/__tests__/src/router/runner.spec.ts - 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