devlato/vectorizer

View on GitHub

Showing 80 of 80 total issues

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

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

    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

    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

        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

        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

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

        debugStraghtLineControlPointRadius(straightLineControlPointRadius: PointRadius): this {
        this.options.lcpr = straightLineControlPointRadius === 'disabled' ? 0 : straightLineControlPointRadius;
         
        return this;
        }
        Severity: Major
        Found in src/imagetracer.ts and 2 other locations - About 50 mins to fix
        src/imagetracer.ts on lines 370..374
        src/imagetracer.ts on lines 416..420

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

        debugQuadraticSplineControlPointerRadius(quadraticSplineControlPointerRadius: PointRadius): this {
        this.options.qcpr = quadraticSplineControlPointerRadius === 'disabled' ? 0 : quadraticSplineControlPointerRadius;
         
        return this;
        }
        Severity: Major
        Found in src/imagetracer.ts and 2 other locations - About 50 mins to fix
        src/imagetracer.ts on lines 370..374
        src/imagetracer.ts on lines 404..408

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

        blurPreprocessingBlurRadius(blurRadius: BlurRadius): this {
        this.options.blurradius = blurRadius === 'disabled' ? 0 : blurRadius;
         
        return this;
        }
        Severity: Major
        Found in src/imagetracer.ts and 2 other locations - About 50 mins to fix
        src/imagetracer.ts on lines 404..408
        src/imagetracer.ts on lines 416..420

        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
        Severity
        Category
        Status
        Source
        Language