Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup the codebase, please! #24

Open
matthiasbeyer opened this issue Aug 2, 2013 · 1 comment
Open

Cleanup the codebase, please! #24

matthiasbeyer opened this issue Aug 2, 2013 · 1 comment

Comments

@matthiasbeyer
Copy link
Contributor

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.

@lharding
Copy link
Owner

lharding commented Oct 8, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants