Naissant / dendri

Common Healthcare feature engineering algorithms implemented in PySpark.
MIT License
2 stars 1 forks source link

Linting Failing #1

Closed WesRoach closed 3 years ago

WesRoach commented 3 years ago

@rileyschack I'm not sure why, but the black formatter within Github's Actions is formatting quite a bit different than pre-commit and black . from my machine. Let me know if you have any ideas.

rileyschack commented 3 years ago

@WesRoach Haven’t had a chance to look too closely. Do you have any example of the formatting differences? My first guess is that the linting is failing since black uses line length of 88 and flake8 defaults to 79/80. I know we’ve configured our machines to have flake8 use 88, but I haven’t used GitHub Actions to know where those settings need to be defined.

WesRoach commented 3 years ago

@rileyschack It's in the Actions status page: https://github.com/WesRoach/pysoma/runs/1755137697?check_suite_focus=true

Basically Black appears to be formatting like the line size is <71?

stdout log ```bash /opt/hostedtoolcache/Python/3.9.1/x64/bin/pre-commit run --show-diff-on-failure --color=always --all-files black....................................................................Failed - hook id: black - files were modified by this hook reformatted /home/runner/work/pysoma/pysoma/pysoma/dataframe.py reformatted /home/runner/work/pysoma/pysoma/pysoma/tests/test_dataframe.py All done! ✨ 🍰 ✨ 2 files reformatted, 2 files left unchanged. All done! ✨ 🍰 ✨ 2 files left unchanged. pre-commit hook(s) made changes. If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`. To run `pre-commit` as part of git workflow, use `pre-commit install`. All changes made by hooks: diff --git a/pysoma/dataframe.py b/pysoma/dataframe.py index cf13677..ce6c81f 100644 --- a/pysoma/dataframe.py +++ b/pysoma/dataframe.py @@ -173,7 +173,10 @@ def stage_dataframe_to_disk( def decorator_to_disk(func): @functools.wraps(func) def wrapper_to_disk( - *args, cached_file_path=cached_file_path, overwrite=overwrite, **kwargs, + *args, + cached_file_path=cached_file_path, + overwrite=overwrite, + **kwargs, ): cached_file_path = Path(cached_file_path) spark = SparkSession.getActiveSession() @@ -190,7 +193,9 @@ def stage_dataframe_to_disk( def set_column_order( - df: F.DataFrame, column_order: list, remove_unlisted: bool = False, + df: F.DataFrame, + column_order: list, + remove_unlisted: bool = False, ): """ Set the column order for a DataFrame to a desired order. diff --git a/pysoma/tests/test_dataframe.py b/pysoma/tests/test_dataframe.py index ba6f033..afd687e 100644 --- a/pysoma/tests/test_dataframe.py +++ b/pysoma/tests/test_dataframe.py @@ -169,7 +169,10 @@ def test_string_to_column_name(): "Partial Hospitalization/Intensive Outpatient", "partial_hospitalization_intensive_outpatient", ), - ("HbA1c Level 7.0-9.0", "hba1c_level_7_0_9_0",), + ( + "HbA1c Level 7.0-9.0", + "hba1c_level_7_0_9_0", + ), ] expected = [x[1] for x in start_end_tuple] Error: The process '/opt/hostedtoolcache/Python/3.9.1/x64/bin/pre-commit' failed with exit code 1 ```
WesRoach commented 3 years ago

@rileyschack Looking at the version installed via Actions and it's Python 3.9, and black v20.x. Locally I'm on Python3.8 and black 19.x Haven't tested it yet but perhaps the latest version has a new formatting rule.

rileyschack commented 3 years ago

@WesRoach black v19.10b0 introduced a new feature that a trailing comma will automatically “explode” a single line to multiple lines.

https://github.com/psf/black/pull/826