Skip to content

localLandscapeIo

Mike Timm edited this page Mar 23, 2015 · 1 revision

Local Landscape.io

Landscape.io is being used to check code quality. This is a service that runs multiple python code checkers (linters) for every commit and pull request using a github hook.

The results of the cobra runs can be found at the Cobra landscape.io page.

Please see the full landscape.io documentation for more information.

These same checks can be run locally as well. landscape.io uses a python package called Prospector. This package runs pylint, pep8, pyflakes, dodgy, pep257 as well as potentially a few other optional packages. This document describes how to setup an run prospector on a local cobra repository.

Basic steps

  1. Clone the cobra repository
  2. Create a virtual environment
  3. Install prospector into the virtual environment
  4. Run prospector against the cobra repository

Detailed steps

Clone the cobra repository

cd /directory/where/you/want/the/repository
git clone https://github.com/datacenter/cobra.git

Optionally you can switch to a different branch:

git checkout <branch-name>

Create a virtual environment

How this is done depends on which tools you have installed and which version of python you are using.

Python 2 and virtualenv-wrapper

mkvirtualenv <virtualenvname>

Python 2 and just virtualenv

cd <dir-to-where-venv-should-go>
virtualenv <venv-name>
source <venv-name>/bin/activate

Python 3

pyvenv <dir-to-where-venv-should-go>/<venv-name>
source <dir-to-where-venv-should-go>/<venv-name>/bin/activate

Install prospector into the virtual environment

pip install prospector

Run prospector against the cobra repository

cd /directory/where/you/want/the/repository/cobra
prospector -P /directory/where/you/want/the/repository/cobra/.landscape.yaml cobra

You can also run it against just a single file:

prospector -P /directory/where/you/want/the/repository/cobra/.landscape.yaml cobra/mit/access.py