devlato/vectorizer

View on GitHub
src/imagetracer_v1.2.6.ts

Summary

Maintainability
F
3 wks
Test Coverage

Showing 68 of 68 total issues

File imagetracer_v1.2.6.ts has 1511 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
imagetracer.js version 1.2.6
Simple raster image tracer and vectorizer written in JavaScript.
andras@jankovics.net
*/
Severity: Major
Found in src/imagetracer_v1.2.6.ts - About 4 days to fix

    Function pathscan has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

    private pathscan(array: number[][], pathomit: number): Path[] {
    const paths: Path[] = [];
    let pacnt = 0;
    let pcnt = 0;
    let px = 0;
    Severity: Minor
    Found in src/imagetracer_v1.2.6.ts - About 1 day to fix

    Function svgpathstring has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

    svgpathstring(tracedata: TraceData, lnum: number, pathnum: number, options: Options): SVGString {
    const layer = tracedata.layers[lnum];
    const smp = layer[pathnum];
    const str: string[] = [];
     
     
    Severity: Minor
    Found in src/imagetracer_v1.2.6.ts - About 1 day to fix

    Function colorquantization has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    private colorquantization(imageData: ImageData, options: Options): ClusteredImageData {
    const array: number[][] = [];
    let idx = 0;
    let cd: number;
    let cdl: number;
    Severity: Minor
    Found in src/imagetracer_v1.2.6.ts - About 6 hrs to fix

    Function layering has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    private layering(ii: ClusteredImageData): number[][][] {
    // Creating layers for each indexed color in arr
    const layers: number[][][] = [];
    let val = 0;
    const ah = ii.array.length;
    Severity: Minor
    Found in src/imagetracer_v1.2.6.ts - About 6 hrs to fix

    Function svgpathstring has 142 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    svgpathstring(tracedata: TraceData, lnum: number, pathnum: number, options: Options): SVGString {
    const layer = tracedata.layers[lnum];
    const smp = layer[pathnum];
    const str: string[] = [];
     
     
    Severity: Major
    Found in src/imagetracer_v1.2.6.ts - About 5 hrs to fix

      ImageTracer has 34 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class ImageTracer {
      private readonly versionnumber = '1.2.6';
       
      // Loading an image from a URL, tracing when loaded,
      // then executing callback with the scaled svg string as argument
      Severity: Minor
      Found in src/imagetracer_v1.2.6.ts - About 4 hrs to fix

        Function blur has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
        Open

        blur(imgd: ImageData, radius: number, delta: number) {
        let i, j, k, d, idx, racc, gacc, bacc, aacc, wacc;
         
        // new ImageData
        const imgd2: ImageData = { width: imgd.width, height: imgd.height, data: new Uint8ClampedArray() };
        Severity: Minor
        Found in src/imagetracer_v1.2.6.ts - About 4 hrs to fix

        Function fitseq has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        private fitseq(
        path: Path,
        ltres: number,
        qtres: number,
        seqstart: number,
        Severity: Major
        Found in src/imagetracer_v1.2.6.ts - About 3 hrs to fix

          Function colorquantization has 90 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          private colorquantization(imageData: ImageData, options: Options): ClusteredImageData {
          const array: number[][] = [];
          let idx = 0;
          let cd: number;
          let cdl: number;
          Severity: Major
          Found in src/imagetracer_v1.2.6.ts - About 3 hrs to fix

            Function blur has 80 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            blur(imgd: ImageData, radius: number, delta: number) {
            let i, j, k, d, idx, racc, gacc, bacc, aacc, wacc;
             
            // new ImageData
            const imgd2: ImageData = { width: imgd.width, height: imgd.height, data: new Uint8ClampedArray() };
            Severity: Major
            Found in src/imagetracer_v1.2.6.ts - About 3 hrs to fix

              Function pathscan has 80 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              private pathscan(array: number[][], pathomit: number): Path[] {
              const paths: Path[] = [];
              let pacnt = 0;
              let pcnt = 0;
              let px = 0;
              Severity: Major
              Found in src/imagetracer_v1.2.6.ts - About 3 hrs to fix

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

                private fitseq(
                path: Path,
                ltres: number,
                qtres: number,
                seqstart: number,
                Severity: Minor
                Found in src/imagetracer_v1.2.6.ts - About 2 hrs to fix

                Function layeringstep has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                private layeringstep(ii: ClusteredImageData, cnum: number): number[][] {
                // Creating layers for each indexed color in arr
                const layer: number[][] = [];
                const ah = ii.array.length;
                const aw = ii.array[0].length;
                Severity: Minor
                Found in src/imagetracer_v1.2.6.ts - About 2 hrs to fix

                Function internodes has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                private internodes(paths: Path[], options: Options): Path[] {
                const ins: Path[] = [];
                let palen = 0;
                let nextidx = 0;
                let nextidx2 = 0;
                Severity: Major
                Found in src/imagetracer_v1.2.6.ts - About 2 hrs to fix

                  Function layering has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  private layering(ii: ClusteredImageData): number[][][] {
                  // Creating layers for each indexed color in arr
                  const layers: number[][][] = [];
                  let val = 0;
                  const ah = ii.array.length;
                  Severity: Minor
                  Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                    Function getdirection has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    getdirection(x1: number, y1: number, x2: number, y2: number): Direction {
                    let val: Direction = 8;
                    if (x1 < x2) {
                    if (y1 < y2) {
                    val = 1;
                    Severity: Minor
                    Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                    Function generatepalette has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                    private generatepalette(numberofcolors: number): Palette {
                    const palette: Palette = [];
                    let rcnt: number;
                    let gcnt: number;
                    let bcnt: number;
                    Severity: Minor
                    Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

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

                    private generatepalette(numberofcolors: number): Palette {
                    const palette: Palette = [];
                    let rcnt: number;
                    let gcnt: number;
                    let bcnt: number;
                    Severity: Minor
                    Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

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

                      private tracepath(path: Path, ltres: number, qtres: number): TracedSegment {
                      let pcnt = 0;
                      let segtype1;
                      let segtype2;
                      let seqend;
                      Severity: Minor
                      Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                      Function tracepath has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      private tracepath(path: Path, ltres: number, qtres: number): TracedSegment {
                      let pcnt = 0;
                      let segtype1;
                      let segtype2;
                      let seqend;
                      Severity: Minor
                      Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                        Function drawLayers has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        drawLayers(layers: number[][][], palette: Palette, scale: number, parentid?: string) {
                        scale = scale || 1;
                         
                        // Preparing container
                        let div: HTMLDivElement;
                        Severity: Minor
                        Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                          Function getdirection has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          getdirection(x1: number, y1: number, x2: number, y2: number): Direction {
                          let val: Direction = 8;
                          if (x1 < x2) {
                          if (y1 < y2) {
                          val = 1;
                          Severity: Minor
                          Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                            Function imagedataToTracedata has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            imagedataToTracedata(imageData: ImageData, options?: Options): TraceData {
                            const opts = this.checkoptions(options);
                             
                            // 1. Color quantization
                            const ii = this.colorquantization(imageData, opts);
                            Severity: Minor
                            Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                              Function internodes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                              private internodes(paths: Path[], options: Options): Path[] {
                              const ins: Path[] = [];
                              let palen = 0;
                              let nextidx = 0;
                              let nextidx2 = 0;
                              Severity: Minor
                              Found in src/imagetracer_v1.2.6.ts - About 1 hr to fix

                              Avoid deeply nested control flow statements.
                              Open

                              if (py - 1 < paths[pacnt].boundingbox[1]) {
                              paths[pacnt].boundingbox[1] = py - 1;
                              }
                              Severity: Major
                              Found in src/imagetracer_v1.2.6.ts - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                if (px - 1 === paths[pacnt].points[0].x && py - 1 === paths[pacnt].points[0].y) {
                                pathfinished = true;
                                 
                                // Discarding paths shorter than pathomit
                                if (paths[pacnt].points.length < pathomit) {
                                Severity: Major
                                Found in src/imagetracer_v1.2.6.ts - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                  if (px - 1 > paths[pacnt].boundingbox[2]) {
                                  paths[pacnt].boundingbox[2] = px - 1;
                                  }
                                  Severity: Major
                                  Found in src/imagetracer_v1.2.6.ts - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                    if (py - 1 > paths[pacnt].boundingbox[3]) {
                                    paths[pacnt].boundingbox[3] = py - 1;
                                    }
                                    Severity: Major
                                    Found in src/imagetracer_v1.2.6.ts - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                      if (cd < cdl) {
                                      cdl = cd;
                                      ci = k;
                                      }
                                      Severity: Major
                                      Found in src/imagetracer_v1.2.6.ts - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                        if (px - 1 < paths[pacnt].boundingbox[0]) {
                                        paths[pacnt].boundingbox[0] = px - 1;
                                        }
                                        Severity: Major
                                        Found in src/imagetracer_v1.2.6.ts - About 45 mins to fix

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

                                          private samplepalette2(numberofcolors: number, imageData: ImageData): Palette {
                                          let idx: number;
                                          const palette: Palette = [];
                                          const ni = Math.ceil(Math.sqrt(numberofcolors));
                                          const nj = Math.ceil(numberofcolors / ni);
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts - About 35 mins to fix

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

                                          getsvgstring(tracedata: TraceData, options: Options): SVGString {
                                          options = this.checkoptions(options);
                                           
                                          const w = tracedata.width * options.scale;
                                          const h = tracedata.height * options.scale;
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts - About 35 mins to fix

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

                                          imagedataToTracedata(imageData: ImageData, options?: Options): TraceData {
                                          const opts = this.checkoptions(options);
                                           
                                          // 1. Color quantization
                                          const ii = this.colorquantization(imageData, opts);
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts - About 25 mins to fix

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

                                          for (let pcnt = 0; pcnt < hsmp.segments.length; pcnt++) {
                                          const pnt = hsmp.segments[pcnt];
                                          if (pnt.x3 != null && options.qcpr) {
                                          str.push(
                                          `<circle cx="${pnt.x2 * options.scale}" cy="${pnt.y2 * options.scale}" r="${
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 2 days to fix
                                          src/imagetracer_v1.2.6.ts on lines 1541..1566

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

                                          for (let pcnt = 0; pcnt < smp.segments.length; pcnt++) {
                                          const pnt = smp.segments[pcnt];
                                          if (pnt.x3 != null && options.qcpr) {
                                          str.push(
                                          `<circle cx="${pnt.x2 * options.scale}" cy="${pnt.y2 * options.scale}" r="${
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 2 days to fix
                                          src/imagetracer_v1.2.6.ts on lines 1571..1596

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

                                          (path.points[idx3].x === path.points[idx1].x &&
                                          path.points[idx3].x === path.points[idx2].x &&
                                          path.points[idx3].y === path.points[idx4].y &&
                                          path.points[idx3].y === path.points[idx5].y) ||
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 4 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 1197..1200

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

                                          (path.points[idx3].y === path.points[idx1].y &&
                                          path.points[idx3].y === path.points[idx2].y &&
                                          path.points[idx3].x === path.points[idx4].x &&
                                          path.points[idx3].x === path.points[idx5].x)
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 4 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 1193..1196

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

                                          palette.push({
                                          r: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          g: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          b: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          a: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 4 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 731..736

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

                                          palette[k] = {
                                          r: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          g: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          b: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          a: Math.floor(Math.random() * 255) as ColorComponentValue,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 4 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 869..874

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

                                          palette.push({
                                          r: imageData.data[idx] as ColorComponentValue,
                                          g: imageData.data[idx + 1] as ColorComponentValue,
                                          b: imageData.data[idx + 2] as ColorComponentValue,
                                          a: imageData.data[idx + 3] as ColorComponentValue,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 3 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 819..824

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

                                          palette.push({
                                          r: imageData.data[idx] as ColorComponentValue,
                                          g: imageData.data[idx + 1] as ColorComponentValue,
                                          b: imageData.data[idx + 2] as ColorComponentValue,
                                          a: imageData.data[idx + 3] as ColorComponentValue,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 3 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 793..798

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

                                          imageToTracedata(imageURL: string, callback: TraceDataCallback, options?: Options) {
                                          const opts = this.checkoptions(options);
                                          // loading image, tracing and callback
                                          this.loadImage(
                                          imageURL,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 2 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 557..567

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

                                          imageToSVG(imageURL: string, callback: ResultCallback, options?: Options) {
                                          const opts = this.checkoptions(options);
                                          // loading image, tracing and callback
                                          this.loadImage(
                                          imageURL,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 2 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 580..590

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

                                          dist2 =
                                          (path.points[pcnt].x - px) * (path.points[pcnt].x - px) +
                                          (path.points[pcnt].y - py) * (path.points[pcnt].y - py);
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 2 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 1386..1388

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

                                          dist2 =
                                          (path.points[pcnt].x - px) * (path.points[pcnt].x - px) +
                                          (path.points[pcnt].y - py) * (path.points[pcnt].y - py);
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 2 hrs to fix
                                          src/imagetracer_v1.2.6.ts on lines 1337..1339

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

                                          for (let i = 0; i < numberofcolors; i++) {
                                          palette.push({
                                          r: (i * graystep) as ColorComponentValue,
                                          g: (i * graystep) as ColorComponentValue,
                                          b: (i * graystep) as ColorComponentValue,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 856..863

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

                                          for (bcnt = 0; bcnt < colorqnum; bcnt++) {
                                          palette.push({
                                          r: (rcnt * colorstep) as ColorComponentValue,
                                          g: (gcnt * colorstep) as ColorComponentValue,
                                          b: (bcnt * colorstep) as ColorComponentValue,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 840..847

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

                                          const cpx = (t1 * path.points[seqstart].x + t3 * path.points[seqend].x - path.points[fitpoint].x) / -t2,
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1374..1374

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

                                          cpy = (t1 * path.points[seqstart].y + t3 * path.points[seqend].y - path.points[fitpoint].y) / -t2;
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1373..1373

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

                                          } else if (x1 > x2) {
                                          if (y1 < y2) {
                                          val = 3;
                                          } // SW
                                          else if (y1 > y2) {
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1206..1236

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

                                          if (x1 < x2) {
                                          if (y1 < y2) {
                                          val = 1;
                                          } // SouthEast
                                          else if (y1 > y2) {
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1216..1236

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

                                          } else {
                                          str.push(spacify('M', this.roundtodec(prev.x2 * options.scale), this.roundtodec(prev.y2 * options.scale)));
                                          }
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1517..1519

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

                                          if (prev.x3 != null) {
                                          str.push(spacify('M', this.roundtodec(prev.x3 * options.scale), this.roundtodec(prev.y3 * options.scale)));
                                          } else {
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1519..1521

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

                                          [
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 544..549

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

                                          [
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 451..456

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

                                          str.push(spacify(this.roundtodec(pnt.x2 * options.scale), this.roundtodec(pnt.y2 * options.scale)));
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1529..1529

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

                                          str.push(spacify(this.roundtodec(pnt.x1 * options.scale), this.roundtodec(pnt.y1 * options.scale)));
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1527..1527

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

                                          str.push(spacify(hsmp.segments[pcnt].x2 * options.scale, hsmp.segments[pcnt].y2 * options.scale));
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1514..1514

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

                                          str.push(spacify(hsmp.segments[pcnt].x1 * options.scale, hsmp.segments[pcnt].y1 * options.scale));
                                          Severity: Major
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 1 hr to fix
                                          src/imagetracer_v1.2.6.ts on lines 1511..1511

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

                                          px = t1 * path.points[seqstart].x + t2 * cpx + t3 * path.points[seqend].x;
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 50 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 1384..1384

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

                                          py = t1 * path.points[seqstart].y + t2 * cpy + t3 * path.points[seqend].y;
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 50 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 1383..1383

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

                                          if (px - 1 > paths[pacnt].boundingbox[2]) {
                                          paths[pacnt].boundingbox[2] = px - 1;
                                          }
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 45 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 1047..1049

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

                                          if (py - 1 < paths[pacnt].boundingbox[1]) {
                                          paths[pacnt].boundingbox[1] = py - 1;
                                          }
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 45 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 1044..1046

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

                                          x: (paths[pacnt].points[pcnt].x + paths[pacnt].points[nextidx].x) / 2,
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 30 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 1177..1177

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

                                          [
                                          [0, 1, 0, -1],
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          [0, 2, -1, 0],
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 30 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 457..462

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

                                          y: (paths[pacnt].points[pcnt].y + paths[pacnt].points[nextidx].y) / 2,
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 30 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 1176..1176

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

                                          [
                                          [0, 1, 0, -1],
                                          [-1, -1, -1, -1],
                                          [-1, -1, -1, -1],
                                          [0, 2, -1, 0],
                                          Severity: Minor
                                          Found in src/imagetracer_v1.2.6.ts and 1 other location - About 30 mins to fix
                                          src/imagetracer_v1.2.6.ts on lines 538..543

                                          There are no issues that match your filters.

                                          Category
                                          Status