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

--ignored seems not to work #84

Open
Masynchin opened this issue Mar 29, 2022 · 3 comments
Open

--ignored seems not to work #84

Masynchin opened this issue Mar 29, 2022 · 3 comments

Comments

@Masynchin
Copy link
Contributor

Problem

I want to patch code of ignored files (dependencies of my python project). But there is no difference with or without --ignored - Error: nothing found to replace. At the same time ripgrep correctly finds provided pattern.

To reproduce

Libs used:

  • python==3.10.2
  • ripgrep==13.0.0 (or rg)
  • ruplacer==0.6.4

It might be overcomplicated, but it is my real situation. Steps to reproduce:

mkdir reproduce
cd reproduce

git init
echo venv/ > .gitignore

python3 -m venv venv
source venv/bin/activate
pip install "Django==1.11.29"

# no any output since all files ignored by gitignore:
rg 'from collections import Iterable'
ruplacer 'from collections import Iterable' 'from collections.abc import Iterable'

# shows expected
rg 'from collections import Iterable' --no-ignore

# doesn't shows expected
ruplacer 'from collections import Iterable' 'from collections.abc import Iterable' --ignored
@dmerejkowsky
Copy link
Collaborator

Interesting. I guess if we use the ignore crate we better keep the same flags has ripgrep with the same behavior ...

There's a workaround for this specific case, though:

$ cd venv
$ ruplacer 'from collections import Iterable' 'from collections.abc import Iterable'

Also, (sorry, I have to ask) - are your really trying to use Django 1.11 with Python 3.10? Because in that case, the problem with abc is going to be the least of your problems ...

@Masynchin
Copy link
Contributor Author

Also, (sorry, I have to ask) - are you really trying to use Django 1.11 with Python 3.10?

Yes, this was my task from some course that requires to use Django of 1.11 version. I may used python of another version but create script that removes incompatible parts was easier. That is how I found this tool (there was also sd but it seems more complicated to use for editing files).

@Masynchin
Copy link
Contributor Author

There's a workaround for this specific case

In the reproduce steps I simplified gitignore creating process. Actualy there is default gitignore for python projects. So I should also do cd lib (which is also ignored) and then script can be executed.

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

No branches or pull requests

2 participants