-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a coding standards doc for Rocket.Chat? #1163
Comments
Should create a more common document like 👍 Actually there is just a https://github.com/RocketChat/Rocket.Chat/blob/master/.editorconfig |
Thanks for your interest! I think that haven't been started yet. Would you be willing to kick-off a document? There are lots of things we could standardise, maybe we could just start by tracking them. |
@gmsecrieru You/We can copy CONTRIBE.md from other famous project and adapt as base |
Any good examples of very well done contribute.md? I think this is a very needed dicussion. We do need to standardize the coding style. We shouldn't let this prevent us, but this could be effected by #1015 |
@geekgonecrazy yeah when I spoke about CONTRIBUTE.md is for structure/format only! You should write your own standard. ATM I don't have sample CONTRIBUTE.md but I will check on top project (https://github.com/trending)! |
My 2 cents datamining I found Angular CONTRIBUTING.md file pretty complete (but maybe too many) https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md |
Here are a few examples: I am happy to help contribute to this task! |
👍 this is a great contribution! |
Thanks @gmsecrieru. I am starting a Quip document that can be a start and get in to a PR as a start. Contributing.md can easily be added to and changed from there, so we just need a solid start that the project leads agree fits Rocket.Chat coding and overall philosophy. |
@gmsecrieru 2 tabs for indentions is a Rocket.Chat style I can add to the doc? |
I would say so. |
Formatting standards like this may be helpful: https://github.com/polarmobile/coffeescript-style-guide |
It's my 2 cents point of view but when working with community we should create a standard documentation and above all use tools like linter (#1195), coding style checker to ensure new PR respect standard. |
+1 |
@kakawait couldn't agree more |
Any update? |
Started at https://rocket.chat/docs/developer-guides/code-styleguide @MartinSchoeler please add a NodeJS section. |
@geekgonecrazy and @graywolf336 about the discussion of how to check the presence of property in object. The bug in code is by no checking if user contains roles property, so a send a PR using a secure check of property in an object using ESLint recommendation: if(Object.hasOwnProperty.call(user, 'roles') && Array.isArray(user.roles)) {
} But, for not being so clear of understand and no according to code style, we agree to use like this: if(user.roles && Array.isArray(user.roles)) {
} But this can cause some side effects if we checking a property and this property has a false value. We need do the things most safety way possible. So I believe this approach can be better using destructuring and checking the type of property, like this: // this dont throw error if user not has property roles
// roles in this case will be undefined
const { roles } = user;
if(Array.isArray(roles)) {
} Is most readable and good styling. |
@paulovitin IMO, there is no need to check if roles property exists and then check the property type, you could check the type directly: if(Array.isArray(user.roles)) {
...
} |
@rodrigok you are right. 👍 |
We currently use eslint to validate coding style, and our CI will not allow PR without passing the rules. Please check https://github.com/RocketChat/eslint-config-rocketchat |
Just looking for Rocket.Chat coding standards doc so my team can contribute. Thanks!
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: