Skip to content

Commit

Permalink
Merge pull request #5 from madrisan/pylint-workflow
Browse files Browse the repository at this point in the history
ci: add a job running pylint
  • Loading branch information
madrisan authored Dec 23, 2024
2 parents 8c31f68 + 5028bca commit e8a6faa
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: lint
on: [push, pull_request]
jobs:
run-linters:
name: Run linters
ci:
name: Run black and pylint tools
runs-on: ubuntu-latest

steps:
Expand All @@ -12,7 +12,12 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.12

- name: Install the latest version of uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"

- name: Install Python dependencies
run: pip install black flake8
Expand All @@ -23,3 +28,7 @@ jobs:
auto_fix: false
black: true
flake8: false

- name: Analysing the code with pylint
run: |
uv run pylint --output-format=text ./**/*.py
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Visualize the HadCRUT5 temperature datasets

![Release Status](https://img.shields.io/badge/status-stable-brightgreen.svg)
![Pylint](images/pylint.svg)
[![License](https://img.shields.io/badge/License-GPL--3.0-blue.svg)](https://spdx.org/licenses/GPL-3.0-only.html)
[![GitHub stars](https://img.shields.io/github/stars/madrisan/HadCRUT5.svg?style=social)](https://github.com/madrisan/HadCRUT5/stargazers)

> HadCRUT5 is a gridded dataset of global historical surface temperature anomalies relative to a 1961-1990 reference period.
> Data are available for each month from January 1850 onwards, on a 5 degree grid and as global and regional average time series.
> The dataset is a collaborative product of the Met Office Hadley Centre and the Climatic Research Unit at the University of East Anglia.
Expand Down
23 changes: 23 additions & 0 deletions images/pylint.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions pylint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
uv run pylint \
--verbose \
--output-format=text ./**/*.py \
| tee pylint-log.txt

score="$(
sed -n "/^Your code has been rated at/{s,.* at \([0-9\.]*\)\/.*,\1,p}" \
pylint-log.txt)"

uv run anybadge \
--file="images/pylint.svg" \
--label "pylint" \
--overwrite \
--value "$score"

rm -f pylint-log.txt
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies = [

[dependency-groups]
dev = [
"anybadge>=1.14.0",
"black>=24.10.0",
"mypy>=1.14.0",
"pylint>=3.3.2",
Expand Down
14 changes: 14 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8a6faa

Please sign in to comment.