ST012: HasCIConfig
Overview
| Property | Value |
|---|---|
| ID | ST012 |
| Name | HasCIConfig |
| Group | structure |
| Severity | WARNING |
Description
Checks for the presence of a continuous integration (CI) configuration file.
CI automation ensures that tests are run, code quality checks pass, and builds succeed on every commit or pull request.
What it checks
The check looks for any of these CI configuration files:
.github/workflows/*.ymlor.github/workflows/*.yaml(GitHub Actions).gitlab-ci.yml(GitLab CI).travis.yml(Travis CI).circleci/config.yml(CircleCI)azure-pipelines.yml(Azure Pipelines)Jenkinsfile(Jenkins).drone.yml(Drone CI)
Why it matters
- Quality Assurance - Ensures tests run on every change
- Consistency - Tests run in a clean, reproducible environment
- Collaboration - PRs are automatically validated
- Release Safety - Prevents broken code from being released
- Documentation - Shows users the project is actively maintained
How to fix
Create a CI configuration file. Here’s an example GitHub Actions workflow:
GitHub Actions
Create .github/workflows/ci.yml:
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: pytest
- name: Run pycmdcheck
run: pycmdcheck checkGitLab CI
Create .gitlab-ci.yml:
stages:
- test
test:
stage: test
image: python:3.11
script:
- pip install -e ".[dev]"
- pytest
- pycmdcheck checkConfiguration
Skip this check
[tool.pycmdcheck]
skip = ["ST012"]CLI
pycmdcheck --skip ST012