Skip to content

Commit

Permalink
Merge pull request #25 from Open-EO/issue16-ruff
Browse files Browse the repository at this point in the history
Github actions "Lint" workflow: Enable ruff code linter (instead of flake8)
  • Loading branch information
soxofaan authored Jan 22, 2024
2 parents 9a4ab1b + 5d43e22 commit d893c9c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install isort black flake8
python -m pip install isort black ruff
- name: isort
run: python -m isort . --check --diff
# - name: black
# run: python -m black --check --diff .
# - name: flake8
# run: python -m flake8 .
- name: ruff
run: ruff check .
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,15 @@ addopts = [

[tool.isort]
profile = "black"


[tool.ruff]
# line-length = 100

[tool.ruff.lint]
select = ["E", "F"]
ignore = [
"E501", # Ignore "line-too-long" issues, let black handle that.
]


2 changes: 1 addition & 1 deletion src/openeo_gfmap/fetching/s1.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from geojson import GeoJSON

from openeo_gfmap.backend import Backend, BackendContext
from openeo_gfmap.spatial import BoundingBoxExtent, SpatialContext
from openeo_gfmap.spatial import SpatialContext
from openeo_gfmap.temporal import TemporalContext

from .commons import (
Expand Down
1 change: 0 additions & 1 deletion src/openeo_gfmap/preprocessing/udf_rank.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from pathlib import Path

import numpy as np
import xarray as xr
Expand Down
5 changes: 1 addition & 4 deletions src/openeo_gfmap/preprocessing/udf_score.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import datetime
import math
import time

import numpy as np
import xarray as xr
from openeo.udf import XarrayDataCube
from scipy.ndimage import distance_transform_cdt
from skimage.morphology import binary_dilation, binary_erosion, footprints
from xarray.ufuncs import isnan as ufuncs_isnan
from skimage.morphology import binary_erosion, footprints


def apply_datacube(cube: XarrayDataCube, context: dict) -> XarrayDataCube:
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_gfmap/spatial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" Definitions of spatial context, either point-based or spatial"""
from dataclasses import dataclass
from typing import Dict, Union
from typing import Union

from geojson import GeoJSON

Expand Down
1 change: 0 additions & 1 deletion src/openeo_gfmap/temporal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
""" Definitions of temporal context"""
from dataclasses import dataclass
from datetime import datetime
from typing import Tuple


@dataclass
Expand Down
1 change: 0 additions & 1 deletion src/openeo_gfmap/utils/build_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
based job. Usefull to collect the output of point based extraction.
"""

from datetime import datetime
from pathlib import Path

import pandas as pd
Expand Down
2 changes: 1 addition & 1 deletion src/openeo_gfmap/utils/intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
methods.
"""

from datetime import datetime, timedelta
from datetime import timedelta

from openeo_gfmap import TemporalContext

Expand Down
1 change: 0 additions & 1 deletion tests/test_openeo_gfmap/test_cloud_masking.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pathlib import Path
from typing import Union

import pytest

Expand Down
2 changes: 0 additions & 2 deletions tests/test_openeo_gfmap/test_s2_fetchers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
""" Tests for data extractors for Sentinel2 data. """
from pathlib import Path
from typing import Union

import geojson
import geopandas as gpd
import numpy as np
import openeo
import pytest
import rioxarray
Expand Down

0 comments on commit d893c9c

Please sign in to comment.