Skip to content

Commit c4b3996

Browse files
authored
Add CI linting workflow (#11)
* add lint CI workflow * pep8 fixes * yaml syntax error * remove unnecessary E501 tags for max-line-length=99
1 parent 6428f52 commit c4b3996

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

.github/workflows/lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches: [ $default-branch ]
6+
pull_request:
7+
8+
jobs:
9+
lint:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: 3.8
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install flake8
23+
- name: Lint with flake8
24+
run: |
25+
flake8 . --count --max-line-length=99 --statistics

twoaxistracking/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from .layout import generate_field_layout
2-
from .shading import shaded_fraction
1+
from .layout import generate_field_layout # noqa: F401
2+
from .shading import shaded_fraction # noqa: F401
33

44

55
try:
6-
from shapely.geos import lgeos
6+
from shapely.geos import lgeos # noqa: F401
77
except OSError as err:
88
msg = (
99
"An error was encountered when importing the shapely package. "

twoaxistracking/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def generate_field_layout(gcr, collector_area, L_min, neighbor_order,
6969
----------
7070
.. [1] `Shading and land use in regularly-spaced sun-tracking collectors, Cumpston & Pye.
7171
<https://doi.org/10.1016/j.solener.2014.06.012>`_
72-
""" # noqa: E501
72+
"""
7373
# Consider special layouts which can be defined only by GCR
7474
if layout_type == 'square':
7575
aspect_ratio = 1

twoaxistracking/shading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def shaded_fraction(solar_azimuth, solar_elevation,
3939
-------
4040
shaded_fraction: float
4141
Shaded fraction for the specific solar position and field layout.
42-
""" # noqa: E501
42+
"""
4343
# If the sun is below the horizon, set the shaded fraction to nan
4444
if solar_elevation < 0:
4545
return np.nan
@@ -61,7 +61,7 @@ def shaded_fraction(solar_azimuth, solar_elevation,
6161
if np.sqrt(x**2+y**2) < L_min:
6262
# Project the geometry of the shading collector onto the plane
6363
# of the investigated collector
64-
shade_geometry = shapely.affinity.translate(collector_geometry, x, y) # noqa: E501
64+
shade_geometry = shapely.affinity.translate(collector_geometry, x, y)
6565
# Update the unshaded area based on overlapping shade
6666
unshaded_geomtry = unshaded_geomtry.difference(shade_geometry)
6767
if plot:

0 commit comments

Comments
 (0)