# Overview

We're using [es6-plato](https://github.com/the-simian/es6-plato) to analyze code complexity. VoTT first has to be transpiled to ES6, as es6-plato won't work direcly on TypeScript.

We're also using the [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) eslint plugin for React-specific linting rules.

## Coverage Reports

The [VoTT coverage report](https://vottv2.z5.web.core.windows.net/) is updated on each merged PR, to reflect complexity analysis over time.

### V1

For posterity, a copy of the [V1 coverage report](https://vottv1.z5.web.core.windows.net/) is also available. This report represents a snapshot of the v1 codebase (v1 branch) and can be generated by running:

```bash
git checkout v1
npm i plato --no-save
plato -r -d report -t 'VoTT v1 Complexity Analysis' -x 'public/js|test_|main.js' src
```

## Local development

1. The following command will generate a `report` directory.

    ```bash
    npm run plato
    ```

2. Open `report/index.html` in your browser to see the report locally.

## Debugging

1. If `npm run plato` is not working for you, try running the script manually:

    * Make sure you have `typescript` & `es6-plato` installed locally:

        ```bash
        npm install -g typescript
        npm install -g es6-plato
        ```

    * Run following command from the root of the repository:

        ```bash
        ./scripts/generate-report.sh -o report -v $(node -pe "require('./package.json').version") -c $(git rev-parse --short HEAD)
        ```
