Code Monkey home page Code Monkey logo

codemetrics's People

Contributors

arrow7000 avatar igorskyflyer avatar kisstkondoros avatar lostintangent avatar luchsamapparat avatar pbounaix avatar santospatrick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codemetrics's Issues

Cannot read property 'document' of undefined

I see this error a lot in production and when developing extensions it makes the debugger always break there...

Cannot read property 'document' of undefined: TypeError: Cannot read property 'document' of undefined
    at Timeout._onTimeout (/Users/jrieken/.vscode-insiders/extensions/kisstkondoros.vscode-codemetrics-1.7.0/out/editordecoration/EditorDecoration.js:40:59)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)

screen shot 2017-05-30 at 15 44 53

Code Metrics breaks custom user settings

I have to restart VS Code several times in order to keep certain user settings with this extension installed. I narrowed it down to this extension. Any way to find what is happening?

Class complexity in TS files

I want to see green complexity for classes which methods are green (4 methods with complexity 4 (green) = complexity 16 (green) for class. Not Red)

Actual:
image

Expected:
image

If any method has yellow complexity, the result for class should be yellow (the same for red)

Object literal

when i pass argument as object_literal i get a high complexity level, is their anyway to reduce the complexity level for passing arguments as object_literal because i am doing this for clarification and readability in the first place .

Feature request: scroll bar marker "decoration mode"

Great work!

I have a suggestion based on another extension I use: TODO Highlight, that has a handy marker in the right scroll column when a Todo highlight has been inserted.

It seems like a great feature to me to have that is similar to the "decoration mode" currently. It's unobtrusive, but I can easily check a file to see where I may have some fat functions, etc. I could imagine it being another flag alongside decoration mode:

  // A flag which indicates whether code metrics are shown as inline decoration
  "codemetrics.basics.DecorationModeEnabled": true,

Personally, I would probably turn off decoration mode and prefer the scroll bar decorator color as it would be out of the way of my code. Then I could scan on the right, and home-in on the more subtle code lens text.

screen shot 2017-11-16 at 11 47 14

add config option to ignore files matching a glob/pattern

It would be awesome if there was an option to tell CodeMetrics to ignore files whose path matches a glob/pattern, specifically node_modules/**/*. Often times when I drill down to the TypeScript definition or source for an npm package, VSCode will freeze for while as CodeMetrics does its work. In general, I don't really care about the metrics or complexity of a dependency. I would like to be able to tell CodeMetrics to ignore those files altogether. In the meanwhile, I am trying out codemetrics.basics.FileSizeLimitMB to see if it can be adjusted to a reasonable value that will filter out large files from dependencies without impacting my ability to analyze my own source files.

extra code

just fyi great job but is it really necessary to pack the entire vscode app on the extension?

"IfWithElseStatement" setting type incorrect

the codemetrics.nodeconfiguration.IfWithElseStatement setting expected type is string, although all other complexity settings are numbers.

See below:
image
image

VS Code: 1.10.2
CodeMetrics: 1.2.0

Some arrow functions are not displaying codelens

Arrow functions similarly written will not always display a codelense, despite having Toggle codelense for arrow functions enabled and the following setting:

"codemetrics.basics.CodeLensHiddenUnder": 0

See screenshot below:

image

VS Code: 1.10.2
CodeMetrics: 1.2.0
TypeScript: 2.2.1

Typescript - Complexity information shown on classes but not on functions

Hi, I've just installed the extension (v 1.2.0) in VS Code. It shows complexity at the top of a class declaration, but not for individual methods. Having seen the example screenshots, it may not be working as designed. I would expect complexity to be shown on top of functions. Additionally, it seems class complexity is calculated as sum of member complexities, which is arguably OK, but is there would need to be different complexity limits for classes and class memebers. (5 max limit is good for functions, but not so much for classes - code in the below example already breaks the limit.)

image

Support JSX?

Would it be possible to make this support JSX files as well?

If it's just a matter of adding checking for JavaScript React filetypes then i could have a go at it myself!

Show results in panel

Sorry if this is the wrong place to ask, but is there a way/plans to view the complexity in the bottom panel like with eslint?

[Feature request] Generate cyclomatic complexity report

Hey there,

thanks for the this awesome plugin.
I use it every day. ๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

Now I am working on a bigger project.
It has lots of huge methods and classes.
It would save me lots of time if I could simply generate a report telling me which file has classes and methods containing a complexity higher than 6 , 8 or 10,

What do you think is it possible to add this feature?

Kind regards
Greg

Is there a way to hide class complexity?

I noticed that class complexity is the sum of its parts, but I think if you're going to do that, then there needs to be some sort of acceptable baseline that isn't dependent on the calculation of the function complexity.

A class is made up of methods, properties, and potentially a constructor. The complexity of the methods themselves should play an insignificant role in the complexity of the overall Class; possibly 5% of the method complexity, rounded up towards the Class complexity threshold.

The baselines that need to be established are as follows

  • What is the complexity of the constructor?
  • What is an appropriate number of methods for a Class?
  • What is an appropriate number of properties for a Class?
    • Are the properties being set with a ternary condition?
      • What is the complexity of the operation?
    • Is a property being set with a closure?
      • What is the complexity of the operation?
    • Are there getters/setters?
      • What is the complexity of the operation?
  • When reading the code of a Class, what exactly causes the most difficulty?

I believe no matter what, this is a very subjective complexity assessment, seeing as Classes are inherently contextual. Because of this, in the interim, it would be nice to be able to hide the current vastly inaccurate assessment of Classes.

Thanks for your time โค๏ธ

Calculation always +1

I'm not sure if it's an issue or it's expected from your algorithm calculations.
Final sum is always added 1 point, seems it's putting function statement into account instead of just its body ("codemetrics.luaconfiguration.FunctionDeclaration": 1).

Please see image below, I think it's self explanatory.
screenshot_20180220_223224

text example:

function a() { return 1 }
function b(p) {
  return p ? 1 : 2
}
function c(p) { }

AFAIK, their cyclomatic complexity should be 1 for a, 2 for b, and 0 for c.

Settings to exclude folder/files from codemetrics analysis

How to exclude particular folder or file from code metric analysis.
E.g. I have a folder /dist or /build, which contains compiled js files, that I don't want to be analysed by CM, however I still see thousands of warnings in "PROBLEMS" tab for those files from codemetrics.

I don't want to exclude those folders from workspace either, I just want all code analysis tools to ignore those files.

Support arrow functions

Hi, love what you did here!

A lot of my code involves arrow functions, would you consider supporting them (if I'm missing an option to enable them)?

allow to configure for where lenses are shown

I understand metrics are important but the code lenses for arrow functions inside my code appear visually noisy to me. I'd prefer to see them member functions only and have a command that show the for others on demand.

"It"s time to do something..." appears

"It"s time to do something...", should be "It's".

Using this setting fixes it: "codemetrics.basics.ComplexityLevelNormalDescription": "It's time to do something...",

itstime

Feature request: complexity hinting on the sidelines

I this package brings something really interesting to the table; however, I simply cannot bring myself to use it with having the tiny type next to my code. Is it possible to show codemetrics' messaging via icons next to the numbers? This is a common pattern used by linters, for example.

switch case statement heavy ?

Why is this counted for 12 points?
`function textChoiceToNumber(value) {

switch (value) {
    case 1:
        return 'one';
    case 2:
        return 'two';
    case 3:
        return 'three';
    case 4:
        return 'four';
    default:
        return value;
}

}`

Possibilty to remove text

Hi,

is it possible to remove the text like "Complexity is 6 It's time to do something" above the function and just get a colored rectangle and the text is only shown as tooltip?

Best,
Phlpp

Running the contributed command:'codemetrics.showCodeMetricsCodeLensInfo' failed.

When I try to turn the Code Lens off, it doesn't work and show me the following error:

Running the contributed command:'codemetrics.showCodeMetricsCodeLensInfo' failed.

I have tried it on Ubuntu 17.10, both on the latest version of VSCode:

Version 1.18.1
Commit 929bacba01ef658b873545e26034d1a8067445e9
Date 2017-11-16T18:34:22.110Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

As well as VSCode Insiders:

Version 1.19.0-insider
Commit 89b158e11cb1c3fe94a3876222478ed2d0549fc8
Date 2017-11-24T06:14:09.459Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64

Thanks for the tool! Would be happy to provide more details!

Enable metrics for arrow functions

I've tried a couple of things but the only one that actually works is using the command "Toggle code lenses for arrow functions". I would like to set a setting in my user config so it is toggled on by default. codemetrics.basics.MetricsForArrowFunctionsToggled does not make any difference for me.

Is this already possible, if so how?

Show results in panel enable/disable?

With version 1.7.0 the codemetrics results are shown on the panel triggered by Issue: #25. Is there a way to hide them there?
If not, would it be useful to make that configurable to be able to disable that?

TypeScript code Complexity via Gulp Task

Using a Gulp tasks to compute TypeScript Code Complexity outside Visual Studio can be super helpful.
Below is a sample of how code coverage are displayed.

image

In addition, adding a configuration setting to produce a JSON or XML output will allow for the creation of a complete code metrics report. As of today I was unable to find any package for code complexity specifically for TypeScript. Please consider such a package.

Metrics

What were the metrics used as a reference?

Feature request: Skip/Suppress mechanic

It would be nice to have a certain way to ignore/suppress specific functions checks. I would like the code metric algorithm to skip certain functions by passing an ignore tag or something similar like eslint would be nice: http://eslint.org/docs/user-guide/configuring.html#configuring-rules

For an instance:

/* @cm ignore-next-function */
this.fucntionName = new Funciton()
{
 ...
}

Developing under ES3 sometimes requires larger constructs which I would manually like to ignore or skip in some way.

typing confuses things

Since the last update the extension is often very confused and gives me seemingly random metrics in wrong places (like inside bodies, on classes etc)

screen shot 2016-08-15 at 16 22 30

Support Visual Studio Code 1.9

The Visual Studio Code 1.9 throws an error after executed Toggle code metrics:

command 'codemetrics.toggleCodeMetricsDisplayed' not found

screen shot 2017-02-04 at 2 47 38 pm

Duplicate message shown

Environment data

VS Code version: 1.18.1
Code Metrics Extension version: 1.11.0

When hovering the mouse over the little coloured square, it sometimes shows duplicate messages (two or even many more), as the below one:
image

After moved it to a new file and reloaded it, but this time it shows only one message:
image

what does "complexity" mean?

... is this some standard measurement? The extension looked interesting, so I installed it, but despite having a bunch of really complex code, I pretty much only see one warning from this plugin, on a really simple section:

    function getIntentName() {
        switch (type) {
            case 'IntentRequest':
                return req.data.request.intent && req.data.request.intent.name;
            case 'LaunchRequest':
                return 'LaunchRequest';
            case 'SessionEndedRequest':
                return 'SessionEndedRequest';
            default:
                return '';
        }
    }

`return` make code complexity??

Every time add one return, the complexity will increase 1, it's a cool rule?
That's my first time know about return make code complexity, can you help me understand about this!

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.