<commit_before>Sodascript: Contributing Guide
==============================


## Set up for development

1. Clone the repo

	``` $ git clone https://github.com/miguelfrde/sodascript && cd sodascript```

2. Install dependencies (assumes you have [bundler](http://bundler.io/) installed)

	``` $ bundle install ```

3. Make sure everything is working

	``` $ rake test ```

4. Begin hacking!

If you want to see debugging output, set the environment variable SODA_DEBUG to 1:

```$ export SODA_DEBUG=1```

## Ruby coding style

Try to follow this [Ruby style guide](https://github.com/bbatsov/ruby-style-guide) as much as possible.


## Developing a new feature or fixing some feature 

1. Create or edit your feature.

2. Create your feature branch:

    ```$ git checkout -b <your-feature-name>```

3. Write new tests for you feature and run all tests:

    ```$ rake test```

4. Check your test code coverage by opening `coverage/index.html`, try to cover as much as possible.

5. If your tests passed push your feature to Github:

    ```$ git push origin <your-feature-name>``` 

6. Go to Github and create a pull request. If you are using `hub` aliased as `git` just run:

    ```$ git pull-request```

If your pull request closes an issue. Please close it from the pull-request content or from the commit. If you don't know how to do this, [read this](https://help.github.com/articles/closing-issues-via-commit-messages).

If you need to add more commits to a pull request, just push to that branch as shown in #4.

If you need to fix a commit that you have already pushed to the pull-request, you can do it [squashing commits](http://davidwalsh.name/squash-commits-git). Note: you will need to force push after doing this:

```$ git push -f origin <your-feature-name>```

Don't forget to do `$ git pull` before editing anything, so that you are always working on the latest version.

If you are working on a branch that is behind master, do `$ git rebase -i master` to integrate changes from master into the branch you are working. Note: you may need to solve merge conflicts if this happens.


## Testing

We use `minitest` for testing. It's also prefered to write spec tests instead of unit tests, since they are more descriptive on what the module/method/class/feature should do. Run one of:

```
$ rake test
$ bundle exec rake test
```

We use `SimpleCov` for test code coverage. After running your tests, you can open the file `coverage/index.html` to see how much of the code is covered by the current tests. Try to get 100% coverage.

## Documentation

We use rdoc for documentation. There are two ways of generating documentation:

- Public documentation: includes all public methods, attribute accessors, modules, classes. Run:

	```$ rake rdoc```

- Private documentation: includes all public documentation and also private methods. Run:

	```$ rake rdocdev```<commit_msg>Add documentation on grammar modification workflow.<commit_after>Sodascript: Contributing Guide
==============================


## Set up for development

1. Clone the repo

	``` $ git clone https://github.com/miguelfrde/sodascript && cd sodascript```

2. Install dependencies (assumes you have [bundler](http://bundler.io/) installed)

	``` $ bundle install ```

3. Make sure everything is working

	``` $ rake test ```

4. Begin hacking!

If you want to see debugging output, set the environment variable SODA_DEBUG to 1:

```$ export SODA_DEBUG=1```

## Ruby coding style

Try to follow this [Ruby style guide](https://github.com/bbatsov/ruby-style-guide) as much as possible.


## Developing a new feature or fixing some feature 

1. Create or edit your feature.

2. Create your feature branch:

    ```$ git checkout -b <your-feature-name>```

3. Write new tests for you feature and run all tests:

    ```$ rake test```

4. Check your test code coverage by opening `coverage/index.html`, try to cover as much as possible.

5. If your tests passed push your feature to Github:

    ```$ git push origin <your-feature-name>``` 

6. Go to Github and create a pull request. If you are using `hub` aliased as `git` just run:

    ```$ git pull-request```

If your pull request closes an issue. Please close it from the pull-request content or from the commit. If you don't know how to do this, [read this](https://help.github.com/articles/closing-issues-via-commit-messages).

If you need to add more commits to a pull request, just push to that branch as shown in #4.

If you need to fix a commit that you have already pushed to the pull-request, you can do it [squashing commits](http://davidwalsh.name/squash-commits-git). Note: you will need to force push after doing this:

```$ git push -f origin <your-feature-name>```

Don't forget to do `$ git pull` before editing anything, so that you are always working on the latest version.

If you are working on a branch that is behind master, do `$ git rebase -i master` to integrate changes from master into the branch you are working. Note: you may need to solve merge conflicts if this happens.

## Modifying the grammar

Make your changes to one or more of the following files:

- `grammar.txt`: If you are modifying the grammar rules.
- `ignore.txt`: If you are modifying the ignoring rules.
- `tokens.txt`: If you are modifying the token rules.

Remember that the rule called `PROGRAM` is the one that is used as the starting symbol of the grammar.

Then run:

```$ rake grammar```

And send a pull request.


## Testing

We use `minitest` for testing. It's also prefered to write spec tests instead of unit tests, since they are more descriptive on what the module/method/class/feature should do. Run one of:

```
$ rake test
$ bundle exec rake test
```

We use `SimpleCov` for test code coverage. After running your tests, you can open the file `coverage/index.html` to see how much of the code is covered by the current tests. Try to get 100% coverage.

## Documentation

We use rdoc for documentation. There are two ways of generating documentation:

- Public documentation: includes all public methods, attribute accessors, modules, classes. Run:

	```$ rake rdoc```

- Private documentation: includes all public documentation and also private methods. Run:

	```$ rake rdocdev```
{'fraction_non_alphanumeric': 0.09980744544287548, 'fraction_numerical': 0.005134788189987163, 'mean_word_length': 3.9311708860759493, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3547947', 'n_tokens_mistral': 1826, 'n_tokens_neox': 1703, 'n_words': 882}