cancel
Showing results for 
Search instead for 
Did you mean: 

CUBE IDE and code style checker

dieter 123
Associate III

Hi folks,

STM32CubeIde /eclipse comes with a code style checker. I just ran it. The default settings do not cover ST's code style. Is it possible to get a config file so CubeIde automatically checks for STM32s coding guidelines?

Is ST development team using any code style checker?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

If it isn't too hard, could you provide a formatter xml for "ST HAL" style and make it selectable from Preferences? Indeed this will save hassle for new users.

View solution in original post

5 REPLIES 5
dieter 123
Associate III

Hi

@Erwan LE-SAINT​ @Imen DAHMEN​ 

can one of you comment on this?

Erwan LE-SAINT
ST Employee

Hello, after checking with IDE developers, no change of setup from Eclipse preferences from CubeIDE.

Regards,

mattias norlander
ST Employee

Hi @dieter 123​,

The code style/formatting supported by CubeIDE is provided as-is from Eclipse/CDT. This means you can select between a number of different styles, you can see the options in this menu: Window > Preferences > C/C++ > Code Style > Formatter

  • K&R
  • BSD/Allman
  • GNU
  • Whitesmiths

None of these are however used internally at ST when developing the STM32Cube packages. This has legacy reasons. The Cube packages are instead closer to ANSI. Not sure which one is closest to ANSI, possibly BSD/Allman. But indentation is not correct. This can however be modifed in:

Window > Preferences > C/C++ > Code Style > Formatter > BSD/Allman > Edit > Indentation.

The formatting will however not be identical. It may be possible to setup an identical profile in Eclipse. Nothing I have tried.

It may also be possible to rely on an external tool to achieve this.

Yuan1
Associate II

This would be a very useful feature.

If it isn't too hard, could you provide a formatter xml for "ST HAL" style and make it selectable from Preferences? Indeed this will save hassle for new users.