Skip to content

Commit

Permalink
pre-commit workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lmilbaum committed Jun 28, 2023
1 parent 41cf40f commit 0ed9ed8
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: pre-commit

on:
pull_request:
branches: ["master"]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/[email protected]
- name: Install dependencies
run: |
pip install poetry==1.5.1 pylint==2.17.4
poetry export --with dev --output requirements.txt
python -m pip install -r requirements.txt
- uses: pre-commit/[email protected]
35 changes: 35 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
default_language_version:
python: python3

repos:
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.3.0
hooks:
- id: mypy
language: system
pass_filenames: false
args: [--config-file, mypy.cfg, anitya]

- repo: https://github.com/maxbrunet/pre-commit-renovate
rev: 34.160.0
hooks:
- id: renovate-config-validator
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
.. image:: https://img.shields.io/badge/renovate-enabled-brightgreen.svg
:target: https://renovatebot.com/

.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit
:target: https://pre-commit.com/

.. image:: https://img.shields.io/lgtm/alerts/g/fedora-infra/anitya.svg?logo=lgtm&logoWidth=18
:target: https://lgtm.com/projects/g/fedora-infra/anitya/alerts/

Expand Down
2 changes: 1 addition & 1 deletion anitya/lib/versions/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
https://pypi.org/
"""

from datetime import datetime
import functools
from datetime import datetime
from typing import Optional

# Import entire modules so it's clear which "Version" and "InvalidVersion"
Expand Down
2 changes: 1 addition & 1 deletion anitya/tests/lib/versions/test_rpm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*- # pylint: disable=R0401
# -*- coding: utf-8 -*-
#
# Copyright © 2017 Red Hat, Inc.
#
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ build-backend = "poetry.core.masonry.api"
disable = [
"attribute-defined-outside-init",
"broad-exception-caught",
"cyclic-import",
"duplicate-code",
"inconsistent-return-statements",
"invalid-name",
Expand Down

0 comments on commit 0ed9ed8

Please sign in to comment.