{"id":20393,"date":"2008-10-30T10:00:00","date_gmt":"2008-10-30T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/10\/30\/if-youre-going-to-reformat-source-code-please-dont-do-anything-else-at-the-same-time\/"},"modified":"2008-10-30T10:00:00","modified_gmt":"2008-10-30T10:00:00","slug":"if-youre-going-to-reformat-source-code-please-dont-do-anything-else-at-the-same-time","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20081030-00\/?p=20393","title":{"rendered":"If you&#8217;re going to reformat source code, please don&#8217;t do anything else at the same time"},"content":{"rendered":"<p><P>\nI spend a good amount of my time doing source code archaeology,\nand one thing that really muddles the historical record is\npeople who start with a small source code change which turns\ninto large-scale source code reformatting.\n<\/P>\n<P>\nI don&#8217;t care how you format your source code.\nIt&#8217;s your source code.\nAnd your team might decide to change styles at some point.\nFor example, your original style guide may have been designed\nfor the classic version of the C language,\nand you want to switch to a style guide\ndesigned for C++ and its new <CODE>\/\/<\/CODE> single-line comments.\nYour new style guide may choose to use spaces instead of tabs\nfor indentation,\nor it may dictate that opening braces go on the next line\nrather than hanging out at the end of the previous line,\nor you may have a new convention for names of member variables.\nMaybe your XML style guidelines changed from using\n<\/P>\n<PRE>\n&lt;element attribute1=&#8221;value1&#8243; attribute2=&#8221;value2&#8243; \/&gt;\n<\/PRE>\nto\n<PRE>\n&lt;element\n         attribute1=&#8221;value1&#8243;\n         attribute2=&#8221;value2&#8243;\n\/&gt;\n<\/PRE>\n<P>\nWhatever your changes are, go nuts.\nAll I ask is that you restrict them to\n&#8220;layout-only&#8221; check-ins.\nIn other words, if you want to do some source code reformatting\n<I>and<\/I> change some code,\nplease split it up into two check-ins,\none that does the reformatting and the other that changes the code.\n<\/P>\n<P>\nOtherwise, I end up staring at a diff of 1500 changed lines of source code,\n<A HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2008\/03\/27\/8338530.aspx\">\n1498 of which are just reformatting<\/A>,\nand 2 of which actually changed something.\nFinding those two lines is not fun.\n<\/P>\n<P>\nAnd the next time somebody is asked to do some code archaeology,\nsay to determine exactly when a particular change in behavior occurred,\nor to give an assessment of how risky it would be to port a change,\nthe person who is invited to undertake the investigation may not be me.\nIt may very well be you.\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I spend a good amount of my time doing source code archaeology, and one thing that really muddles the historical record is people who start with a small source code change which turns into large-scale source code reformatting. I don&#8217;t care how you format your source code. It&#8217;s your source code. And your team might [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-20393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>I spend a good amount of my time doing source code archaeology, and one thing that really muddles the historical record is people who start with a small source code change which turns into large-scale source code reformatting. I don&#8217;t care how you format your source code. It&#8217;s your source code. And your team might [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/20393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=20393"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/20393\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=20393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=20393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=20393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}