Giter Club home page Giter Club logo

pytest-repo-health's Introduction

pytest-repo-health

PyPI version Python versions See Build Status on Travis CI See Build Status on AppVeyor

pytest-repo-health inspects a code repository and outputs a report with info on whether the repository follows standards as defined by checks. It's a good complement for a cookiecutter; the cookiecutter provides a good template for starting a repository with current best practices, and pytest-repo-health helps it keep up with those practices as they evolve over time.

This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template.

Installation

For now, you need to git clone pytest-repo-health from: [email protected]:edx/pytest-repo-health.git You can install by running make requirements and then pip install -e . in a Python 3.5+ virtualenv.

Usage

Once installed, following command is used to run checks:

$ pytest --repo-health --repo-health-path <path to dir with checks> --repo-path <path to dir on which to run tests>

If you run into problems, these pytest flags might help:

-c file: load configuration from `file` instead of trying to locate one of the
                    implicit configuration files. Helpful if invocation dir defines "add-opts" in one of its files.
--noconftest: Don't load any conftest.py files. Helpful in case invocation dir/repository has conftest files that change configurations or cause pytest to run unnecessary code.

At edX, the following command works for most of our repos:

$ pytest -c <() --noconftest --repo-health --repo-health-path <path to dir with checks> --repo-path <path to dir on which to run tests>

Adding Custom Checks

If you would like to add custom checks for your own repo, create a dir named "repo_health" and place modules with checks inside of it.

Checks naming convention:

  • python_functions = "check_*"
  • python_files = "check_*.py"

Checks Discovery

Pytest will look for checks in directories located in these places: - Dir of pytest invocation(so current dir) - Dir where pytest-repo-health is installed - Dir specified by --repo-health-path flag in pytest invocation

Args

Arguments added by plugin:

--repo-health: this arg needs to be present for plugin to do anything

--repo-path <dir path> : the path to dir on which to perform checks. If not preset, checks will be performed on current dir

--repo-health-path <dir path>: path to where checks are located. If not preset, plugin will look for checks in current repo

--output-path <file path> : path to where to save resulting checks report

--repo-health-metadata: if the is present, plugin will collect metadata(docs) from checks and output them as a metadata.yaml file

Plugin Enhancement path

  • Currently, the checks do not throw any kind of warning or error if check does not pass.
  • Documenting standard reqs/checks in each check better
  • create tests for this plugin(currently, you can run these checks on this repo, but no automated method for it)

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

The code in this repository is licensed under the Apache Software License 2.0 unless otherwise noted.

Please see LICENSE.txt for details.

How To Contribute

Contributions are very welcome.

Please read How To Contribute for details.

Even though they were written with edx-platform in mind, the guidelines should be followed for Open edX code in general.

The pull request description template should be automatically applied if you are creating a pull request from GitHub. Otherwise you can find it it at PULL_REQUEST_TEMPLATE.md

Issues

The issue report template should be automatically applied if you are creating an issue on GitHub as well. Otherwise you can find it at ISSUE_TEMPLATE.md

If you encounter any problems, please file an issue along with a detailed description.

Reporting Security Issues

Please do not report security issues in public. Please email [email protected].

Getting Help

Have a question about this repository, or about Open edX in general? Please refer to this list of resources if you need any assistance.

pytest-repo-health's People

Contributors

jinder1s avatar timmc-edx avatar edx-semantic-release avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.