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

nxstyle: Does not check for braces. #525

Open
patacongo opened this issue Mar 10, 2020 · 3 comments
Open

nxstyle: Does not check for braces. #525

patacongo opened this issue Mar 10, 2020 · 3 comments
Labels
Type: Bug Something isn't working

Comments

@patacongo
Copy link
Contributor

There is no check to assure that the statements following if, else, while, and for keywords are enclosed in braces. This requirement is true if even if no statments follow or if only a single statement follows: https://cwiki.apache.org/confluence/display/NUTTX/Coding+Standard#ifthenelse

Wrong:
if (a == b)
return;

  while (foobar == 0);
@johannes-nivus
Copy link
Contributor

I'd like to have a look concerning braces, but I'm not sure if I beat a dead horse. If someone is successful with a more common tool (as discussed on mailing list) all the work would become obsolete suddenly.

@patacongo
Copy link
Contributor Author

@johannes-nivus It is important that we document shortcomings in nxstyle, whether we fix them or not. In order to implement this particular feature, some minimal syntax parsing would be required; I am not sure we want to go that route. But we definitely need an issue in place to remind us that not all coding standard issues are addresses.

There are many, many things that are not checked by nxstyle. Some that come to mind:

Non-local scope (global) varialbes must begin with g_
Structure names must end with _s, union names must end with _u, enumeration names must end with _e, typedef'e names must end with _t
All identifiers are local case except the pre-processor names are all upper case.
etc.

There are more coding standard issues that are NOT addressed than there are coding standard issues addresses. I am not familiar with any automated pretty printer than can fix such things either.

@xiaoxiang781216
Copy link
Contributor

@johannes-nivus It is important that we document shortcomings in nxstyle, whether we fix them or not. In order to implement this particular feature, some minimal syntax parsing would be required; I am not sure we want to go that route. But we definitely need an issue in place to remind us that not all coding standard issues are addresses.

There are many, many things that are not checked by nxstyle. Some that come to mind:

Non-local scope (global) varialbes must begin with g_

How about stdin/stdout/stderr? any naming rule will have exception, but the standard has the high priority than coding style.

Structure names must end with _s, union names must end with _u, enumeration names must end with _e, typedef'e names must end with _t

But we need smart here: any struct/union/enum/typedef defined by the standard need to keep as before.

All identifiers are local case except the pre-processor names are all upper case.
etc.

There are more coding standard issues that are NOT addressed than there are coding standard issues addresses. I am not familiar with any automated pretty printer than can fix such things either.

@patacongo patacongo added the Type: Bug Something isn't working label Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants