Hi,
I try to use style code check from trunk/tools/ but it seems to don't work properly.
I use it for exemple with hal test file but I have the following errors:
style: identation violation at line 43 in "main.c"
style: identation violation at line 43 in "main.c"
...
style: identation violation at line 98 in "main.c"
Is there any option to set when using this tools?
Here is how i use it : perl tools/styleccheck.pl testhal/STM32/STM32F4xx/EXT/main.c
style code check tool
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: style code check tool
Hi,
The tool is not complete, I suspended working on it because I have more urgent things in queue. it will be able to perform a mass style check when it will be complete.
Giovanni
The tool is not complete, I suspended working on it because I have more urgent things in queue. it will be able to perform a mass style check when it will be complete.
Giovanni
Re: style code check tool
As another alternative, I was able to put together something to do this in about an hour using clang-format.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: style code check tool
Hi,
Probably I should better explain what I wanted to do.
It is not a reformatter, Eclipse is already able to do that and I codified the ChibiOS formatting rules in ChibiStudio.
I wist a rules driven checker able to generate a report of violations, rules would have to be something like:
- 2 spaces indent
- No tabs
- No trailing spaces
- EOL must be CRLF
- No multiple blank lines
- Single blank line after section separation comments.
- Doxygen comments before functions containing @brief, @details, @param etc
- No camel case identifiers for local variables
- No camel case identifiers for static objects
- Camel case identifiers for global symbols unless prefixed by _
- Source files must contains the sections separators part of the template.
- No defines within the struct section.
- Functions code is divided in codelets composed by a comment, statement+, single blank line.
- etc etc
Basically everything makes the ChibiOS code base look consistent. It would be used both as an acceptance tool and, for regular contributors, as a final check before submissions.
So not just a reformatter but more a quality enhancement tool.
Maybe I am just sick for this kind of things
Giovanni
Probably I should better explain what I wanted to do.
It is not a reformatter, Eclipse is already able to do that and I codified the ChibiOS formatting rules in ChibiStudio.
I wist a rules driven checker able to generate a report of violations, rules would have to be something like:
- 2 spaces indent
- No tabs
- No trailing spaces
- EOL must be CRLF
- No multiple blank lines
- Single blank line after section separation comments.
- Doxygen comments before functions containing @brief, @details, @param etc
- No camel case identifiers for local variables
- No camel case identifiers for static objects
- Camel case identifiers for global symbols unless prefixed by _
- Source files must contains the sections separators part of the template.
- No defines within the struct section.
- Functions code is divided in codelets composed by a comment, statement+, single blank line.
- etc etc
Basically everything makes the ChibiOS code base look consistent. It would be used both as an acceptance tool and, for regular contributors, as a final check before submissions.
So not just a reformatter but more a quality enhancement tool.
Maybe I am just sick for this kind of things
Giovanni
Re: style code check tool
Ok now it makes sense to write a custom tool. Artistic style has a dry-run option where it only checks but doesn't re-format the code. Unfortunately it is only able to check a few of your rules, not all.
Re: style code check tool
Hi all,
Marco, awygle, thank you for your suggestions of tools, I will take a look to when I will have some spare time.
Giovanni, no problem, the tool is not ready yet so I will do my best to respect the code style by using this guide
: http://www.chibios.org/dokuwiki/doku.ph ... tyle_guide
But I'm so curious to see the power and features of this tool when it will be finish.
Marco, awygle, thank you for your suggestions of tools, I will take a look to when I will have some spare time.
Giovanni, no problem, the tool is not ready yet so I will do my best to respect the code style by using this guide
But I'm so curious to see the power and features of this tool when it will be finish.