Git Product home page Git Product logo

Comments (7)

stevenzeck avatar stevenzeck commented on May 30, 2024 1

For cognitive complexity problems, here is a good read: https://docs.codeclimate.com/docs/cognitive-complexity. private isDisabledAtLine and public static getOptionsForBeautifier methods both have a higher complexity than others.

from unibeautify.

stevenzeck avatar stevenzeck commented on May 30, 2024

The most important ones are file-lines, method-lines, similar-code, and identical-code. Beautifiers with a lot of options are going to have a lot of file lines. Depending on how the beautifier needs to be implemented, method lines could also grow (ex. https://github.com/Unibeautify/beautifier-prettydiff/blob/master/src/index.ts#L39-L113). Not to mention that Unibeautify CI may also break one line into multiple for easier reading.

We can also just leave as-is and mark Invalid or Wontfix in CodeClimate.

from unibeautify.

Glavin001 avatar Glavin001 commented on May 30, 2024

I've been marking some as Invalid and Wontfix.

Not to mention that Unibeautify CI may also break one line into multiple for easier reading.

Very good point. I've been increasing the max number of lines allowed in a function in linting rules for this reason.

from unibeautify.

stevenzeck avatar stevenzeck commented on May 30, 2024

Ah good call, maybe we should configure CodeClimate to use the same rules as TSLint (if possible). Here's what it currently looks like.

CodeClimate Rule CC Config TSLint Rule TSLint Config
file-lines 250 max-file-line-count not enabled
method-lines 25 max-func-body-length 50
argument-count 4 max-func-args 3
max-line-length 140

from unibeautify.

Glavin001 avatar Glavin001 commented on May 30, 2024

The beautifier.ts file really needs some love and to be split up. I did go through many of the methods a little while ago and reduce the complexity, however, there is still a lot of work to do.

from unibeautify.

stevenzeck avatar stevenzeck commented on May 30, 2024

Apart from getOptionsForBeautifier and optionKeys I think it is fine. Those two methods have a lot of conditionals and each has a forEach. That adds to the complexity.

I'm not sure why isDisabledAtLine is considered complex. I think we can remove the below since it will be handled by the return false at the end. Maybe that's all it's talking about?

if (disableIndex === -1) {
    return false;
}

Otherwise I'll start updating CodeClimate config files to what's specified in the above comment.

from unibeautify.

stevenzeck avatar stevenzeck commented on May 30, 2024

I updated all of the repos to have the same config. I'm going through and re-enabling the fixme plugin which is still useful. Otherwise I think we're at a good spot.

from unibeautify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.