Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pre-commit to dependency and contributing guideline #873

Merged
merged 5 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- [ ] Fix #xxxx
- [ ] Pass Codacy code review (green)
- [ ] Pass Pre-commit check (green)
- [ ] Pass Circle CI test (green)
- [ ] Make sure that your code follows our style. Use the other functions/files as a basis.
- [ ] If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
Expand Down
4 changes: 4 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ is a great starting point if you are new to version control.
- `upstream`, which refers to the `insarlab` repository
- `origin`, which refers to your personal fork

+ Setting up `pre-commit` within `MintPy` directory:
- Run `pre-commit sample-config` to generate a very basic configuration (`.pre-commit-config.yaml`).
- Run `pre-commit install` to set up the git hook scripts, so that `pre-commit` will run automatically on git commit ([https://pre-commit.com/](https://pre-commit.com/)).

#### 2. Develop your contribution: ####

+ **Open an [issue](https://github.com/insarlab/MintPy/issues) first** if you plan to introduce a new feature or to change funcationality, we may have easier ways to help you implement it. If there is already an issue that matches your idea, leave a comment there instead to let us know what you plan to do. For bug fixes, documentation updates, etc., this is generally not necessary.
Expand Down
4 changes: 2 additions & 2 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ dependencies:
- dask>=1.0
- dask-jobqueue>=0.3
- defusedxml
- gdal>=3 # for ISCE, ARIA, FRInGE, HyP3, GMTSAR users
- h5py
- joblib
- lxml
- matplotlib
- numpy
- pre-commit # for developers
- pyaps3>=0.3
- pykml>=0.2
- pyproj
Expand All @@ -28,5 +30,3 @@ dependencies:
- rich
- scikit-image
- scipy
# for ISCE, ARIA, FRInGE, HyP3, GMTSAR
- gdal>=3
2 changes: 2 additions & 0 deletions mintpy/utils/ptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ def read_date_txt(date_file):
# read text file
with open(date_file) as f:
date_list = f.read().splitlines()
# ignore invalid lines, e.g. empty
date_list = [x for x in date_list if x]

# format
date_list = sorted(yyyymmdd(date_list))
Expand Down
2 changes: 1 addition & 1 deletion mintpy/utils/readfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ def read_template(fname, delimiter='=', skip_chars=None):
# skip certain characters by replacing them with empty str
if skip_chars:
for skip_char in skip_chars:
value.replace(skip_char, '')
value = value.replace(skip_char, '')

if value != '':
template[key] = value
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ cvxopt
dask>=1.0
dask-jobqueue>=0.3
defusedxml
# gdal>=3 # for ISCE, ARIA, FRInGE, HyP3, GMTSAR users
h5py
joblib
lxml
matplotlib
numpy
pre-commit # for developers
pyaps3>=0.3
pykml>=0.2
pyproj
Expand All @@ -23,5 +25,3 @@ pysolid
rich
scikit-image
scipy
# for ISCE, ARIA, FRInGE, HyP3, GMTSAR
# gdal>=3
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"lxml",
"matplotlib",
"numpy",
"pre-commit", # for developers
"pyaps3>=0.3",
"pykml>=0.2",
"pyproj",
Expand Down