loading...

Code Analyzer for C#

yuanleemidori profile image Yuan-Hsi Lee ・2 min read

Another busy week, glad that I'm still alive.

This week, we're introducing code formatter and linter to our link checker project that we've been working on it for the whole semester. Formatter and linter are both new to me. The first time that I use linter was doing one of the PR in Hacktoberfest. It was a browser extension project, and they use ESLint to analyze their code.

After doing research of C# formatter and linter, I have to say, there isn't much choice for C#. I'm guessing it is because that most of the C# developers use Visual Studio and VS has many powerful tools for either formatting or analyzing. It is also hard to find the C# formatter and linter that has command-line interface. For example, while I was looking for C# linter, I found a code analyzer for C# called StyleCode Analyzer, however, it doesn't provide command line interface, which does not meet the requirement of this lab (providing command line setup). I saw other developers have been asking the feature of command line interface for a while, hopefully this feature can be introduced in the future release.

I end up using dotnet-format as my formatter and Resharper as the code analyzer. A bash script is also added for other developer to run for the environment setup. After applying these tools and start writing the contribution documentation, I again realized how many efforts are made behind an open-source project. To work as a group, minimizing the possible errors and improving the readability of my code is for sure critical. Honestly, in a limited number of options, this formatter and linter are not my best choices. I'll keep looking for better tools and apply them to my C# project.

Discussion

pic
Editor guide
Collapse
zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️

check out visual studio code they have some awesome new new tools for this. You can hack prettier to format c# -- not ideal but you can get it to automate very large projects.