<commit_before># Lois [![CircleCI](https://circleci.com/gh/ketiko/lois.svg?style=svg)](https://circleci.com/gh/ketiko/lois)

Lois reports statuses of CI results to GitHub Pull Request Statuses.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'lois'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install lois

## Usage

```
bundle exec lois help

Commands:
  lois brakeman -g, --github-credentials=GITHUB_CREDENTIALS       # Run brakeman
  lois bundler-audit -g, --github-credentials=GITHUB_CREDENTIALS  # Run bundler-audit
  lois help [COMMAND]                                             # Describe available commands or one specific command
  lois reek -g, --github-credentials=GITHUB_CREDENTIALS           # Run reek
  lois rubocop -g, --github-credentials=GITHUB_CREDENTIALS        # Run Rubocop
  lois simplecov -g, --github-credentials=GITHUB_CREDENTIALS      # Run simplecov
```

Lois has commands to run and report ruby quality metrics to GitHub PR Statuses.  All it requires is
a GitHub basic auth credentials for a user to report the statuses.  The user needs write access to the repo to post
PR status updates.

See [https://developer.github.com/v3/auth/#basic-authentication](https://developer.github.com/v3/auth/#basic-authentication).
We recommend using oauth tokens and not your password.

Currently we only support reporting through [CircleCI](https://circleci.com/), but PRs for additional continuous integration systems are welcome.

Lois will output all the results of the checks to a `lois` directory.  You can add this to your artifact path to view the html representation of the results later.

##### CircleCI 2.0
A sample `.circleci/config.yml` would look like:

```
- run:
    name: Bundler-Audit
    command: bundle exec lois bundler-audit -g $GITHUB_CREDENTIALS

- run:
    name: Brakeman
    command: bundle exec lois brakeman -g $GITHUB_CREDENTIALS

- run:
    name: Rubocop
    command: bundle exec lois rubocop -g $GITHUB_CREDENTIALS

- run:
    name: Reek
    command: bundle exec lois reek -g $GITHUB_CREDENTIALS

- store_artifacts:
    path: lois
    destination: lois
```

##### CircleCI 1.0
A sample `.circleci/config.yml` would look like:
```
test:
  pre:
    - bundle exec lois bundler-audit -g $GITHUB_CREDENTIALS
    - bundle exec lois brakeman -g $GITHUB_CREDENTIALS
    - bundle exec lois rubocop -g $GITHUB_CREDENTIALS
    - bundle exec lois reek -g $GITHUB_CREDENTIALS<commit_msg>Correct title of circle config file for circle 1.<commit_after># Lois [![CircleCI](https://circleci.com/gh/ketiko/lois.svg?style=svg)](https://circleci.com/gh/ketiko/lois)

Lois reports statuses of CI results to GitHub Pull Request Statuses.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'lois'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install lois

## Usage

```
bundle exec lois help

Commands:
  lois brakeman -g, --github-credentials=GITHUB_CREDENTIALS       # Run brakeman
  lois bundler-audit -g, --github-credentials=GITHUB_CREDENTIALS  # Run bundler-audit
  lois help [COMMAND]                                             # Describe available commands or one specific command
  lois reek -g, --github-credentials=GITHUB_CREDENTIALS           # Run reek
  lois rubocop -g, --github-credentials=GITHUB_CREDENTIALS        # Run Rubocop
  lois simplecov -g, --github-credentials=GITHUB_CREDENTIALS      # Run simplecov
```

Lois has commands to run and report ruby quality metrics to GitHub PR Statuses.  All it requires is
a GitHub basic auth credentials for a user to report the statuses.  The user needs write access to the repo to post
PR status updates.

See [https://developer.github.com/v3/auth/#basic-authentication](https://developer.github.com/v3/auth/#basic-authentication).
We recommend using oauth tokens and not your password.

Currently we only support reporting through [CircleCI](https://circleci.com/), but PRs for additional continuous integration systems are welcome.

Lois will output all the results of the checks to a `lois` directory.  You can add this to your artifact path to view the html representation of the results later.

##### CircleCI 2.0
A sample `.circleci/config.yml` would look like:

```
- run:
    name: Bundler-Audit
    command: bundle exec lois bundler-audit -g $GITHUB_CREDENTIALS

- run:
    name: Brakeman
    command: bundle exec lois brakeman -g $GITHUB_CREDENTIALS

- run:
    name: Rubocop
    command: bundle exec lois rubocop -g $GITHUB_CREDENTIALS

- run:
    name: Reek
    command: bundle exec lois reek -g $GITHUB_CREDENTIALS

- store_artifacts:
    path: lois
    destination: lois
```

##### CircleCI 1.0
A sample `circle.yml` would look like:
```
test:
  pre:
    - bundle exec lois bundler-audit -g $GITHUB_CREDENTIALS
    - bundle exec lois brakeman -g $GITHUB_CREDENTIALS
    - bundle exec lois rubocop -g $GITHUB_CREDENTIALS
    - bundle exec lois reek -g $GITHUB_CREDENTIALS
{'fraction_non_alphanumeric': 0.0872093023255814, 'fraction_numerical': 0.0026062550120288693, 'mean_word_length': 3.391725352112676, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, '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': '3762804', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1592, 'n_words': 547}