It appears that each time I come back to working on Geeqie, I send one
of these emails ;o)
Here are threads #1 and #2:
#1: https://sourceforge.net/p/geeqie/mailman/message/22531197/
#2: https://sourceforge.net/p/geeqie/mailman/message/27441283/
In #2, I had created a one-liner to compute a line-length histogram our
codebase. I've rerun it and included the results below as [1]. If also
attached a list of max-line-length by source file. As of my git clone
from earlier this week, Geeqie has 106k lines. 227 of those lines are
over 160 characters. That's 0.2%
I am willing to change those 227 lines by hand if it means we can commit
to a line length limit of 160 characters.
But beyond that, ClangFormat exists now. Because it's part of Clang,
and actually lexes/parses the C language, it can make actual
semantically-driven decisions about how a piece of source code should
look. This means that _if_ we decide on some style, ClangFormat should
make it relatively straightforward to update the codebase in one fell
swoop. (And FYI, the C++ standard at Google, where I work, is to run
all code through ClangFormat, with exceptions specified as per [2])
With that said, I would love for us to get away from a style that
encourages us to mix tabs and spaces. See, for instance, [3]. There is
no way to match an arbitrary paren on the prior line without using
spaces for some indentation. But if our style is to use tabs for most
indentation, it either means that you can't match the exact paren offset
from the previous line, or you have to mix tabs and spaces.
My personal preference would be to switch to using spaces for all
indentation, but I would be okay with using tabs for all indentation as
well, so long as we avoid situations where the tabs need to be padded
with spaces.
--xsdg
[1] Note that keymap_template.c is a C-wrapped XML file, which is why I
exclude it.
$ruby -e 'lc = Hash.new{|h,k| h[k] = 0}; ARGV.each{|f|
File.new(f).each_line{|l| l.gsub!(/\t/, " "*8); lc[l.length/10] += 1}};
csum = 0; lc.sort.each{|(x,y)| csum += y; printf "%3d-%3d: %s %d\n",
10*x, 10*(x+1)-1, y.to_s.ljust(5), csum}' $(\ls *.c *.h *.cc | grep -v
keymap_template.c)
0- 9: 30198 30198
10- 19: 9074 39272
20- 29: 14334 53606
30- 39: 13148 66754
40- 49: 9292 76046
50- 59: 7223 83269
60- 69: 7534 90803
70- 79: 6587 97390
80- 89: 3974 101364
90- 99: 2194 103558
100-109: 1254 104812
110-119: 681 105493
120-129: 355 105848
130-139: 143 105991
140-149: 64 106055
150-159: 39 106094
160-169: 28 106122
170-179: 22 106144
180-189: 32 106176
190-199: 38 106214
200-209: 64 106278
210-219: 36 106314
220-229: 7 106321
[2]
http://clang.llvm.org/docs/ClangFormatStyleOptions.html#disabling-formatting-on-a-piece-of-code
[3]
http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=blob;f=src/pan-types.h;h=de114bf5111ff7d676ac3fad8c70d630f5f10ccb;hb=HEAD#l274
["keymap_template.c", 404]
["rcfile.c", 226]
["rcfile.h", 214]
["ui_tree_edit.c", 201]
["filefilter.c", 192]
["utilops.c", 188]
["image_load_tiff.c", 187]
["image_load_jpeg.c", 187]
["image_load_gdk.c", 186]
["preferences.c", 175]
["filefilter.h", 175]
["editors.c", 171]
["layout_util.c", 167]
["metadata.h", 166]
["metadata.c", 165]
["utilops.h", 162]
["image-load.h", 161]
["bar_histogram.c", 161]
["renderer-tiles.c", 160]
["bar_keywords.c", 160]
["jpeg_parser.c", 157]
["bar_comment.c", 156]
["filedata.h", 155]
["filedata.c", 154]
["main.c", 153]
["image-load.c", 149]
["view_file_list.c", 148]
["compat.h", 147]
["secure_save.c", 146]
["ui_fileops.c", 145]
["main.h", 143]
["print.c", 142]
["editors.h", 142]
["dupe.c", 142]
["pixbuf-renderer.h", 141]
["debug.c", 140]
["cellrenderericon.h", 139]
["view_file.c", 138]
["pixbuf-renderer.c", 138]
["image.c", 138]
["bar_exif.c", 137]
["image-overlay.c", 136]
["view_file.h", 135]
["remote.c", 135]
["layout.c", 134]
["view_dir.h", 133]
["typedefs.h", 133]
["histogram.h", 131]
["exiv2.cc", 131]
["histogram.c", 130]
["view_file_icon.c", 128]
["compat.c", 128]
["collect-table.c", 128]
["bar.c", 128]
["layout.h", 127]
["ui_tabcomp.h", 126]
["exif.c", 126]
["ui_tabcomp.c", 125]
["collect-io.c", 124]
["bar_histogram.h", 124]
["bar_keywords.h", 123]
["search.c", 122]
["layout_image.c", 122]
["bar_exif.h", 122]
["bar_comment.h", 122]
["ui_menu.h", 121]
["ui_menu.c", 121]
["cellrenderericon.c", 121]
["trash.c", 120]
["bar_gps.c", 120]
["cache.c", 119]
["bar_sort.h", 118]
["bar_gps.h", 118]
["pixbuf_util.c", 117]
["bar_sort.c", 117]
["menu.h", 116]
["layout_image.h", 116]
["thumb_standard.h", 115]
["similar.c", 115]
["menu.c", 115]
["view_dir_tree.c", 114]
["ui_tree_edit.h", 114]
["thumb_standard.c", 114]
["bar.h", 114]
["ui_pathsel.c", 112]
["renderer-clutter.c", 112]
["fullscreen.h", 112]
["fullscreen.c", 112]
["view_dir_list.c", 111]
["ui_misc.c", 111]
["thumb.c", 111]
["img-view.c", 111]
["collect.c", 111]
["slideshow.h", 110]
["slideshow.c", 110]
["format_nikon.h", 110]
["desktop_file.c", 110]
["cache_maint.c", 110]
["view_dir.c", 109]
["view_dir_tree.h", 108]
["thumb.h", 108]
["pan-view.c", 108]
["ui_utildlg.c", 107]
["ui_pathsel.h", 107]
["format_fuji.h", 107]
["format_canon.c", 107]
["exif-common.c", 107]
["collect-dlg.c", 107]
["ui_utildlg.h", 106]
["remote.h", 106]
["pan-item.c", 106]
["image.h", 106]
["format_olympus.c", 106]
["color-man.c", 106]
["ui_bookmark.c", 105]
["pan-calendar.c", 105]
["pixbuf_util.h", 104]
["format_nikon.c", 104]
["exif.h", 104]
["advanced_exif.c", 104]
["misc.c", 103]
["layout_config.c", 103]
["format_raw.c", 103]
["collect.h", 103]
["format_fuji.c", 101]
["window.c", 99]
["uri_utils.h", 99]
["dnd.h", 99]
["uri_utils.c", 98]
["format_canon.h", 98]
["dnd.c", 98]
["collect-io.h", 98]
["ui_misc.h", 97]
["ui_fileops.h", 97]
["cache.h", 97]
["pan-item.h", 96]
["color-man.h", 96]
["preferences.h", 94]
["pan-types.h", 94]
["similar.h", 93]
["history_list.h", 93]
["debug.h", 93]
["ui_help.c", 92]
["pan-folder.c", 92]
["history_list.c", 92]
["format_raw.h", 92]
["filecache.c", 92]
["logwindow.c", 90]
["secure_save.h", 89]
["pan-grid.c", 89]
["collect-table.h", 89]
["lua.c", 88]
["ui_spinner.c", 87]
["print.h", 87]
["view_file_list.h", 86]
["view_file_icon.h", 86]
["ui_bookmark.h", 86]
["pan-timeline.c", 86]
["cache-loader.c", 86]
["options.c", 85]
["image-overlay.h", 85]
["view_dir_list.h", 84]
["md5-util.c", 84]
["layout_util.h", 84]
["ui_help.h", 83]
["pan-util.c", 83]
["layout_config.h", 82]
["exif-int.h", 82]
["cache-loader.h", 82]
["format_olympus.h", 81]
["window.h", 80]
["md5-util.h", 80]
["lirc.c", 80]
["cache_maint.h", 80]
["options.h", 78]
["misc.h", 78]
["glua.h", 78]
["filecache.h", 78]
["img-view.h", 77]
["dupe.h", 77]
["ui_spinner.h", 75]
["trash.h", 75]
["search.h", 75]
["renderer-tiles.h", 75]
["renderer-clutter.h", 75]
["pan-view.h", 75]
["logwindow.h", 75]
["lirc.h", 75]
["jpeg_parser.h", 75]
["intl.h", 75]
["image_load_tiff.h", 75]
["image_load_jpeg.h", 75]
["image_load_gdk.h", 75]
["desktop_file.h", 75]
["collect-dlg.h", 75]
["advanced_exif.h", 75]
["ClayRGB1998_icc.h", 74]
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel