Skip to content

fix: print NIP101 instead of traceback on nitpick init in empty dir - #796

Open
DSeaStar wants to merge 2 commits into
andreoliwa:masterfrom
DSeaStar:fix/init-empty-dir-traceback
Open

fix: print NIP101 instead of traceback on nitpick init in empty dir#796
DSeaStar wants to merge 2 commits into
andreoliwa:masterfrom
DSeaStar:fix/init-empty-dir-traceback

Conversation

@DSeaStar

Copy link
Copy Markdown

Summary

Test plan

  • pytest tests/test_project.py tests/test_cli.py (45 passed)
  • Extended test_no_root_dir_no_python_file and test_no_root_dir_with_python_file to cover nitpick init --suggest
  • nitpick init --suggest in an empty directory prints NIP101 (no traceback) and exits 2
  • nitpick init --suggest in a normal project still works as before

The init command did not catch QuitComplainingError, so --suggest in a
directory without a project root dumped an AttributeError traceback.
Handle it like check/fix/ls and add a regression test.
tomlkit 0.15.1 prefixes every comment() line with "#", so pre-joining with "# " produced "# # ..." in config. Prefer exact keys like .editorconfig over dotted-path lookup during equality.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"AttributeError: 'Project' object has no attribute '_confirmed_root'" when running nitpick init in an empty directory

1 participant