awesome-algorand/nft-bitmap

View on GitHub
packages/nft-bitmap-react/src/controllers/Pixelizer.ts

Summary

Maintainability
B
4 hrs
Test Coverage
F
4%

Showing 3 of 3 total issues

File Pixelizer.ts has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
* Pixelizer - convert an image to Pixel Art, with/out grayscale and based on a color palette.
* @author José Moreira @ <https://github.com/giventofly/pixelit>
* @author Michael Feher @ <https://github.com/PhearZero>
**/
Severity: Minor
Found in packages/nft-bitmap-react/src/controllers/Pixelizer.ts - About 2 hrs to fix

    Function pixelate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    pixelate() {
    const tempCanvas = document.createElement("canvas");
     
    if(!this.drawfrom) throw new Error(DRAWFROM_NOT_DEFINED_MESSAGE)
    if(!this.drawto) throw new Error(DRAWTO_NOT_DEFINED_MESSAGE)
    Severity: Minor
    Found in packages/nft-bitmap-react/src/controllers/Pixelizer.ts - About 1 hr to fix

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

    resizeImage() {
    if(!this.drawto) throw new Error(DRAWTO_NOT_DEFINED_MESSAGE)
    if(!this.ctx) throw new Error(CONTEXT_NOT_DEFINED_MESSAGE)
     
    //var ctx = canvas.getContext("2d")
    Severity: Minor
    Found in packages/nft-bitmap-react/src/controllers/Pixelizer.ts - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status