intel / iotivity-node

Node.js bindings for IoTivity
https://www.iotivity.org/
42 stars 44 forks source link

Test file and directory names have spaces #37

Closed zqzhang closed 8 years ago

zqzhang commented 8 years ago

The test file and directory under tests/tests have spaces. This makes parsing testing results hard, and JavaScript file naming convention inconsistent.

Actually there are no common file/directory naming convention guide in jquery [1], node [2] community. Only find Google JavaScript guide [3] that suggests filenameslikethis.js. I wonder whether it is possible to use this naming rule for naming test files and directories.


  1. http://contribute.jquery.org/style-guide/js/#naming-conventions
  2. https://github.com/felixge/node-style-guide
  3. https://google.github.io/styleguide/javascriptguide.xml#Naming
zqzhang commented 8 years ago

Checking all JS files in this repository, there are several styles:

  1. FileNamesLikeThis.js, see ./lib/
  2. file-names-like-this.js, see ./grunt-build/. This is also the C code file naming used in this repository.
  3. filenameslikethis.js, see ./grunt-build/tasks/
  4. file.names.like.this.js, see ./js/

If possible, use one style in this repository except files from 3rd party. What do you think?

zqzhang commented 8 years ago

@wanghongjuan for your info. This repository prefers grunt format, jQuery code style; while https://github.com/otcshare/dollhouse/pull/2#discussion_r45883722 prefers 'Closure Linter', mainly Google style. And the https://github.com/01org/iot-rest-api-server style looks more like dollhouse's.

This is not a problem, but please take care if we want to make code contribution.

gabrielschulhof commented 8 years ago

There's no recommented style for the file names, only for their contents.

In the case of the tests, I chose to store the name of the test in the filename, because the test has to run in a separate process, so I have no easy way of conveying information about the test back to the console.

In the case of grunt tasks, the filename coincides with the name of the grunt task, so the less verbose, the better.

In case of the files under grunt-build, those are just lists of files.

zqzhang commented 8 years ago

I have no easy way of conveying information about the test back to the console.

Hmm, seems so; but file-names-like-this sounds not bad as test name info. This naming is consistent with your C file names too.

I will take a deep look at the grunt and grunt tasks, and come back with comments if have new findings.