Skip to content

Commit 49dca47

Browse files
committedSep 10, 2020
add Black (pre-commit hook) and flake8 (PR annotations) runs (icesat2py#96)
* add black pre-commit hook and reformat files using black * add github action workflow with flake8 on PRs
1 parent 31b27e5 commit 49dca47

19 files changed

+2934
-1259
lines changed
 

‎.github/workflows/flake8_action.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# use the flake8 linter to annotate improperly formatted code
2+
# from: https://github.com/marketplace/actions/run-flake8-on-your-pr-with-annotations
3+
name: Run flake8 linter on PRs
4+
5+
on:
6+
pull_request:
7+
branches:
8+
- development
9+
- master
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Annotate PR after running flake8
15+
uses: TrueBrain/actions-flake8@master
16+
with:
17+
max_line_length: 90
18+
# https://github.com/marketplace/actions/run-flake8-on-your-pr-with-annotations?version=1.0.1
19+
# uses: tayfun/flake8-your-pr@master
20+
# secrets: ["GITHUB_TOKEN"]

‎.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: stable
4+
hooks:
5+
- id: black

‎doc/source/conf.py

+31-25
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
#
1313
import os
1414
import sys
15-
sys.path.insert(0, os.path.abspath('../..'))
15+
16+
sys.path.insert(0, os.path.abspath("../.."))
1617
import datetime
1718

1819
import icepyx
@@ -21,9 +22,9 @@
2122

2223
# -- Project information -----------------------------------------------------
2324

24-
project = 'icepyx'
25+
project = "icepyx"
2526
year = datetime.date.today().year
26-
copyright = '2019-{}, The icepyx Developers'.format(year)
27+
copyright = "2019-{}, The icepyx Developers".format(year)
2728

2829
# -- General configuration ---------------------------------------------------
2930

@@ -35,24 +36,23 @@
3536
"sphinx.ext.autosectionlabel",
3637
"numpydoc",
3738
"nbsphinx",
38-
"recommonmark"
39-
39+
"recommonmark",
4040
]
4141
source_suffix = {
42-
'.rst': 'restructuredtext',
43-
'.txt': 'markdown',
44-
'.md': 'markdown',
42+
".rst": "restructuredtext",
43+
".txt": "markdown",
44+
".md": "markdown",
4545
}
4646
# Add any paths that contain templates here, relative to this directory.
47-
templates_path = ['_templates']
47+
templates_path = ["_templates"]
4848

4949
# List of patterns, relative to source directory, that match files and
5050
# directories to ignore when looking for source files.
5151
# This pattern also affects html_static_path and html_extra_path.
52-
exclude_patterns = ['**.ipynb_checkpoints']
52+
exclude_patterns = ["**.ipynb_checkpoints"]
5353

5454
# location of master document (by default sphinx looks for contents.rst)
55-
master_doc = 'index'
55+
master_doc = "index"
5656

5757

5858
# -- Configuration options ---------------------------------------------------
@@ -68,24 +68,30 @@
6868
# html_theme = 'alabaster'
6969
html_theme = "sphinx_rtd_theme"
7070
html_theme_options = {
71-
'logo_only': True,
72-
'display_version': False,
73-
'prev_next_buttons_location': None,
74-
'navigation_depth': 4,
75-
'collapse_navigation': True
71+
"logo_only": True,
72+
"display_version": False,
73+
"prev_next_buttons_location": None,
74+
"navigation_depth": 4,
75+
"collapse_navigation": True,
7676
}
77-
html_logo = '_static/icepyx_v2_oval_orig_nobackgr.png'
78-
html_favicon = '_static/icepyx_v2_oval_tiny-uml_nobackgr.png'
79-
html_static_path = ['_static']
77+
html_logo = "_static/icepyx_v2_oval_orig_nobackgr.png"
78+
html_favicon = "_static/icepyx_v2_oval_tiny-uml_nobackgr.png"
79+
html_static_path = ["_static"]
8080

8181
html_context = {
82-
'menu_links_name': '',
83-
'menu_links': [
84-
('<i class="fa fa-github fa-fw"></i> icepyx Github', 'https://github.com/icesat2py/icepyx'),
85-
('<i class="fa fa-comments fa-fw"></i> Pangeo Discourse', 'https://discourse.pangeo.io/t/icepyx-python-tools-for-icesat-2-data/404/2')
86-
87-
]
82+
"menu_links_name": "",
83+
"menu_links": [
84+
(
85+
'<i class="fa fa-github fa-fw"></i> icepyx Github',
86+
"https://github.com/icesat2py/icepyx",
87+
),
88+
(
89+
'<i class="fa fa-comments fa-fw"></i> Pangeo Discourse',
90+
"https://discourse.pangeo.io/t/icepyx-python-tools-for-icesat-2-data/404/2",
91+
),
92+
],
8893
}
8994

95+
9096
def setup(app):
9197
app.add_stylesheet("style.css")

‎icepyx/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .core import icesat2data
1+
from .core import icesat2data

0 commit comments

Comments
 (0)