0
\$\begingroup\$

Is there any possible way to check my C# code with Checkstyle in the context of Unity?

\$\endgroup\$
0
\$\begingroup\$

You can't.

checkstyle is a tool for Java. Style checking tools are often made specifically for a language, and it's hard to adapt them to other languages. (And often the developers don't really care about other languages, for various reasons.)

I understand you're probably coming from the Java world, and you'd like to reduce the work involved with working with the new tool (Unity), but alas, I'm afraid you'll have to find a new style checker that works with c#.

I will not suggest alternatives, though, because it's not within the scope of this site, instead, I will suggest you search the web for them.

One thing worth noting is that Unity's API, and lots of common Unity scripts/asset packages based on it, deviate from standard C# coding conventions (like using PascalCase for public fields), so standard C# checkers might flag more than you want. ;) (Thanks to DMGregory for this tip; copied verbatim.)


You'll find out that you can use checkstyle with Visual Studio, but it still checks Java code, not c# code.

\$\endgroup\$
  • \$\begingroup\$ One thing worth noting is that Unity's API, and lots of common Unity scripts/asset packages based on it, deviate from standard C# coding conventions (like using PascalCase for public fields), so standard C# checkers might flag more than you want. ;) \$\endgroup\$ – DMGregory May 2 at 20:47

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.