A
A
AlenPelin2016-03-04 05:22:53
git
AlenPelin, 2016-03-04 05:22:53

How to store code (C#) in versioning system (git) without formatting?

Ultimate goal: to completely eliminate the issue of code formatting in the project so that each team member:

  1. wrote code with the formatting he liked (tabs/spaces, empty lines, order of methods in classes, multi-line comments, etc.),
  2. saw code written by others according to their preferences

Implementation method: write an application with the following commands:
  1. First run, converting formatted code to minified code (no spaces/tabs, methods sorted alphabetically by name and parameter types)
  2. Getting started, converting minified code from /src to formatted in /src.tmp, taking into account settings (for example, R#)
  3. End of the job, converting /src.tmp to minified /src

Accordingly, point 3 can be performed continuously after each code change.
Question: Is there already a ready-made solution?
PS also, the application can be extended to minimize .csproj files, excluding obvious file includes from there in order to get rid of conflicts during merge and adding information about exceptions there (for example, initially MyClass1.cs, ... , MyClass99.cs are included in .csproj, and OtherClass1.cs, ... , OtherClass99.cs are not included - when converting, information about MyClass1 ... 99 will be removed, and information about ignoring OtherClass1 ... 99 will be added).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OnYourLips, 2016-03-04
@AlenPelin

I think that in any team at a certain stage (namely, increasing the team from 1 person to 2+), this question was raised.
And this question has a normal working solution: https://msdn.microsoft.com/en-us/library/ff926074....
Pay attention to the four points at the very beginning: this is exactly what you are after.
Think about whether the project needs programmers who could not read this section of the documentation? And the way you want is impossible, Espleth
wrote to you about some problems in a comment .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question