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.

BUG False positive removal on windows due to IOError

See original GitHub issue

First of all thanks for yet another great tool 😄 Today I was adding pre-commit (one hook at a time) to an existing codebase and when I added yesqa, it started having a nasty fight with the flaek8 hook. When I ran pre-commit run --all on linux (WSL) there was no problem, so I did some digging.

When I started printing the responses from flake8, I found that all false positive removals returned 0 E902, which corresponds to an IOError.

I added:

        print(filename)
        print(line)

to: https://github.com/asottile/yesqa/blob/7a009f3ee493c796827ee334f9058b110a0e0db8/yesqa.py#L25-L30

My guess is that this is due to NamedTemporaryFile only being partially supported by windows. https://github.com/asottile/yesqa/blob/7a009f3ee493c796827ee334f9058b110a0e0db8/yesqa.py#L121-L128

My local quick and dirty hotfix for now is adding another check, like the one you use: https://github.com/asottile/yesqa/blob/7a009f3ee493c796827ee334f9058b110a0e0db8/yesqa.py#L130-L132

    if any('E902' in v for v in flake8_results.values()):
        print(f'{filename}: IO error (skipping)')
        return 0

P.S.: Not sure where E999 comes from, but judging by the error message this might be a typo/the error code changed and you might have meant to write E901

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Sep 2, 2020

sounds good, send a patch!

you’ll probably also want to set up CI for windows, you can probably do something similar to what is done for pyupgrade: https://github.com/asottile/pyupgrade/blob/f766c29ec4bb6cf2674b81959871e59d5400380a/azure-pipelines.yml#L17-L20

1reaction
asottilecommented, Aug 31, 2020

also you’d use try: finally: no need to catch an exception if you were going to approach it that way!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microsoft confirms Behavior:Win32/Hive.ZY false error bug in ...
We've received confirmation from Microsoft that this activity is a false positive issue, but it's another problem for companies like Google and ...
Read more >
VS2019 intellisense false positive error
We have a lot of times CS0234 and CS0246 false positive error. The reference is define, no Build Error, the code run perfectly....
Read more >
False-positive error when using `Callable` in a PEP 604 type ...
Bug Report The following snippet works fine at runtime on 3.10+. It should be accepted as a valid type alias definition on Python...
Read more >
Understanding and Detecting Disordered Error Handling with ...
To remove such false positives, we aim to eliminate infeasible paths. An intuitive strategy is to employ traditional symbolic execution, which is not...
Read more >
Windows 10 Crashing — BSOD, Bug Check - TechNet
A false negative is a test pass when there is malfunctioning RAM. ... Disk 2 (PDO name: \Device\00000045) failed due to a hardware...
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