question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conflicts with black

See original GitHub issue

Hi! Thanks for this useful tool!

When I save out new snapshots, they aren’t in the format recognized by Black, which involves running the formatter a second time. This is a little fiddly, and I don’t really care about having the format just so, so I would prefer to automatically ignore these files.

Some possible solutions:

  1. Add
    # fmt: off
    
    to the block at the top of the snapshot file. I’ve tested this, it works, and it’s easy.
  2. Let people decide whether they want this header. I’d turn it on by default – since it’s a good default – and let people turn it off if they really want their files formatted by Black.
  3. If Black is available, before writing the file, attempt to run the output through Black. Let users disable this behavior in config. I like this option best because it’s a very nice developer experience (even though it would be a little inconvenient for my use case, which sadly is a lib that has Python 2 deps, so I can’t run tests and Black in the same env).
  4. Try to modify the output to cohere to Black’s demands. I expect this is impractical.

With some guidance about which way to go, I’d be happy to contribute this.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
martijnthecommented, Sep 19, 2019

How about adding a formatter hook to snapshottest and let people choose whatever formatter they like?

2reactions
skovhuscommented, Mar 10, 2021

Ideally, auto-generated files shouldn’t be formatted, so adding a # fmt: off line seems like a very simple solution to this problem compared to adding a formatting hook.

@syrusakbary would you accept a PR adding a # fmt: off line?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Black-White Conflict Isn't Society's Largest
Blacks, in particular, consistently see more social conflict than do other demographic groups. But not even blacks believe that racial conflict ...
Read more >
Black Korean Relations in an American City - JSTOR
Black consumers, and looting and burning of targeted Korean businesses during the 1992 Los Angeles uprisings. and economic differences between these two groups ......
Read more >
Conflict Resolution in the African American
Based on a literature review, this study examines variables that contribute to interpersonal conflicts in the African- American adolescent population.
Read more >
Why the trope of Black-Asian conflict in the face of anti-Asian ...
A recent survey shows that more than three out of four Asian Americans worry about experiencing hate crimes, harassment, and discrimination ...
Read more >
Conflict in Black male/female relationships
Conflict in Black male/female relationships. Debra Colleen Taylor. Marilyn Renee McClain. Follow this and additional works at: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found