Skip to content
Repository mirror of GitLab: https://gitlab.com/teonite/inspectr.git
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker
inspectr
md_imgs
tests
.bumpversion.cfg
.coveragerc
.flake8
.gitignore
.gitlab-ci.yml
CHANGELOG
Dockerfile
LICENSE
README.md
inspectr.json
inspectr.template.json
requirements.pip
run_inspectr.py
setup.cfg
setup.py
upload_package.sh

README.md

top

What is InspectR?

InspectR gives you insight into quality of your code at a glance. It supports variety of code quality tools. When you add inspectr.json file to your project directory and use command inspectr reports from your test tools will be created and saved in RethinkDB.

You can see the reports using inspectr-dashboard, it looks like this:

example

Those are the ones supported now, more under way:

  • flake8 python linter
  • python unittests
  • py.test tests
  • coverage.py reports
  • eslint javascript linter
  • jasmine tests
  • mocha tests
  • karma-coverage reports

Quick start

  1. Install Inspectr globally from pip pip3 install inspectr.
  2. Start RethinkDB
    docker run -d -p 8080:8080 -p 28015:28015 rethinkdb:2.3
    
  3. Add inspectr.json to your project root directory. Example:
    {
      "project_name": "My Project",
      "rethinkdb_host": "localhost",
      "rethinkdb_port": 28015,


      "reporters": [
        {
          "type": "jasmine",
          "command": "karma start karma.conf.js --single-run"
        },
        {
          "type": "mocha",
          "command": "karma start karma.conf.js --single-run"
        }
      ]
    }
  1. Use command inspectr in this directory.
  2. Run inspectr-dashboard with RethinkDB.
  3. If everything went ok you should see results in browser.

Using inspectr with docker

  1. Run RethinkDB, we recommend to use docker-compose in inspectr-dashboard creates RethinkDB container.
  2. Add inspectr.json to your project root directory (example above).
  3. Change rethinkdb_host and rethinkdb_port if you have to.
  4. Clone this repo using git clone git@git.teonite.net:inspectr/inspectr.git.
  5. Build docker image, for example: docker build -t inspectr_cli . in inspectr directory
  6. Run your docker image (for example: docker run -t -v $PWD/project:/code inspectr_cli). Give your inspectr.json path instead of $PWD/project. If everything went ok report will be sent to rethinkDB and will be available in inspectr-dashboard.
  7. If you're using RethinkDB docker container locally, and you'll see error ConnectionRefusedError: [Errno 111] Connection refused you have to link RethinkDB container to alias which will be use in inspectr.json as rethinkdb_host parameter. Example: docker run -t --link inspectrdashboard_rethinkdb_1:db_link -v $PWD:/code inspectr_cli where inspectrdashboard_rethinkdb_1 is name of your RethinkDB container and db_link is parameter of rethinkdb_host in inspectr.json.
  8. Your reports should be saved in RethinkDB. Use inspectr-dashboard to see results in browser.

For more informations check FAQ at the end of README.

Using inspectr locally

  1. Run RethinkDB
  2. Install Python virtual environment using, e.x. this code :
    pip3 install virtualenv
    virtualenv env
    source env/bin/activate
    
  3. Install InspectR CLI to your venv python setup.py install
  4. Place inspectr.json in your project directory (example above) and use command inspectr.
  5. If you're inspecting JS app install (global) dependencies from docker/package.json.
  6. If you're inspecting python app install pip requirements from requirements.pip and docker/reporter-requirements.pip

Running

Simply go to your project and InspectR it! (remember that it must contain inspectr.json!)

cd /path/to/my/project
inspectr

Results should be visible in InspectR Dashboard

List of reporters

List of reporters:

{
      "project_name": "My Project",

      "reporters": [
        {
          "type": "flake8",
          "command": "flake8 apps/"
        },
        {
          "type": "unittest",
          "command": "manage.py test"
        },
        {
          "type": "coverage-py",
          "command": "coverage report"
        },
        {
          "type": "pytest",
          "command": "coverage run -m py.test"
        },
        {
          "type": "eslint",
          "command": "eslint src/"
        },
        {
          "type": "jasmine",
          "command": "karma start karma.conf.js --single-run"
        },
        {
          "type": "mocha",
          "command": "karma start karma.conf.js --single-run"
        },
        {
          "type": "karma-coverage",
          "command": null
        }
      ]
    }

FAQ

  1. If you have problems setting up Your RethinkDB instance, simply run it as Docker container:

    docker run -d -p 8080:8080 -p 28015:28015 -p 29015:29015 rethinkdb
    
  2. You have to run inspectr at your app first to create Collections in RethinkDB, otherwise you'll see error "Collection reports does not exist"

  3. If one of your reporters will fail check if it is installed. For example if you have error

[FAIL] eslint src/ (eslint) FileNotFoundError: [Errno 2] No such file or directory: 'eslint' ``` Install eslint npm install -g eslint

  1. If you're inspecting django app local, install django in your virtualenv.
  2. If you're using Inspectr in docker and you want to connect with RethinkDB running locally (not as a container) run docker run -t --net="host" -v $PWD/project:/code inspectr_cli
You can’t perform that action at this time.