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

Black puts standalone comments inside short exploded expressions *after* the expression #62

Closed
RonnyPfannschmidt opened this issue Mar 22, 2018 · 2 comments
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. T: bug Something isn't working

Comments

@RonnyPfannschmidt
Copy link

gotten:

         cwd=str(cwd),
-        env=_always_strings(dict(
-            os.environ,
-            # try to disable i18n
-            LC_ALL='C',
-            LANGUAGE='',
-            HGPLAIN='1',
-        ))
+        env=_always_strings(dict(os.environ, LC_ALL='C', LANGUAGE='', HGPLAIN='1')),
+        # try to disable i18n
     )
@ambv
Copy link
Collaborator

ambv commented Mar 22, 2018

This is by design. Black changed 7 lines into 2 lines. Your code will be clearer if you put the standalone comment in front of the line.

I'll leave that open because currently we're putting the standalone comment after the line it's commenting which is contrary to the expectation. But the fix will be to put this comment in front of the reformatted line.

@ambv ambv changed the title code with correctly placed comments gets turned into code with very missplaced comments Black puts standalone comments inside short exploded expressions *after* the expression Mar 22, 2018
@ambv ambv added T: bug Something isn't working F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. labels Mar 22, 2018
@carljm
Copy link
Collaborator

carljm commented Mar 23, 2018

This is a duplicate of #22.

@carljm carljm closed this as completed Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants