Comments (7)
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.
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.
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.
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.
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.
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.
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)
- Support local installations of beautifiers HOT 3
- Add documentation to README for using Unibeautify as Node.js API HOT 7
- Option 'align_assignment' is not working in VSCode with TypeScript HOT 2
- unibeautify beautifies only in root director HOT 3
- Allow user to specify path to configuration file for a beautifier
- CTP file formatting HOT 6
- `@unibeautify/cli` ? `unibeautify-cli` ?
- Unformatted style and script tags in html HOT 2
- HTML properties incorrectly have there capitalization changed HOT 5
- Add Uncrustify beautifier support HOT 1
- Yaml definitions on Handlebars files HOT 1
- HCL HOT 1
- Liquid files with 2 Extensions handled differently HOT 1
- Nunjucks support HOT 1
- Laravel Blade Beautifier HOT 2
- Atom support HOT 1
- Action Required: Fix Renovate Configuration
- Add SystemVerilog support using Google's Verible project
- Dependency Dashboard
- Distribution Request: for VSCodium via Open VSX
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unibeautify.