IIIT-Delhi / byld-website

Static Website for IIIT-Delhi's Software Dev Club Byld
https://iiit-delhi.github.io/byld-website/
8 stars 29 forks source link

Code formatting #44

Open peey opened 6 years ago

peey commented 6 years ago

I don't want to set up a linting check / commit hook because I think it'll add friction to the process of contributing to the site

Also this is a small project so we might not really need it.

But we do want to end up just formatting everything from time to time so that it looks consistent for someone new who looks at the code.

Chances are -- if the code already isn't spaghetti then someone changing some files would also adhere to the making their changes look nice and fit in with the rest of the code too.

How could we achieve this? How about adding a few scripts which can be manually triggered to auto-format html, css, yaml, and js and then one could just run the script after it's been a long time and submit a PR

virresh commented 6 years ago

Sounds nice, though I'd suggest enforcing this with a linter as well (Mainly because we aim to help developers produce quality code, and even if it slows down their progress, they do get something out of it in the process and write better code next time onwards)

peey commented 6 years ago

I agree with what you said, but I think the problem here would be that some of the people contributing may not appreciate the role of a linter yet - i.e. haven't worked in large enough codebase to realize that non-strict code styles can become a problem

So I'd recommend against making it mandatory. Could we maybe add it as optional? So if someone is contributing a big feature then we can ask them to run the linter (on the lines added in their diff?), but if someone is contributing a simple one liner CSS bug fix, I don't want to drag on that process...

virresh commented 6 years ago

Sounds good We can add a linter check job on the CI, and make it optional so that the build won't fail even if the code isn't well written We can always see build logs for a reasonable amount of time, which would indicate whenever we have a failure in the linter job