Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JavaScript Lint
  • Loading branch information
mohebifar committed Dec 23, 2014
1 parent 6885349 commit 285427d
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 35 deletions.
44 changes: 44 additions & 0 deletions .jshintrc
@@ -0,0 +1,44 @@
{
// Define globals exposed by modern browsers.
"browser": false,

// Define globals exposed by jQuery.
"jquery": false,

// Define globals exposed by Node.js.
"node": true,

// Force all variable names to use either camelCase style or UPPER_CASE
// with underscores.
"camelcase": true,

// Prohibit use of == and != in favor of === and !==.
"eqeqeq": true,

// Enforce tab width of 2 spaces.
"indent": 2,

// Prohibit use of a variable before it is defined.
"latedef": true,

// Enforce line length to 80 characters
"maxlen": 80,

// Require capitalized names for constructor functions.
"newcap": true,

// Enforce use of single quotation marks for strings.
"quotmark": "single",

// Enforce placing 'use strict' at the top function scope
"strict": true,

// Prohibit use of explicitly undeclared variables.
"undef": true,

// Warn when variables are defined but never used.
"unused": true,

// Suppress warnings about == null comparisons.
"eqnull": true
}
14 changes: 13 additions & 1 deletion gulpfile.js
@@ -1,8 +1,20 @@
var gulp = require('gulp');
var yuidoc = require("gulp-yuidoc");
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');

gulp.task('default', function() {
gulp.task('lint', function() {
return gulp.src('lib/*.js')
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(stylish));
});

gulp.task('doc', function() {
gulp.src("./lib/*.js")
.pipe(yuidoc())
.pipe(gulp.dest("./doc"));
});

gulp.task('watch', function() {
gulp.watch("./lib/*.js", ['lint', 'doc']);
});
4 changes: 3 additions & 1 deletion lib/atom.js
@@ -1,3 +1,5 @@
'use strict';

var ob = require('./../build/Release/openbabel');

/**
Expand Down Expand Up @@ -25,7 +27,7 @@ var ob = require('./../build/Release/openbabel');
*/
ob.Atom.prototype.isConnectedWith = function (atom, distance) {

if (distance == 1) {
if (distance === 1) {
return this.isConnected(atom);
} else {
this.forEachNeighbour(function (neighbour) {
Expand Down
2 changes: 2 additions & 0 deletions lib/bond.js
@@ -1,3 +1,5 @@
'use strict';

var ob = require('./../build/Release/openbabel');

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/builder.js
@@ -1,3 +1,5 @@
'use strict';

/**
* The Class for 3D Coordinates Builder
*
Expand Down
2 changes: 2 additions & 0 deletions lib/conversion.js
@@ -1,3 +1,5 @@
'use strict';

/**
* The Class for chemical file tables conversion
*
Expand Down
65 changes: 36 additions & 29 deletions lib/forcefield.js
@@ -1,3 +1,5 @@
'use strict';

/**
* The Class for Force Field
*
Expand All @@ -6,99 +8,103 @@
*/

/**
* Setup the forcefield for mol (assigns atom types, charges, etc.). Keep current constraints.
* Setup the forcefield for mol (assigns atom types, charges, etc.).
* Keep current constraints.
*
* @method setup
* @param {Molecule} mol The molecule to be set up
* @return {Boolean} Returns the result
*/

/**
* Generate conformers for the molecule (systematicaly rotating torsions).
*
* The initial starting structure here is important, this structure should be
* minimized for the best results. SystematicRotorSearch works by rotating around
* the rotatable bond in a molecule (see OBRotamerList class). This rotating generates
* multiple conformers. The energy for all these conformers is then evaluated and the
* Generate conformers for the molecule
* (systematicaly rotating torsions).
*
* The initial starting structure here is important,
* this structure should be minimized for the best results.
* systematicRotorSearch works by rotating around the rotatable
* bond in a molecule. This rotating generates multiple conformers.
* The energy for all these conformers is then evaluated and the
* lowest energy conformer is selected.
*
* @method systematicRotorSearch
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {ForceField} Returns this
*/

/**
* Generate conformers for the molecule by systematicaly rotating torsions. To be used in combination with
* systematicRotorSearchNexConformer().
* Generate conformers for the molecule by systematicaly rotating torsions.
* To be used in combination with systematicRotorSearchNexConformer().
*
* @method systematicRotorSearchInitialize
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {Number} The number of conformers
* @example
* ff.systematicRotorSearchInitialize(300);
* while (ff.systematicRotorSearchNextConformer(300)) {
* // do some updating in your program (show last generated conformer, ...)
* // do some updating (show last generated conformer, ...)
* }
*/

/**
* Evaluate the next conformer.
*
* @method systematicRotorSearchNextConformer
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {Boolean} Returns true if there are more conformers
*/

/**
* Generate conformers for the molecule (randomly rotating torsions).
*
* The initial starting structure here is important, this structure should be
* minimized for the best results. RandomRotorSearch works by randomly rotating around
* the rotatable bonds in a molecule.
* minimized for the best results.
* randomRotorSearch works by randomly rotating around the rotatable bonds in
* a molecule.
*
* @method randomRotorSearch
* @param {Number} conformers The number of random conformers to consider during the search.
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} conformers Number of random conformers to consider.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {ForceField} Returns this
*/

/**
* Generate conformers for the molecule by randomly rotating torsions. To be used in combination with
* randomRotorSearchNexConformer().
* Generate conformers for the molecule by randomly rotating torsions.
* To be used in combination with randomRotorSearchNexConformer().
*
* @method randomRotorSearchInitialize
* @param {Number} conformers The number of random conformers to consider during the search.
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} conformers Number of random conformers to consider.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {ForceField} Returns this
* @example
* ff.randomRotorSearchInitialize(300);
* while (ff.randomRotorSearchNexConformer(300)) {
* // do some updating in your program (show last generated conformer, ...)
* // do some updating (show last generated conformer, ...)
* }
*/

/**
* Evaluate the next conformer
*
* @method randomRotorSearchNextConformer
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {Boolean} Returns true if there are more conformers
*/

/**
* Generate conformers for the molecule (randomly rotating torsions).
*
* @method weightedRotorSearch
* @param {Number} conformers The number of random conformers to consider during the search.
* @param {Number} [steps=2500] The number of steps to take during geometry optimization.
* @param {Number} conformers Number of random conformers to consider.
* @param {Number} [steps=2500] Number of steps during geometry optimization.
* @return {ForceField} Returns this
*/

/**
* Generate conformers for the molecule (randomly rotating torsions).
*
* @method setLineSearchType
* @param {Number} type The LineSearchType to be used in SteepestDescent and ConjugateGradients.
* @param {Number} type The LineSearchType to be used.
* @return {ForceField} Returns this
* @example
* ff.setLineSearchType(ob.LineSearchType.Newton2Num)
Expand All @@ -119,22 +125,23 @@
*/

/**
* Get the force field formal charges. The formal charges will be added to the atoms of mol as data.
* Get the force field formal charges. The formal charges will be added to
* the atoms of mol as data.
*
* @method preparePartialCharges
* @return {Boolean} Returns true on success
*/

/**
* Get coordinates for current conformer and attach data with energies, forces, ... to mol.
* Get coordinates for current conformer and attach data to molecule.
*
* @method getCoordinates
* @param {Molecule} mol
* @return {Boolean} Returns true on success
*/

/**
* Get coordinates for all conformers and attach OBConformerData with energies, forces, ... to mol.
* Get coordinates for all conformers and attach data to molecule.
*
* @method getConformers
* @param {Molecule} mol
Expand Down
6 changes: 4 additions & 2 deletions lib/mol.js
@@ -1,3 +1,5 @@
'use strict';

/**
* The Class for Molecules
*
Expand All @@ -23,14 +25,14 @@
* Add Hydrogens to the entire molecule to fill out implicit valence spots
*
* @method addHydrogens
* @param {Boolean} [polarOnly=false] Whether to add Hydrogens only to polar atoms
* @param {Boolean} [polarOnly=false] Whether to add only polar hydrogens
* @return {Boolean} Returns true on success
*/

/**
* Delete Hydrogens from the molecule
*
* @param {Boolean} [polarOnly=false] Whether to delete Hydrogens only to polar atom
* @param {Boolean} [polarOnly=false] Whether to add only polar hydrogens
* @method deleteHydrogens
* @return {Boolean} Returns true on success
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/openbabel.js
@@ -1,3 +1,5 @@
'use strict';

/**
* The main module for binding Openbabel to Node.js
*
Expand Down
2 changes: 2 additions & 0 deletions lib/vector.js
@@ -1,3 +1,5 @@
'use strict';

var ob = require('./../build/Release/openbabel');

/**
Expand Down
7 changes: 5 additions & 2 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "openbabel",
"version": "1.0.2",
"version": "1.1.0",
"description": "An OpenBabel port for Node.js",
"main": "index.js",
"scripts": {
Expand All @@ -26,6 +26,9 @@
"gypfile": true,
"devDependencies": {
"gulp": "^3.8.10",
"gulp-yuidoc": "^0.1.2"
"gulp-jshint": "^1.9.0",
"gulp-mocha": "^2.0.0",
"gulp-yuidoc": "^0.1.2",
"jshint-stylish": "^1.0.0"
}
}

0 comments on commit 285427d

Please sign in to comment.