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

Linting Failing #1

Closed
WesRoach opened this issue Jan 23, 2021 · 4 comments
Closed

Linting Failing #1

WesRoach opened this issue Jan 23, 2021 · 4 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@WesRoach
Copy link
Member

@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
Copy link
Collaborator

@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
Copy link
Member Author

@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
/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
Copy link
Member Author

@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
Copy link
Collaborator

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

psf/black#826

@rileyschack rileyschack added bug Something isn't working question Further information is requested labels Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants