Skip to content

Self-hosted open source app to control metrics of your code

License

Notifications You must be signed in to change notification settings

Wolox/codestats

Repository files navigation

Code Stats

Circle CI Code Climate Test Coverage

Self-hosted open source app to control metrics of your code. Code Stats lets to control the quality of your code by integrating your Github pull requests with any metric you want.

How does it work?

By including the Code Stats Metrics Reporter gem in your app and setting up the .codestats.yml file, your Continous Integration will run certains scripts that will let Code Stats list all the metrics you want and run custom checks whenever you create a Github Pull Request

Badge

You can add a Code Stats badge to you README by adding the following:

[![Codestats](http://your-codestats-url/organizations/an-organization/projects/a-project/badge)]((http://your-codestats-url/organizations/an-organization/projects/a-project/badge)

it will look something like this:

code stats error badge code stats failed badge code stats success badge

Screenshots

Pull Request Integration Success Metric Failed Metric

Running local server

1- Installing Ruby

  • Clone the repository by running git clone git@github.com:Wolox/codestats.git
  • Go to the project root by running cd codestats
  • Download and install Rbenv.
  • Download and install Ruby-Build.
  • Install the appropriate Ruby version by running rbenv install [version] where version is the one located in .ruby-version

2- Installing Rails gems

  • Install Bundler.
  • Install basic dependencies if you are using Ubuntu:
  sudo apt-get install build-essential libpq-dev nodejs
  • Install all the gems included in the project.
  gem install bundler --no-ri --no-rdoc
  rbenv rehash
  bundle -j 20

Database Setup

Run in terminal:

  sudo -u postgres psql
  CREATE ROLE "codestats" LOGIN CREATEDB PASSWORD 'codestats';

Log out from postgres and run:

  bundle exec rake db:create db:migrate

Your server is ready to run. You can do this by executing rails server and going to http://localhost:3000. Happy coding!

Deploy Guide

Heroku

If you want to deploy your app using Heroku you need to do the following:

  • Add the Heroku Git URL
  • Push to heroku
  • Run migrations
  git remote add heroku-prod your-git-url
  git push heroku-prod your-branch:master

AWS

The gems and files needed to make a deploy to AWS with Capistrano are included in this repo but commented. Feel free to use them.

Rollbar Configuration

Rollbar is used for exception errors report. To complete this configuration setup the following environment variables in your server:

  • ROLLBAR_ACCESS_TOKEN with the credentials located in the rollbar application.
  • ROLLBAR_ENVIRONMENT with the environment name you want to be shown in Rollbar. This is usefull if you have different servers running in Production mode and you want to identify them in Rollbar.

Google Analyitics

Set the GOOGLE_ANALYTICS_TOKEN environment variable in your server.

Credentials

You can use either environment variables or the secrets.yml. If you want to set environment variables in development you can add them to .env.local (you can find an example in the .env.local.example file.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Run rspec tests (bundle exec rspec spec -fd)
  5. Run rubocop lint (bundle exec rubocop app spec -R)
  6. Push your branch (git push origin my-new-feature)
  7. Create a new Pull Request

Feel free to add a new Issue by clicking here if you find a bug, idea of improvement, etc.

About

This project is maintained by:

and it is written by Wolox under the LICENSE license.

Wolox

About

Self-hosted open source app to control metrics of your code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •