loading...

VScode tips on enforcing coding style

github logo ・1 min read

Hello everyone, I hope you are having a good day.

I am looking for some tips how can I enforce "same" coding style among a team of programmers.

I think we should define stuff like:

  • line width
  • naming of variables to follow the rules I define (cammelCase)
  • spaces instead of tabs
  • etc...

I am not sure how granular should I be in defining the rules? Should I define relaxed rules where everyone can still do stuff like they want? Or should I be strict and opionated.

We program mainly in Java but it would be cool if I could define rules for different languages (mainly Javascript(Angular - typescript and Java).

In ideal world there would be a plugin that would check the codebase based on there rules:

I am really greateful for any tips / help I receive

twitter logo DISCUSS (3)
markdown guide
 

I believe you should be able to do this via a plugin for vscode. Have you checked out this plugin:

It provides code completion as well as code formatting. For other languages there are linters which you can use with vscode. I wouldn't worry about being too granular on rules. I would focus on using an existing standard for your rules. Makes it more common for other developers who may roll onto the project later.

 

Part of the answer is using an editor config: editorconfig.org/

Not sure about linting for Java though

 
Classic DEV Post from Nov 1 '19

Do developers have higher job satisfaction than non-developers?

Kristjan Grm profile image
I am a problem solver coming from Slovenia. I make web applications, web pages, data analysis etc... I like automate business process using various technologies. https://keybase.io/kris96

dev.to now has dark theme. 🌝

Go to the "misc" section of your settings and select night theme

P.S. It's the best move you can make for your dev career.