prefeiturasp/SME-PratoAberto-Frontend

View on GitHub

Showing 72 of 72 total issues

File markerclusterer.js has 561 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @name MarkerClusterer for Google Maps v3
 * @version version 1.0.1
 * @author Luke Mahe
 * @fileoverview
Severity: Major
Found in src/app/vendors/markerclusterer.js - About 1 day to fix

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

    describe('SearchComponent', () => {
      let component: SearchComponent;
      let fixture: ComponentFixture<SearchComponent>;
    
      beforeEach(async(() => {
    Severity: Major
    Found in src/app/search/search.component.spec.ts and 2 other locations - About 6 hrs to fix
    src/app/home/home.component.spec.ts on lines 5..25
    src/app/school/school.component.spec.ts on lines 5..25

    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 158.

    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 3 locations. Consider refactoring.
    Open

    describe('SchoolComponent', () => {
      let component: SchoolComponent;
      let fixture: ComponentFixture<SchoolComponent>;
    
      beforeEach(async(() => {
    Severity: Major
    Found in src/app/school/school.component.spec.ts and 2 other locations - About 6 hrs to fix
    src/app/home/home.component.spec.ts on lines 5..25
    src/app/search/search.component.spec.ts on lines 5..25

    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 158.

    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 3 locations. Consider refactoring.
    Open

    describe('HomeComponent', () => {
      let component: HomeComponent;
      let fixture: ComponentFixture<HomeComponent>;
    
      beforeEach(async(() => {
    Severity: Major
    Found in src/app/home/home.component.spec.ts and 2 other locations - About 6 hrs to fix
    src/app/school/school.component.spec.ts on lines 5..25
    src/app/search/search.component.spec.ts on lines 5..25

    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 158.

    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

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

    import { Globals } from './../app.globals';
    import { AppUtils } from './../app.utils';
    import { WindowRef } from './../WindowRef';
    import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChange, ElementRef, AfterViewInit } from '@angular/core';
    import {MyDate, MyMonth} from './datepicker.component.interface';
    Severity: Minor
    Found in src/app/datepicker/datepicker.component.ts - About 5 hrs to fix

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

          prevMonth():void {
              let m = this.visibleMonth.monthNbr;
              let y = this.visibleMonth.year;
              if (m === 1) {
                  m = 12;
      Severity: Major
      Found in src/app/datepicker/datepicker.component.ts and 1 other location - About 4 hrs to fix
      src/app/datepicker/datepicker.component.ts on lines 243..255

      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 121.

      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

          nextMonth():void {
              let m = this.visibleMonth.monthNbr;
              let y = this.visibleMonth.year;
              if (m === 12) {
                  m = 1;
      Severity: Major
      Found in src/app/datepicker/datepicker.component.ts and 1 other location - About 4 hrs to fix
      src/app/datepicker/datepicker.component.ts on lines 229..241

      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 121.

      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 createMonth has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          createMonth(m:number, y:number): void {
              this.dates.length = 0;
              this.olderCount = 0;
              let monthStart = this.monthStartIdx(y, m);
              let dInThisM = this.daysInMonth(m, y);
      Severity: Minor
      Found in src/app/datepicker/datepicker.component.ts - About 4 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 school.component.ts has 309 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { CalendaryService } from './../calendary.service';
      import { Globals } from './../app.globals';
      import { Component, OnInit, ɵConsole } from '@angular/core';
      import { ActivatedRoute, Router } from '@angular/router';
      import { DatePipe } from '@angular/common';
      Severity: Minor
      Found in src/app/school/school.component.ts - About 3 hrs to fix

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

                  doc.addEventListener('click', (event) => {
                      if (this.showSelector && event.target && this.elem.nativeElement !== event.target && !this.elem.nativeElement.contains(event.target)) {
                          this.showSelector = false;
                      }
                  }, false);
        Severity: Major
        Found in src/app/datepicker/datepicker.component.ts and 1 other location - About 3 hrs to fix
        src/app/datepicker/datepicker.component.ts on lines 92..96

        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 95.

        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

                  doc.addEventListener('click', (event) => {
                      if (this.showSelector && event.target && this.elem.nativeElement !== event.target && !this.elem.nativeElement.contains(event.target)) {
                          this.showSelector = true;
                      }
                  }, true);
        Severity: Major
        Found in src/app/datepicker/datepicker.component.ts and 1 other location - About 3 hrs to fix
        src/app/datepicker/datepicker.component.ts on lines 100..104

        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 95.

        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

        DatepickerComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        @Component({
            selector: 'responsive-date-picker',
            templateUrl: './datepicker.component.html',
            styleUrls: ['./datepicker.component.scss']
        })
        Severity: Minor
        Found in src/app/datepicker/datepicker.component.ts - About 2 hrs to fix

          SchoolComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

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

            Function ngOnInit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                ngOnInit() {
                  this.dayLabels = this.options.dayLabels !== undefined ? this.options.dayLabels : this.dayLabels;
                  this.monthLabels = this.options.monthLabels !== undefined ? this.options.monthLabels : this.monthLabels;
                  this.dateFormat = this.options.dateFormat !== undefined ? this.options.dateFormat : this.dateFormat;
                  this.todayBtnTxt = this.options.todayBtnTxt !== undefined ? this.options.todayBtnTxt : this.todayBtnTxt;
            Severity: Minor
            Found in src/app/datepicker/datepicker.component.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 createMonth has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                createMonth(m:number, y:number): void {
                    this.dates.length = 0;
                    this.olderCount = 0;
                    let monthStart = this.monthStartIdx(y, m);
                    let dInThisM = this.daysInMonth(m, y);
            Severity: Major
            Found in src/app/datepicker/datepicker.component.ts - About 2 hrs to fix

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

              describe('SchoolsService', () => {
                beforeEach(() => {
                  TestBed.configureTestingModule({
                    providers: [SchoolsService]
                  });
              Severity: Major
              Found in src/app/schools.service.spec.ts and 1 other location - About 2 hrs to fix
              src/app/calendary.service.spec.ts on lines 5..15

              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 85.

              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

              describe('CalendaryService', () => {
                beforeEach(() => {
                  TestBed.configureTestingModule({
                    providers: [CalendaryService]
                  });
              Severity: Major
              Found in src/app/calendary.service.spec.ts and 1 other location - About 2 hrs to fix
              src/app/schools.service.spec.ts on lines 5..15

              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 85.

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

                getCalendary(date, unit, attendance, grouping) {
                  let self = this;
                  console.log(self.currentSchool.nome);
                  //this.calendaryService.get(date, unit, attendance, grouping)
                  this.calendaryService.getWithSchool(date, unit, attendance, grouping,self.currentSchool.nome)
              Severity: Major
              Found in src/app/school/school.component.ts - About 2 hrs to fix

                Function createCarousel has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    createCarousel(){
                      this.timelineCarousel = this.winRef.nativeWindow.$(".timeline-carousel").owlCarousel({
                        center: true,
                        items: 4,
                        dots: false,
                Severity: Minor
                Found in src/app/datepicker/datepicker.component.ts - About 1 hr to fix

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

                      let endStr = "" + currWeekByDate[4].getFullYear() + this.preZero(currWeekByDate[4].getMonth() + 1) + this.preZero(currWeekByDate[4].getDate());
                  Severity: Major
                  Found in src/app/school/school.component.ts and 1 other location - About 1 hr to fix
                  src/app/school/school.component.ts on lines 320..320

                  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 72.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language