Skip to content
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

Coding policy suggestions #17

Closed
revington opened this issue Jan 14, 2016 · 2 comments
Closed

Coding policy suggestions #17

revington opened this issue Jan 14, 2016 · 2 comments

Comments

@revington
Copy link

I'll think that the following would enrich this project.

  • Integration with travis testing LTS and stable versions of node
  • a code convention definition
  • a .eslintrc, .jshintrc or something similar
  • Better code readability I.E by replacing magic numbers with constants. parseInt(header[4], 10);parseInt(header[REMOTE_PORT_HEADER], 10);
  • Refactoring functionality instead of inlining in order to enforce readablity

I can help with that if you agreed

cusspvz pushed a commit that referenced this issue Jan 14, 2016
@cusspvz
Copy link
Member

cusspvz commented Jan 14, 2016

Integration with travis testing LTS and stable versions of node

It was using our old internal CI, but we moved it and some of our OS projects weren't updated, used Travis instead.

a code convention definition
I can help with that if you agreed

If you may help us here it would be great!

We like to:

  • use var declarations on every vars instead of aggregating them (we didn't have this before, we added it since its easier to manage them.
  • avoid ;, since javascript has asi
  • spaces instead of tabs (we use 4)
  • spaces, spaces and more spaces: code should be readable, by any one.
// Instead of:
if('some'=='condition'){
    return 'yolo'
}

// We prefer:
if ( 'some' == 'condition' ) {
    return 'yolo'
}
  • brackets, always write them on ifs, even that you just want to return. (this allows anyone to fastly change code without having to break lines, identate, and so on.
// Instead of:
if ( condition ) return

// We prefer:
if ( condition ) {
    return
}

Better code readability I.E by replacing magic numbers with constants.

Agree. Do you have some suggestion regarding a new folder structure having in mind a file for constants?

@revington
Copy link
Author

I'm going to open different PR for each item so we can discuss each thing in a separate thread

@revington revington mentioned this issue Jan 15, 2016
@cusspvz cusspvz closed this as completed May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants