Anonymous | Login | Signup for a new account | 2021-01-21 23:09 UTC | ![]() |
Main | My View | View Issues | Roadmap | Repositories |
View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0000434 | Firmware | Structure / Style | public | 2011-11-26 15:31 | 2012-06-30 09:29 | ||||
Reporter | Fred | ||||||||
Assigned To | Fred | ||||||||
Priority | normal | Severity | minor | Reproducibility | N/A | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | 0.2.0-SNAPSHOT | ||||||||
Target Version | 0.2.0 | Fixed in Version | 0.2.0 | ||||||
Summary | 0000434: Clean Up All White Space | ||||||||
Description | Indenting with tabs, always. Tabs only to be used for indenting, no where else. Comments should only span blocks with the same indentation and should be indented from the code with spaces. Macro blocks back filled with whitespace should not use tabs at all. line count between various things should be standardised more. It's not bad, but could be better. | ||||||||
Tags | No tags attached. | ||||||||
FirmwareVersion | |||||||||
Issue Type | Task | ||||||||
Risk of Breakage | very low | ||||||||
Attached Files | ![]() ![]() | ||||||||
![]() |
|
![]() Fred (administrator) 2012-04-10 11:08 |
Came up with a grep command to find tabs used post tokens and not as indentation, only 80 offending lines in src/*.c. More in other files (400 total) but didn't check those, they could be false positives on ASM and linker scripts etc. Will get that into a commit soon. |
![]() Fred (administrator) 2012-05-03 22:34 |
find . -name "*.c" -or -name "*.h" | xargs grep -rn "[:space:].*[ ]"|wc where the space between the last [] pair is a real tab entered by hitting ctrl v and then the tab. |
![]() Fred (administrator) 2012-05-03 22:39 |
The above only works on the Mac OS X grep/bash, apparently. Fails on Linux. |
![]() Fred (administrator) 2012-06-26 16:23 |
Mac has 2.5.1 and Deb currently has 2.8 - this is a clue. |
![]() Fred (administrator) 2012-06-26 23:45 |
find . -name "*.c" -or -name "*.h" | xargs cat | perl -ne 'chomp;print "$_\n" if /[^^\s]\t+/' Courtesy of AncientGeek! Thanks! :-) Just needs line numbers and file names and it's good to go. |
![]() Fred (administrator) 2012-06-27 10:43 |
find . -name "*.c" -or -name "*.h" | xargs ./tabsnotatbol To be run in src/ with the two files that I am about to attach placed in src/ too. Supplied by AncientGeek and tweaked only slightly by me and work well enough. Thank you AncientGeek! |
![]() Fred (administrator) 2012-06-27 11:57 |
In vim you can run :%s/\v([^\t]+)\t+/\4 /g to turn each tab that isn't leading into 4 spaces. Thanks to masterkorp for that. It changes stuff it shouldn't, but using a difftool it's easy to revert that. |
![]() Fred (administrator) 2012-06-27 16:30 |
Fixed in 7945946638ac06ab9cb529cca753ad2711ae9cc1 creating a new issue to remove all commented out code. |
![]() Fred (administrator) 2012-06-30 09:29 |
New issue is 0000601 for reference. Another option: Karsten: I'd use perl for this, like this: perl -lpe 's/(^)?(\t+)/defined($1)?$2:" "/eg' That will replace any non-leading group of tabs with a single space, and replace leading tabs with themselves, i.e. leave them untouched. Fred: I guess that's a good idea, provided that it's in source control, and everything is committed. Then I can just git diff it afterward to find the issues and git reset if I don't want to fix them. |
Copyright © 2000 - 2011 MantisBT Group |