infusion-code/angular-maps

View on GitHub

Showing 50 of 396 total issues

Function SetPaths has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public SetPaths(paths: Array<Array<ILatLong>> | Array<ILatLong>): void {
        if (paths == null) { return; }
        if (!Array.isArray(paths)) { return; }
        if (paths.length === 0) {
            this._polygon.setPaths(new Array<GoogleMapTypes.LatLng>());
Severity: Minor
Found in src/models/google/google-polygon.ts - About 55 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 SetValues has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public SetValues(options: { [key: string]: any }): void {
        for (const key in options) {
            if (key !== '') {
                if (key === 'position' &&  options[key].hasOwnProperty('latitude') &&  options[key].hasOwnProperty('longitude')) {
                    options[key] = new google.maps.LatLng( options[key].latitude,  options[key].longitude);
Severity: Minor
Found in src/models/google/google-label.ts - About 55 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 CreateRoundedImageMarker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static CreateRoundedImageMarker(iconInfo: IMarkerIconInfo): string|Promise<{icon: string, iconInfo: IMarkerIconInfo}> {
        if (document == null) { throw Error('Document context (window.document) is required for rounded image markers'); }
        if (iconInfo == null || iconInfo.size == null || iconInfo.url == null) {
            throw Error('IMarkerIconInfo.size, IMarkerIconInfo.url are required for rounded image markers.');
        }
Severity: Minor
Found in src/models/marker.ts - About 55 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 CreateCanvasMarker has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected static CreateCanvasMarker(iconInfo: IMarkerIconInfo): string {
        if (document == null) { throw Error('Document context (window.document) is required for canvas markers.'); }
        if (iconInfo == null || iconInfo.size == null || iconInfo.points == null) {
            throw Error('IMarkerIconInfo.size, and IMarkerIConInfo.points are required for canvas markers.');
        }
Severity: Minor
Found in src/models/marker.ts - About 55 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 SetInfoWindowOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    private SetInfoWindowOptions(changes: { [key: string]: SimpleChange }) {
        const options: IInfoWindowOptions = {};
        if (changes['title']) { options.title = this.Title; }
        if (changes['description']) { options.description = this.Description; }
        if (changes['disableAutoPan']) { options.disableAutoPan = this.DisableAutoPan; }
Severity: Minor
Found in src/components/infobox.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 ngOnChanges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public ngOnChanges(changes: { [propName: string]: SimpleChange }): void {
        if (this._mapPromise) {
            if (changes['Box']) {
                if (this._box != null) {
                    this._mapService.SetViewOptions(<IMapOptions>{
Severity: Minor
Found in src/components/map.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 ngOnChanges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public ngOnChanges(changes: { [propName: string]: SimpleChange }): void {
        if (!this._addedToManager) { return; }
        if (changes['ClusterClickAction']) {
            throw (
                new Error('You cannot change the ClusterClickAction after the layer has been added to the layerservice.')
Severity: Minor
Found in src/components/cluster-layer.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 AddLayer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public AddLayer(layer: ClusterLayerDirective): void {
        const options: IClusterOptions = {
            id: layer.Id,
            visible: layer.Visible,
            clusteringEnabled: layer.ClusteringEnabled,
Severity: Minor
Found in src/services/google/google-cluster.service.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 AddMarker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public AddMarker(marker: MapMarkerDirective): void {
        const o: IMarkerOptions = {
            position: { latitude: marker.Latitude, longitude: marker.Longitude },
            title: marker.Title,
            label: marker.Label,
Severity: Minor
Found in src/services/bing/bing-marker.service.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

Consider simplifying this complex logical expression.
Open

        if ((changes['ShowLabels'] && !changes['ShowLabels'].firstChange) ||
            (changes['LabelMinZoom'] && !changes['LabelMinZoom'].firstChange) ||
            (changes['LabelMaxZoom'] && !changes['LabelMaxZoom'].firstChange)
        ) {
            if (this._canvas) {
Severity: Major
Found in src/components/map-polyline-layer.ts - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if ((changes['ZIndex'] && !changes['ZIndex'].firstChange) ||
                (changes['LayerOffset'] && !changes['LayerOffset'].firstChange) ||
                (changes['IconInfo'] && !changes['IconInfo'].firstChange)
            ) {
                throw (new Error('You cannot change ZIndex or LayerOffset after the layer has been created.'));
    Severity: Major
    Found in src/components/map-marker-layer.ts - About 40 mins to fix

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

          public RemoveEntity(entity: Marker): void {
              if (entity.NativePrimitve && entity.Location) {
                  const j: number = this._markers.indexOf(entity);
                  const k: number = this._pendingMarkers.indexOf(entity);
                  if (j > -1) { this._markers.splice(j, 1); }
      Severity: Minor
      Found in src/models/google/google-marker-clusterer.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 CreateScaledImageMarker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static CreateScaledImageMarker(iconInfo: IMarkerIconInfo): string|Promise<{icon: string, iconInfo: IMarkerIconInfo}> {
              if (document == null) { throw Error('Document context (window.document) is required for scaled image markers'); }
              if (iconInfo == null || iconInfo.scale == null || iconInfo.url == null) {
                  throw Error('IMarkerIconInfo.scale, IMarkerIconInfo.url are required for scaled image markers.');
              }
      Severity: Minor
      Found in src/models/marker.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 GetPolylineCentroid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static GetPolylineCentroid(path: Array<ILatLong>): ILatLong {
              let c: ILatLong = {latitude: 0, longitude: 0};
              const off = path[0];
              if (off != null) {
                  let twicearea: number = 0;
      Severity: Minor
      Found in src/models/polyline.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 CreateFontBasedMarker has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected static CreateFontBasedMarker(iconInfo: IMarkerIconInfo): string {
              if (document == null) { throw Error('Document context (window.document) is required for font based markers'); }
              if (iconInfo == null || iconInfo.fontName == null || iconInfo.fontSize == null) {
                  throw Error('IMarkerIconInfo.fontName, IMarkerIconInfo.fontSize and IMarkerIConInfo.text are required for font based markers.');
              }
      Severity: Minor
      Found in src/models/marker.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 TranslateInfoWindowOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public static TranslateInfoWindowOptions(options: IInfoWindowOptions): GoogleMapTypes.InfoWindowOptions {
              const o: GoogleMapTypes.InfoWindowOptions | any = {};
              Object.keys(options)
                  .filter(k => GoogleConversions._infoWindowOptionsAttributes.indexOf(k) !== -1)
                  .forEach((k) => {
      Severity: Minor
      Found in src/services/google/google-conversions.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 '';
      Severity: Major
      Found in src/models/map-label.ts - About 30 mins to fix

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

            protected Draw(): void {
                const projection = (<any>this).getProjection();
                const visibility: string = this.GetVisible();
                if (!projection) {
                    // The map projection is not ready yet so do nothing
        Severity: Minor
        Found in src/models/google/google-label.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 GetScriptSrc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private GetScriptSrc(callbackName: string): string {
                const protocolType: ScriptProtocol = (this._config && this._config.protocol) || DEFAULT_CONFIGURATION.protocol;
                let protocol: string;
        
                switch (protocolType) {
        Severity: Minor
        Found in src/services/bing/bing-map.api-loader.service.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 GetScriptSrc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private GetScriptSrc(hostAndPath: string, queryParams: { [key: string]: string | Array<string> }): string {
                const protocolType: ScriptProtocol =
                    <ScriptProtocol>((this._config && this._config.protocol) || ScriptProtocol.HTTPS);
                let protocol: string;
        
        
        Severity: Minor
        Found in src/services/google/google-map-api-loader.service.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