devlato/vectorizer

View on GitHub

Showing 41 of 80 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

        OptionsBuilder has 32 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class OptionsBuilder {
        private options: Options;
         
        static create() {
        return new OptionsBuilder();
        Severity: Minor
        Found in src/imagetracer.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

            File imagetracer.ts has 318 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable @typescript-eslint/camelcase */
            import ImageTracer, {
            BlurRadius,
            ColorComponentValue,
            ColorSampling,
            Severity: Minor
            Found in src/imagetracer.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 fromHumanReadableOptions has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    static fromHumanReadableOptions(options: HumanReadableInputOptions): OptionsBuilder {
                    const optionsBuilder = OptionsBuilder.create();
                    const { tracing, colorQuantization, layering, svgRendering, blurPreprocessing, debug, palette } = options;
                     
                    if (tracing != null) {
                    Severity: Major
                    Found in src/imagetracer.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
                          Severity
                          Category
                          Status
                          Source
                          Language