funkwerk-mobility / cogito Goto Github PK
View Code? Open in Web Editor NEWAnalyses D code and calculates its cognitive complexity
License: Mozilla Public License 2.0
Analyses D code and calculates its cognitive complexity
License: Mozilla Public License 2.0
Assuming I have overloaded functions with different complexity:
module g.h;
import std.stdio;
void f(char x)
{
}
void f(bool x)
{
if (x)
{
bool y = !x;
if (y)
{
writeln("x, y: true");
}
else
{
writeln("x: true, y: false");
}
}
else
{
bool y = !x;
if (y)
{
writeln("x: false, y: true");
}
else
{
writeln("x, y: false");
}
}
}
The complexity of the empty function is 0, the other one 8.
I have a configuration file as well:
[g.h]
f = 10
Cogito fails with the error code 6:
test.d:5: function f: 0 (this symbol shouldn't be excluded anymore)
If the exclusion rule applies to (excludes) at least one function overload, ignore the others.
Methods of the form
int foo() => 3;
are currently not understood by Cogito. In DMD this is enabled by preview=shortenedMethods
, but Cogito doesn't understand the DMD flags.
This can be fixed by setting global.params.shortenedMethods = true;
after initializing DMD, and since it's a strict syntax addition, there shouldn't be any problem from having it always on.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.