1

The situation now, I’m getting git conflicts even though the codes are similar but each developer is formatting the code differently.

Vipul Patil
  • 1,250
  • 15
  • 27
  • This is why Go, for instance, has a single standard formatter, with no options. :-) – torek Aug 24 '20 at 21:59
  • So all the developers should agree upon the one and only one formating style, to check and complying purpose you may use linter tool. e.g. Eslint for Javascript. You can define the various styling rules in linter. – Vipul Patil Aug 25 '20 at 13:57

1 Answers1

2

This exact situation is one of the reasons code linter were developed.

lint, or a linter, is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs. The term originates from a Unix utility that examined C language source code

You can use a linter to enforce a code convention among you and your project partners. Linters can enforce things like indentation, spacing around operators, etc.

With everyone using the same format, the conflicts should be minimized, and when they do occur the linter will often tell you how to fix the styling.

joshmeranda
  • 3,001
  • 2
  • 10
  • 24