jazzband / geojson

Python bindings and utilities for GeoJSON
https://pypi.python.org/pypi/geojson/
BSD 3-Clause "New" or "Revised" License
913 stars 121 forks source link

Setup flake8 CI job #207

Closed NoharaMasato closed 1 year ago

NoharaMasato commented 1 year ago

Summary:

codecov[bot] commented 1 year ago

Codecov Report

Merging #207 (c35a19e) into main (3a3a1b3) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #207   +/-   ##
=======================================
  Coverage   98.25%   98.25%           
=======================================
  Files          19       19           
  Lines         801      801           
=======================================
  Hits          787      787           
  Misses         14       14           
Impacted Files Coverage Δ
geojson/utils.py 95.53% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

NoharaMasato commented 1 year ago

I don't know why this change decreased the test coverage and caused a job failure on CI. Please let me know if I need to add unit tests for the utils.py

NoharaMasato commented 1 year ago

Added a test for utils.py in https://github.com/jazzband/geojson/pull/210

hugovk commented 1 year ago

Or a better idea, let's do it using the existing pre-commit!

Add this to .pre-commit-config.yaml:

 repos:
+  - repo: https://github.com/PyCQA/flake8
+    rev: 6.0.0
+    hooks:
+      - id: flake8
+
   - repo: https://github.com/pre-commit/pre-commit-hooks
     rev: v4.4.0
     hooks:

And replace lint.yml with:

name: Lint

on: [push, pull_request, workflow_dispatch]

permissions:
  contents: read

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: "3.x"
      - uses: pre-commit/action@v3.0.0
NoharaMasato commented 1 year ago

@hugovk , @rayrrr Thanks for checking the PR. Updated to use pre-commit hook to run link on CI.