[Ovmsdev] Source Code Formatting

Mark Webb-Johnson mark at webb-johnson.net
Sun Mar 27 21:20:26 HKT 2016


The original code was written in Whitesmiths style, with 2 spaces (not tabs). That is my preferred style, but it is damn hard to find an auto-formatter integrated to an IDE that will support it perfectly. The MPLAB-X IDE does a reasonable job. Short description:

2 spaces indent
convert tabs to spaces
braces on their own lines

The vast majority of the OVMS code follows that.

I’ve tried to export my formatting preferences, and attach here, but not sure if it works or not. The whitesmiths.zip is just the formatting editor part of my preferences, and the whitesmiths.zip is my entire preferences. I can’t see the name ‘whitesmiths’ anywhere in the exported ZIP files, so really not sure if this export feature works or not.

Regards, Mark.




> On 25 Mar 2016, at 3:53 AM, Michael Balzer <dexter at expeedo.de <mailto:dexter at expeedo.de>> wrote:
> 
> Tom,
> 
> I'm afraid the mix of code styles is my fault... there are still parts
> in the framework I've done in my style, and my style is not always
> consistent as well.
> 
> I configured my MPLAB options to get the default style but also
> occasionally forgot to reformat my work before committing.
> 
> I've attached my formatting options export from MPLAB IDE, should be
> importable directly. Please check if you can use this.
> 
> Regards,
> Michael
> 
> 
> Am 20.03.2016 um 02:55 schrieb Tom Parker:
>> Hi,
>> 
>> I've made a few improvements to the nissan leaf code (see
>> https://carrott.org/git/Open-Vehicle-Monitoring-System.git/log/refs/heads/nissan-leaf <https://carrott.org/git/Open-Vehicle-Monitoring-System.git/log/refs/heads/nissan-leaf>
>> and the climate control branch on the same server ) and I noticed it
>> had a mix of code styles. I'd like to reformat it to be consistent
>> (mostly because I can't write consistently formatted code without a
>> code formatter) and wanted to know if there is an agreed format to use
>> -- there is nothing worse than trying to trace changes through a code
>> formatting war in the history?
>> 
>> I'm currently using the default mplabx code format configuration which
>> suits me but is different from most of the rest of the OVMS code. Is
>> there a configuration for mplabx I can import?
>> 
>> 
>> 
> 
> -- 
> Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
> Fon 02333 / 833 5735 * Handy 0176 / 206 989 26
> 
> <mplab-formatting.zip><dexter.vcf>_______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk <mailto:OvmsDev at lists.teslaclub.hk>
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev <http://lists.teslaclub.hk/mailman/listinfo/ovmsdev>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20160327/57fba64f/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: whitesmiths.zip
Type: application/zip
Size: 29791 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20160327/57fba64f/attachment-0004.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20160327/57fba64f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: whitesmiths2.zip
Type: application/zip
Size: 51833 bytes
Desc: not available
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20160327/57fba64f/attachment-0005.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20160327/57fba64f/attachment-0002.htm>


More information about the OvmsDev mailing list