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

Infinite loop in generic.climb_directory_tree #101

Closed
Skrierz opened this issue Oct 17, 2019 · 9 comments · Fixed by #108
Closed

Infinite loop in generic.climb_directory_tree #101

Skrierz opened this issue Oct 17, 2019 · 9 comments · Fixed by #108
Assignees
Labels
bug Something isn't working released Feature/fix is released

Comments

@Skrierz
Copy link

Skrierz commented Oct 17, 2019

Expected Behavior

I expect 'nitpick' to complete in few minutes

Current Behavior

I get endless completion time.
I think it's happens because of behaviour of Path().root and Path().parent on windows

>>> Path('c:/')
WindowsPath('c:/')
>>> Path('c:/').root
'\\'
>>> Path('c:/').parent
WindowsPath('c:/')

Steps to Reproduce

  1. Run flake8
  2. Get endless execution

Your Environment

  • nitpick version used: 0.21.1

  • Python version: Python 3.7.4

  • Operating System and version: Windows 10

  • Run the following commands and paste the output:

    (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>where python
    C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\python.exe
    C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\python.exe
    
    (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>python -V
    Python 3.7.4
    
    (venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>pip freeze
    altgraph==0.16.1
    astor==0.8.0
    atomicwrites==1.3.0
    attrs==19.2.0
    bandit==1.6.2
    certifi==2019.9.11
    chardet==3.0.4
    Click==7.0
    colorama==0.3.9
    dictdiffer==0.8.0
    docutils==0.15.2
    entrypoints==0.3
    eradicate==1.0
    flake8==3.7.8
    flake8-annotations-complexity==0.0.2
    flake8-bandit==2.1.2
    flake8-broken-line==0.1.1
    flake8-bugbear==19.8.0
    flake8-builtins==1.4.1
    flake8-coding==1.3.2
    flake8-commas==2.0.0
    flake8-comprehensions==2.2.0
    flake8-debugger==3.1.1
    flake8-docstrings==1.5.0
    flake8-eradicate==0.2.2
    flake8-executable==2.0.3
    flake8-isort==2.7.0
    flake8-logging-format==0.6.0
    flake8-pep3101==1.2.1
    flake8-polyfill==1.0.2
    flake8-print==3.1.1
    flake8-quotes==2.1.0
    flake8-rst-docstrings==0.0.11
    flake8-string-format==0.2.3
    future==0.18.0
    gitdb2==2.0.6
    GitPython==3.0.3
    idna==2.8
    importlib-metadata==0.23
    isort==4.3.21
    jmespath==0.9.4
    mando==0.6.4
    marshmallow==3.2.1
    marshmallow-polyfield==5.7
    mccabe==0.6.1
    more-itertools==7.2.0
    nitpick==0.21.1
    packaging==19.2
    pbr==5.4.3
    pefile==2019.4.18
    pep8-naming==0.8.2
    pluggy==0.13.0
    py==1.8.0
    pycodestyle==2.5.0
    pydocstyle==4.0.1
    pyflakes==2.1.1
    Pygments==2.4.2
    PyInstaller==3.5
    pyparsing==2.4.2
    pytest==5.2.1
    python-slugify==3.0.6
    pywin32-ctypes==0.2.0
    PyYAML==5.1.2
    radon==2.4.0
    requests==2.22.0
    restructuredtext-lint==1.3.0
    ruamel.yaml==0.16.5
    ruamel.yaml.clib==0.2.0
    six==1.12.0
    smmap2==2.0.5
    snowballstemmer==2.0.0
    sortedcontainers==2.1.0
    stevedore==1.31.0
    testfixtures==6.10.0
    text-unidecode==1.3
    toml==0.10.0
    typing-extensions==3.7.4
    urllib3==1.25.6
    wcwidth==0.1.7
    wemake-python-styleguide==0.12.5
    zipp==0.6.0
@Skrierz Skrierz added the bug Something isn't working label Oct 17, 2019
@andreoliwa
Copy link
Owner

Hi @Skrierz, thanks for the bug report.

I didn't test Nitpick on Windows yet.

I'm not 100% satisfied with the way Nitpick searches for the project files.
I will try some code changes to fix this bug, then I will ask you to check if it's working, ok?

@Skrierz
Copy link
Author

Skrierz commented Oct 17, 2019

Ok, thanks
I'll wait

@andreoliwa
Copy link
Owner

Hi @Skrierz.

I slightly modified the code.
Could you try testing the branch windows-infinite-loop on Windows?
https://github.com/andreoliwa/nitpick/tree/windows-infinite-loop

I tried setting up a Windows build on Travis, but I couldn't.
I believe that some other package might be the freezing the execution on Windows: text_unidecode.

Let me know what happens, please collect any debug info you have.
Thanks in advance!

@Skrierz
Copy link
Author

Skrierz commented Oct 28, 2019

Hi @andreoliwa

It's not working.
I think it's because of this:

>>> WindowsPath('c:') == WindowsPath('C:')
True
>>> str(WindowsPath('c:')) == str(WindowsPath('C:'))
False
>>> str(WindowsPath('c:'))
'c:'
>>> str(WindowsPath('C:'))
'C:'

And i think i found solution.
You can try to use previous implementation and Path().anchor instead of Path().root

>>> WindowsPath('c:').anchor == str(WindowsPath('c:'))
True
>>> WindowsPath('C:').anchor == str(WindowsPath('C:'))
True
>>> win_path = WindowsPath('D:\PyCharm Community Edition 2019.2.2')
>>> win_path.anchor == str(win_path.parent)
True
>>> unix_path = PurePosixPath('/etc')
>>> unix_path
PurePosixPath('/etc')
>>> unix_path.anchor == str(unix_path.parent)
True

@Skrierz
Copy link
Author

Skrierz commented Oct 28, 2019

If you want, i can try to PR this issue.

@andreoliwa
Copy link
Owner

Hi @Skrierz, could you try the same branch again?
I used your fix in the code, I hope it works now.

If you want, i can try to PR this issue.

Thanks, this PR was almost done. 😉

If you find some other bug in Windows, I'd appreciate the help.
I don't know it the current development tooling (make, pre-commit) works 100% on Windows, and which are the steps/fixes to make them work.

@Skrierz
Copy link
Author

Skrierz commented Oct 31, 2019

Hi @andreoliwa.

I've tested new fix and it works.
But i've found new issue. It's related to download default style file (nitpick-style.toml) on Windows.
Should i create new issue or write it here?

@andreoliwa
Copy link
Owner

Hi @Skrierz, please create a new issue.
So I can already merge and release this fix.
Thank you again.

@andreoliwa
Copy link
Owner

🎉 This issue has been resolved in version 0.21.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@andreoliwa andreoliwa added the released Feature/fix is released label Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Feature/fix is released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants