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

Format _apply_type_annotations.py in margin-oriented style #600

Closed
wants to merge 1 commit into from

Conversation

stroxler
Copy link
Contributor

In python code - and especially typed python code - I find it much easier to skim function headers if we always follow the style of

def f(
    x: SomeType
) -> ReturnType:
    ...

With this format I find it far easier to skim code because all the arg names are along the margin and the return types are in a predictable column. I don't usually change other folks' code to this style, but in the case of this module I'm the primary maintainer so I think it makes sense to go with what I find easier to maintain :)

(Someday I'm going to write a LibCST codemod that enforces this style!)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 13, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2022

Codecov Report

Merging #600 (faf4b1d) into main (5f22b6c) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #600   +/-   ##
=======================================
  Coverage   94.72%   94.72%           
=======================================
  Files         244      244           
  Lines       24916    24916           
=======================================
  Hits        23602    23602           
  Misses       1314     1314           
Impacted Files Coverage Δ
libcst/codemod/visitors/_apply_type_annotations.py 94.17% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f22b6c...faf4b1d. Read the comment docs.

@stroxler
Copy link
Contributor Author

Closing this because it's going to clash with #596

I'm going to write a codemod that can do this automatically, and then run it on top of those changes after they merge :)

@stroxler stroxler closed this Jan 14, 2022
@stroxler stroxler deleted the format-atav branch January 14, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants