Phare
Phare looks into your files and check for coding style errors.

Installation

Add these lines to your application’s Gemfile as development dependencies:

group :development do
  gem 'rubocop' # to check Ruby code
  gem 'scss-lint' # to check SCSS code

  gem 'phare'
end
$ bundle install

If you wish to check for JavaScript code style using JSHint and JSCS, you must specify them in your package.json file:

{
  "name": "foo",
  "version": "0.0.1",
  "devDependencies": {
    "jshint": "latest",
    "jscs": "latest"
  }
}
$ npm install

Shims

Phare uses top-level commands in its checks (eg. $ rubocop and not $ bundle exec rubocop). You’ll need to run these commands in order to use the shims provided by either Bundler or NPM.

Bundler

$ bundle install
$ bundle binstub rubocop scss-lint
$ export PATH="./bin:$PATH"

npm

$ npm install
$ export PATH="./node_modules/.bin:$PATH"

Usage

Phare provides an executable named phare. You can just use it as is:

$ phare

Version control hook

One of the best ways to use Phare is by hooking it to your version control commit process. For example, with git:

$ bundle binstubs phare
$ ln -s "`pwd`/bin/phare" .git/hooks/pre-commit

That way, every time git commit is ran, phare will be executed and the commit will be aborted if there are some errors. However, you can skip this check altogether by specifying SKIP_PHARE=1 before your command.

$ git commit -m 'Add stuff'
$ SKIP_PHARE=1 git commit -m 'Add stuff and I don’t care about Phare'

Options

Command-line

Option Description
directory The directory in which to run the checks (default is the current directory
only The specific checks to run (e.g. --only=rubocup,jscs)
skip The checks to skip (e.g. --skip=scsslint)

.phare.yml

Instead of using command-line arguments when running the phare command, you can create a .phare.yml file at the root of your project and hard-code options in that file.

skip:
  - scsslint
  - jshint

Contributors

License

Phare is © 2014-2015 Mirego and may be freely distributed under the New BSD license. See the LICENSE.md file.

The lighthouse logo is based on this lovely icon by Nick Lacke, from The Noun Project.

About Mirego

Mirego is a team of passionate people who believe that work is a place where you can innovate and have fun. We're a team of talented people who imagine and build beautiful Web and mobile applications. We come together to share ideas and change the world.

We also love open-source software and we try to give back to the community as much as we can.