<commit_before># Development Help

So you want to contribute to watney? Or maybe fork it and use in your own slack room with your own integrations? Here are a few topics that will help.

Definitely read these things if you plan on contributing back to Watney itself.

# Setup

Getting started should be as simple as:

- Fork the repo on github
- Clone your fork locally
- use `npm install` to install the dependencies
- copy `lib/config.json` to `lib/config.user.json`
- Note: if you want to develop in the cfml slack room, contact an admin for an api key and you can skip these next steps.  It is easy to set up your own personal slack room though if you think you will be testing frequently.
  - go to the slack room that you want to integrate with, 'Configure Integrations'
  - search for 'bots' and add that integration
  - come up with a username for your bot and get an api key
- update `lib.config.user.json` with appropriate values, your api key and your bot's username especially. You probably want to ignore the #cfml-general room - you can not remove your bot from that room and probably don't want to spam it while you develop. Add ignores **without** the octothorpe. Do this: `"ignoreChannels": ["cfml-general"]` not this: `"ignoreChannels": ["#cfml-general"]`
- run `node main.js` to connect and test!

That may have seemed complicated, but really shouldn't take more than a few minutes.

# Updating

Whether you intend to contribute back to watney or not, you probably want to stay up to date with its progress.  Doing so with git is relatively simple, but does require a few extra steps. You want to create a remote called "upstream" that you will be able to pull changes from.  You absolutely need to do this if you intend to contribute to watney.  A quick guide:

From your git command line, do the following

`git remote add upstream https://github.com/ryanguill/watney.git`

Then anytime you want to make sure you are up to date, do:

`git pull --rebase upstream master`

This will get you up to date, then you can branch from here.  If you want to submit a pull request with your changes, commit your changes to your origin, which is your github fork.  Then you can use the github interface to create the pull request (also called a PR).  You will always want to target the master branch in the watney repo.


## Style and Quality

Try and match style of the plugin you are in - if you are the one writing the plugin, feel free to use your own style - within the style guidelines set up.

We use JSCS and JSHint.  Please make sure you run your code through these tools before submitting a PR. Appropriate "rc" files for both are in the root of the repository.

### IntelliJ

If you are using intellij, JSCS and JSHint support is built in.  For JSCS you still have to download the JSCS npm module first and point to it.  Use the supplied rc files though for your configuration.

You also want to change your Javascript Language Version to ECMAScript 6.

### Sublime Text 3

Packages for JSHint and JSCS are available through [package control](https://packagecontrol.io/) ([install instructions](https://packagecontrol.io/installation#st3)). There are several JSHint plugins available, but most of us use [JSHint Gutter](https://packagecontrol.io/packages/JSHint%20Gutter). Use [JSCS Formatter](https://packagecontrol.io/packages/JSCS-Formatter) to auto-format your code according to `.jscsrc` rules with a single keystroke.

# Notes

`main.js` is written using ES5 level node.js code.  This bootstraps the whole process, and for most development you shouldn't need to modify it.

The project uses [babel](https://babeljs.io/) to allow us to _optionally_ write ES6 (ES2015)+ level code in all of the plugins by default, although you can now override this.  

All local modules (not npm dependencies) loaded will be transpiled automatically unless explicitly overridden so you can use ES5 plus to develop them.  If you are more comfortable sticking with ES5, go for it, just specify "preprocess": "none" in your watney.user.json file.
If you are trying to update an existing module written in ES6, please try to match its style.

The only sticking point about transpiling from ES6 is that debugging can be difficult with many editors (although that should be improving).  You can use `console.log` of course, and there is also `bot.log()` available in plugins that works the same way but only actually logs anything when configured with `debug: true` in your `config.user.json` file.<commit_msg>added note about running npm install after updating #27<commit_after># Development Help

So you want to contribute to watney? Or maybe fork it and use in your own slack room with your own integrations? Here are a few topics that will help.

Definitely read these things if you plan on contributing back to Watney itself.

# Setup

Getting started should be as simple as:

- Fork the repo on github
- Clone your fork locally
- use `npm install` to install the dependencies
- copy `lib/config.json` to `lib/config.user.json`
- Note: if you want to develop in the cfml slack room, contact an admin for an api key and you can skip these next steps.  It is easy to set up your own personal slack room though if you think you will be testing frequently.
  - go to the slack room that you want to integrate with, 'Configure Integrations'
  - search for 'bots' and add that integration
  - come up with a username for your bot and get an api key
- update `lib.config.user.json` with appropriate values, your api key and your bot's username especially. You probably want to ignore the #cfml-general room - you can not remove your bot from that room and probably don't want to spam it while you develop. Add ignores **without** the octothorpe. Do this: `"ignoreChannels": ["cfml-general"]` not this: `"ignoreChannels": ["#cfml-general"]`
- run `node main.js` to connect and test!

That may have seemed complicated, but really shouldn't take more than a few minutes.

# Updating

Whether you intend to contribute back to watney or not, you probably want to stay up to date with its progress.  Doing so with git is relatively simple, but does require a few extra steps. You want to create a remote called "upstream" that you will be able to pull changes from.  You absolutely need to do this if you intend to contribute to watney.  A quick guide:

From your git command line, do the following

`git remote add upstream https://github.com/ryanguill/watney.git`

Then anytime you want to make sure you are up to date, do:

`git pull --rebase upstream master`

This will get you up to date, then you can branch from here.  If you want to submit a pull request with your changes, commit your changes to your origin, which is your github fork.  Then you can use the github interface to create the pull request (also called a PR).  You will always want to target the master branch in the watney repo.

Also, anytime you do pull from upstream, it is a good idea you have updated your npm dependencies, in case anything has changed.

`npm install`

## Style and Quality

Try and match style of the plugin you are in - if you are the one writing the plugin, feel free to use your own style - within the style guidelines set up.

We use JSCS and JSHint.  Please make sure you run your code through these tools before submitting a PR. Appropriate "rc" files for both are in the root of the repository.

### IntelliJ

If you are using intellij, JSCS and JSHint support is built in.  For JSCS you still have to download the JSCS npm module first and point to it.  Use the supplied rc files though for your configuration.

You also want to change your Javascript Language Version to ECMAScript 6.

### Sublime Text 3

Packages for JSHint and JSCS are available through [package control](https://packagecontrol.io/) ([install instructions](https://packagecontrol.io/installation#st3)). There are several JSHint plugins available, but most of us use [JSHint Gutter](https://packagecontrol.io/packages/JSHint%20Gutter). Use [JSCS Formatter](https://packagecontrol.io/packages/JSCS-Formatter) to auto-format your code according to `.jscsrc` rules with a single keystroke.

# Notes

`main.js` is written using ES5 level node.js code.  This bootstraps the whole process, and for most development you shouldn't need to modify it.

The project uses [babel](https://babeljs.io/) to allow us to _optionally_ write ES6 (ES2015)+ level code in all of the plugins by default, although you can now override this.  

All local modules (not npm dependencies) loaded will be transpiled automatically unless explicitly overridden so you can use ES5 plus to develop them.  If you are more comfortable sticking with ES5, go for it, just specify "preprocess": "none" in your watney.user.json file.
If you are trying to update an existing module written in ES6, please try to match its style.

The only sticking point about transpiling from ES6 is that debugging can be difficult with many editors (although that should be improving).  You can use `console.log` of course, and there is also `bot.log()` available in plugins that works the same way but only actually logs anything when configured with `debug: true` in your `config.user.json` file.
{'fraction_non_alphanumeric': 0.05590534085974815, 'fraction_numerical': 0.0034737299174989146, 'mean_word_length': 4.1240266963292544, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7002406', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2357, 'n_words': 1460}