Giter Club home page Giter Club logo

Comments (2)

boyter avatar boyter commented on August 23, 2024

Woah a lot to process there. Glad you liked it.

  1. So this is something I have been toying with #43 however in the case of Angular because its inside HTML templates it can be problematic.

What would have to happen is that the file would be scanned based on extension, and then if it sees ng-whatever or whatever causes it to change logic flip and then reprocess that file. This is not a massive issue but annoying to implement. I am prepared to put the work in, but I would need to understand how each of the template languages work first so that I can make it flexible enough to work with all of them.

In short, yes its possible, but I need help before I start to tackle this one.

  1. The cost is based on the COCOMO2 model https://en.wikipedia.org/wiki/COCOMO which actually includes the cost of developing the software totally and not just the programmer cost. This means its supposed to include costs of electricity, the building you are sitting in, requirements gathering, testing etc...

COCOMO is meant to be flexible but in the case of scc this seemed like overkill and I implemented it using the following defaults "based on organic project small team, good experience working with requirements"

The numbers can seem high at times. However in the case of scc itself its pretty close. The project has existed for just over that many months and while I have done the majority of the work there have been a great many submissions from people like @dbaggerman and others.

If you can find a better model for estimating cost I will be happy to implement it.

  1. This has come up a few times. I may need to link to some good details about COCOMO which explains this.

  2. Yes, however it may be better to do so through a .ignore file in your repository. This is becoming the standard for files that you want added to your source control but to be ignored by tools such as ripgrep, scc, ag, vs-code and others. You can also do so at runtime scc --exclude-dir vendor,node_modules but I would suggest .ignore is the best approach here.

I am not opposed to adding these to the default ignore list but its not something I would want to do without really understanding the impact.

  1. Minified code can be detected. I do so in searchcode.com for example where I check the average line length. I have created #92

  2. I belive they are not currently. COCOMO only works for code as far as I am aware. Perhaps something to turn it on? I would want to see some studies working out how you cost for this before implementing though.

  3. If you can find an implementation or method for doing so. You can infer this from the complexity estimate I suppose but a formal method might be nice.

Some thoughts,

Could also add in some basic maintainability calculation perhaps?
Maintainability Index = MAX(0,(171 - 5.2 * ln(Halstead Volume)

  1. The complexity estimate is really just a number that is only comparable to files in the same language. It should not be used to compare languages directly without weighting them. The reason for this is that its calculated by looking for branch and loop statements in the code and incrementing a counter for that file.

Because some languages don't have loops and must use recursion they can have a lower complexity count. Does this mean they are less complex? Probably not, but the tool cannot see this.

If you want to do this you can run scc multiple times specifying the extension scc -i java for example and use those numbers.

Generally though the complexity there is to help estimate between projects written in the same language, or for finding the most complex file in a project scc --by-file -s complexity which can be useful when you are estimating on how hard something is to maintain.

I am totally turning the above into a post about how it works, because you are not the first person to ask this. https://github.com/boyter/scc#complexity-estimates

  1. The tool is unaware that some code may generate other code. As such its complexity will totally be down to how many branch/loop conditions are in it. In practice though such code usually has a lot of these conditions and is the most complex when counted.

  2. See 9.

  3. No. Can macros be counted... not sure. Can you provide an example of how this would work. Config files... can you provide a real example.

  4. No worries. Its good for me to walk though how I expect the tool to work vs what peoples perception is.

from scc.

boyter avatar boyter commented on August 23, 2024

Going to close this as no response in a while. Going to assume everything was answered to satisfaction.

Random note I am toying with the maintainability index calculation. Would be something that appears in the JSON or wide output.

from scc.

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.