tasknc icon indicating copy to clipboard operation
tasknc copied to clipboard

Cleanup the codebase, please!

Open matthiasbeyer opened this issue 12 years ago • 1 comments

This code is a mess.

First of all, you guys use different syntax styles.

if (foo)
    bar
if (another foo)
{
    bar;
    bla;
}

or

if (foo)
    do_somthing;
else 
{
    bar;
}

This looks like a mess.

Sencondly, there are functions in files, grouped with code they don't belong to. Example: there is a eval_rules() function in the colors.c file. I don't think this function does something with colors, when reading the prototype. If it does belong to the colors stuff, why is no documentation (or just so little) there?

This leads me to the third point: documentation! There is no documentation in the code (or very little). Why don't you use a documentation generator like (which I recommend) doxygen? It would automatically clean up your code as you would have to write comments after a given styleguide!

Other code style "issues":

Well, code style is a much of personal taste. But look:

char foo = 42, *bar, *bla = NULL;
int a = 2, b, *c, d = 12;
double some = 2.23, other, dbl = 1.0;

looks much less nice than:

char        foo;
char        *bar;
char        *bla;
int           a;
int           b;
int           *c;
int           d;
double     some;
double     other;
double     dbl;

I know it is much longer, but it's also very much easier to read.

Function length is another point. I know C programmers love long functions. But long functions are not that readable. Think about static helper functions when function length is more than 50 lines, especially if there are several (nested?) loops in the function!

Notice the 80-characters convention!

Another point: Think about compile-constants for messages which get printed to the log or stdout/stderr. This makes the code more readable!


All this stuff keeps me away from contributing! Don't get me wrong: I want to contribute, but that messy code keeps me away, as I don't get an overview that easy!

I would love to contribute code-style commits! But just if I know, you would like to merge them. If not, I don't want to put that much effort into the code! Well, I think I'm not able to write commits for documentation, but I could embellish the codebase what code style concerns.

matthiasbeyer avatar Aug 02 '13 10:08 matthiasbeyer

@matthiasbeyer More specifically, I'd love it if you contributed style commits over at my fork.

lharding avatar Oct 08 '15 00:10 lharding