Skip to content
Snippets Groups Projects
Commit 4c9f0456 authored by Daniel Dehennin's avatar Daniel Dehennin
Browse files

feat(python): check code formatting using `black`

parent 6a4e4ccd
No related branches found
No related tags found
3 merge requests!47Publish new release,!46Prepare new release,!45feat(python): template jobs to build and upload source and wheel packages
# -*- coding: utf-8 -*-
# vim: ft=yaml
#
# Hidden template jobs to be used in `.gitlab-ci.yml`
#
# - `.python:black:check`: verify formatting of code with `black`
#
---
#
# .python:black:check
# ===================
#
# The Python code must match `black` standard.
#
# USAGE
# =====
#
# include:
# - project: EOLE/Infra/ci-tools
# ref: stable
# file: /templates/Python.yaml
#
# stages:
# - lint
#
# python:black: {extends: '.python:black:check'}
#
# REQUIREMENTS
# ============
#
# - a `lint` stage must be present in your pipeline or it must be
# overriden by the extending job to feet your need
#
# - the `.not-on-stable` rules templates
#
# OPTIONAL VARIABLES
# ==================
#
# - `PYTHON_BLACK_OPTS`: additional options to pass to `black`
#
# - `PYTHON_SOURCE_DIR`: top level directory where to run `black`,
# defaults to `.`
#
# - `PYTHON_BLACK_IMAGE`: name of the black docker image to use
#
.python:black:check:
stage: lint
extends: .not-on-stable
image: "${PYTHON_BLACK_IMAGE}"
variables:
PYTHON_BLACK_IMAGE: "hub.eole.education/proxyhub/pyfound/black:latest_release"
PYTHON_BLACK_OPTS: ''
PYTHON_SOURCE_DIR: '.'
script:
- echo -e "\e[0Ksection_start:`date +%s`:python-black\r\e[0KExecute 'black --check ${PYTHON_BLACK_OPTS} ${PYTHON_SOURCE_DIR}'"
- black --check ${PYTHON_BLACK_OPTS} ${PYTHON_SOURCE_DIR}
- echo -e "\e[0Ksection_end:`date +%s`:python-black\r\e[0K"
...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment