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

Insert parenthesis to get better formatting #2687

Closed
vmgustavo opened this issue Dec 13, 2021 · 1 comment
Closed

Insert parenthesis to get better formatting #2687

vmgustavo opened this issue Dec 13, 2021 · 1 comment
Labels
T: style What do we want Blackened code to look like?

Comments

@vmgustavo
Copy link

While handling fluent interfaces if the instruction is within parenthesis Black formats it this way:

  • Original
(spark.read.parquet(path).select(columns).filter('column is not null').filter((f.size('id_list') > 1) & (f.col('operating_system') != 'iOS')))
  • Formatted
(
    spark.read.parquet(path)
    .select(columns)
    .filter("column is not null")
    .filter((f.size("id_list") > 1) & (f.col("operating_system") != "iOS"))
)

However if the instruction is not within parenthesis it formats it differently:

  • Original
spark.read.parquet(path).select(columns).filter('column is not null').filter((f.size('id_list') > 1) & (f.col('operating_system') != 'iOS'))
  • Formatted
spark.read.parquet(path).select(columns).filter("column is not null").filter(
    (f.size("id_list") > 1) & (f.col("operating_system") != "iOS")
)

I believe it would be beneficial to force the use of parenthesis to use the better formatting style instead of the other

@vmgustavo vmgustavo added the T: style What do we want Blackened code to look like? label Dec 13, 2021
@felix-hilden
Copy link
Collaborator

Thanks for submitting! This is tracked in #571, so let's continue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants