f



Can you please name a tool to check C/C++ source code against a set of coding standards?

I am not looking for a lint-like static code analyzer, I would like to check against coding standards like variable naming, capitalization, spacing, identation, bracket placement, and so on.
0
Ashim
2/24/2016 9:43:23 AM
comp.lang.c 30656 articles. 5 followers. spinoza1111 (3246) is leader. Post Follow

5 Replies
1107 Views

Similar Articles

[PageSpeed] 7

On 2016-02-24, Ashim Goldar <ashim.goldar@gmail.com> wrote:
> I am not looking for a lint-like static code analyzer, I would like to
> check against coding standards like variable naming, capitalization,
> spacing, identation, bracket placement, and so on.

If you are looking for something open source, you could try cppcheck [1].
It runs on Windows, OSX, Linux, BSD and is quite configurable. Supports
both C and C++ and has a fairly extensive list of checks [2].

[1] http://cppcheck.sourceforge.net/
[2] https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/
0
Jeff
3/11/2016 6:59:06 AM
On 2016-03-11, Jeff Parent <jeff@commentedcode.org> wrote:
> On 2016-02-24, Ashim Goldar <ashim.goldar@gmail.com> wrote:
>> I am not looking for a lint-like static code analyzer, I would like to
>> check against coding standards like variable naming, capitalization,
>> spacing, identation, bracket placement, and so on.
>
> If you are looking for something open source, you could try cppcheck [1].
> It runs on Windows, OSX, Linux, BSD and is quite configurable. Supports
> both C and C++ and has a fairly extensive list of checks [2].
>
> [1] http://cppcheck.sourceforge.net/
> [2] https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/

Sorry, just realized you were looking for style and not lint.

You should take a look at vera++ [1]. It is more of a style checker and
doesn't do your typical linting. vera++ parses the code into data
structures and relies on you writing scripts to do the validation so
you'll have to do the work of defining your coding standard.

[1] https://bitbucket.org/verateam/vera/wiki/Introduction
0
Jeff
3/11/2016 7:13:30 AM
On 11/03/16 08:13, Jeff Parent wrote:
> On 2016-03-11, Jeff Parent <jeff@commentedcode.org> wrote:
>> On 2016-02-24, Ashim Goldar <ashim.goldar@gmail.com> wrote:
>>> I am not looking for a lint-like static code analyzer, I would like to
>>> check against coding standards like variable naming, capitalization,
>>> spacing, identation, bracket placement, and so on.
>>
>> If you are looking for something open source, you could try cppcheck [1].
>> It runs on Windows, OSX, Linux, BSD and is quite configurable. Supports
>> both C and C++ and has a fairly extensive list of checks [2].
>>
>> [1] http://cppcheck.sourceforge.net/
>> [2] https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/
> 
> Sorry, just realized you were looking for style and not lint.
> 
> You should take a look at vera++ [1]. It is more of a style checker and
> doesn't do your typical linting. vera++ parses the code into data
> structures and relies on you writing scripts to do the validation so
> you'll have to do the work of defining your coding standard.
> 
> [1] https://bitbucket.org/verateam/vera/wiki/Introduction
> 

That looks like an interesting project, and worth investigating further.
 Have you used it much?

0
David
3/11/2016 8:47:21 AM
On 2016-03-11, David Brown <david.brown@hesbynett.no> wrote:
> On 11/03/16 08:13, Jeff Parent wrote:
>> On 2016-03-11, Jeff Parent <jeff@commentedcode.org> wrote:
>>> On 2016-02-24, Ashim Goldar <ashim.goldar@gmail.com> wrote:
>>>> I am not looking for a lint-like static code analyzer, I would like to
>>>> check against coding standards like variable naming, capitalization,
>>>> spacing, identation, bracket placement, and so on.
>>>
>>> If you are looking for something open source, you could try cppcheck [1].
>>> It runs on Windows, OSX, Linux, BSD and is quite configurable. Supports
>>> both C and C++ and has a fairly extensive list of checks [2].
>>>
>>> [1] http://cppcheck.sourceforge.net/
>>> [2] https://sourceforge.net/p/cppcheck/wiki/ListOfChecks/
>> 
>> Sorry, just realized you were looking for style and not lint.
>> 
>> You should take a look at vera++ [1]. It is more of a style checker and
>> doesn't do your typical linting. vera++ parses the code into data
>> structures and relies on you writing scripts to do the validation so
>> you'll have to do the work of defining your coding standard.
>> 
>> [1] https://bitbucket.org/verateam/vera/wiki/Introduction
>> 
>
> That looks like an interesting project, and worth investigating further.
>  Have you used it much?
>

Very little. A contractor had it setup in a build environment that I was
borrowing and it worked nicely. But he was one of those guys that if
some functionality didn't exist in a utility, he'd write it in so YMMV.
But now that you brought it up I might have to look into setting it up
again. Currently project has a dozen or so developers and apparently
none of them have read our (atrocious) coding standard.
0
Jeff
3/11/2016 4:26:48 PM
On 3/11/16 10:26 AM, Jeff Parent wrote:
> ... But he was one of those guys that if some
 > functionality didn't exist in a utility,
 > he'd write it in ...

Oh, I remember those guys. I think they were called
programmers. ;-)


-- 
Randy Howard
(replace the obvious text in the obvious way if you wish to contact me 
directly)
0
Randy
3/11/2016 6:08:25 PM
Reply: