Cosmos: Use `diff` and `uncrustify` to check coding style in C++

Created on 20 Jan 2018  路  6Comments  路  Source: OpenGenus/cosmos

This is a(n):

  • [ ] New algorithm
  • [ ] Update to an existing algorithm
  • [ ] Error
  • [x] Proposal to the Repository

Details:

Prerequisite:

  1. Write a config of uncrustify for our coding style in C++.

Steps:

  1. Execute uncrustify to get right code..
  2. Execute diff with two files.
  3. The output is nothing the P.R. will be accepted or else.

Scenario:
Assume there is a source code in P.R.

int bad()
{
    return 1+2;
}

Output of uncrustify

int bad()
{
    return 1 + 2;
}

Output of diff

<    return 1+2;
---
>    return 1 + 2;

Most helpful comment

Ok, I鈥檒l fix this after 7th Feb.

All 6 comments

Could you make it such that only warning and errors are printed? Currently, too much log is printed in the C++ build, which is making it harder to find errors and warnings.

Ok, I鈥檒l fix this after 7th Feb.

@InfiniteCoder I reduced output. How does it look?

lastest commit

@iattempt There is scope for improvement. Anything that is obvious should go away. I have some suggestions, but I'm not sure if its possible to implement them.

  1. gcc compilation message should only be printed for those programs which fail.
  2. path of files created by diff does not need to be printed, as it will be created for all files anyway.

Ok,

  1. This is difficult to implement, I think we can change to shell script to do more things. also the makefile is not easy to read/write.
  2. b419761

馃敟 We need ardent men to create test files. see #3257

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CaramelHeaven picture CaramelHeaven  路  3Comments

rhendz picture rhendz  路  4Comments

vaibhavsingh97 picture vaibhavsingh97  路  3Comments

athangkanos picture athangkanos  路  4Comments

qoo2p5 picture qoo2p5  路  4Comments