How to ignore bracketing styles when doing code comparisons or diffs? We have several formats of bracketing and I would like:

function foo(){

to be considered the same as

function foo()

Right now I use Araxis merge which does a direct line-by-line comparison and we are getting a lot of "false positive" changes.

  • 10
    Run your code through a formatter before diffing it, that way you can use existing high quality diff tools. – whatsisname Mar 26 '14 at 18:51
  • 2
    some diff tools let you ignore whitespace entirely – ratchet freak Mar 26 '14 at 19:02
  • 2
    Note to reviewers: the suggested edit was made in collaboration with the OP. – ypercubeᵀᴹ Mar 26 '14 at 19:45
  • 1
    @gnat thnx, and noted. I had added a long edit summary but forgot to clarify this. – ypercubeᵀᴹ Mar 26 '14 at 20:04
  • 2
    You've got 3 options on how you want to take this. If you want to ask about how to make Araxis merge handle this, SO may be a better target (specific tool use). If you are asking about workflows and team style guides, then P.SE (though I suspect there's a dup for it that you should read first). If you are looking for a new tool, then Software Recommendations.SE may be appropriate - given enough information about your features and environment. – user40980 Mar 26 '14 at 20:22

A tool like Semantic Merge which understands the language semantics by parsing the code will work in this case.

  • Could someone please explain the downvotes? I've never used Semantic Merge and at first glance it looks like a good suggestion. – M. Dudley Mar 27 '14 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.