workylab/materialize-angular

View on GitHub

Showing 15 of 68 total issues

File swiper.component.ts has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license
 * Copyright Workylab. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
Severity: Minor
Found in src/app/experimental/swiper/swiper.component.ts - About 5 hrs to fix

    SwiperComponent has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    @Component({
      selector: 'materialize-swiper',
      styleUrls: ['./swiper.component.scss'],
      templateUrl: './swiper.component.html'
    })
    Severity: Minor
    Found in src/app/experimental/swiper/swiper.component.ts - About 3 hrs to fix

      SliderComponent has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        providers: [{
          multi: true,
          provide: NG_VALUE_ACCESSOR,
          useExisting: forwardRef(() => SliderComponent)
      Severity: Minor
      Found in src/app/completed-components/slider/slider.component.ts - About 3 hrs to fix

        Function createLineLogic has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          createLineLogic(firstTag: string, middleTag: string, lastTag: string, depth: number, cycle: number): any {
            if (this.isOpeningTag(firstTag) && this.isClosingTag(middleTag)) {
              const openNode = this.createNode(firstTag, 'tag');
              const closeNode = this.createNode(middleTag, 'tag');
        
        

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

            initValues() {
              const { defaultProps } = SwiperComponent;
          
              this.index = 0;
              this.initDistance = 0;
          Severity: Minor
          Found in src/app/experimental/swiper/swiper.component.ts - About 1 hr to fix

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

            module.exports = function (config) {
              config.set({
                basePath: '',
                frameworks: ['jasmine', '@angular-devkit/build-angular'],
                plugins: [
            Severity: Minor
            Found in src/karma.conf.js - About 1 hr to fix

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

                getLastIndexToDisplay(items: Array<HTMLElement>): number {
                  let distance = 0;
                  const totalItems = items.length - 1;
              
                  for (let i = totalItems; i >= 0; i--) {
              Severity: Minor
              Found in src/app/experimental/swiper/swiper.component.ts - 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 createDots has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                createDots() {
                  this.dots = [];
              
                  let firstDot = 0;
                  let lastDot = 0;
              Severity: Minor
              Found in src/app/experimental/swiper/swiper.component.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 initValues has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                initValues() {
                  const { defaultProps } = SwiperComponent;
              
                  this.index = 0;
                  this.initDistance = 0;
              Severity: Minor
              Found in src/app/experimental/swiper/swiper.component.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

              Avoid too many return statements within this function.
              Open

                  return {
                    cycle: cycle,
                    depth: depth + 1,
                    line: this.indentNode(depth, this.createNode(firstTag, 'text'))
                  };

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

                  onChange(event: any) {
                    const files = event.target.files;
                
                    for (let i = 0; i < files.length; i++) {
                      const file = event.target.files[i];
                Severity: Minor
                Found in src/app/experimental/input-file/input-file.component.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 goToItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  goToItem(index: number, hasAnimation: boolean) {
                    const animationMs = hasAnimation
                      ? this.animationMs
                      : 0;
                
                
                Severity: Minor
                Found in src/app/experimental/swiper/swiper.component.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 getCurrentItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  getCurrentItem(): ScrollSpyItemComponent {
                    const items = this.items.toArray();
                
                    for (let i = 0; i < items.length; i++) {
                      const elementOffsetTop = getOffseTop(items[i].element.nativeElement);
                Severity: Minor
                Found in src/app/completed-components/scroll-spy/scroll-spy.component.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 actionUp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  actionUp(upEvent: any) {
                    const distanceEvent = this.supportTouchEvents()
                      ? upEvent.changedTouches[0].clientX
                      : upEvent.screenX;
                
                
                Severity: Minor
                Found in src/app/experimental/swiper/swiper.component.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 createdNested has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  createdNested(classNames: Array<string>, child: HTMLElement): HTMLElement {
                    let content = child;
                
                    if (classNames.length > 1) {
                      const newClassNames = classNames.slice(1, classNames.length);
                Severity: Minor
                Found in src/app/experimental/div-tree/div-tree.component.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