-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Resolve #8 -- Add RegEx based filePattern attribute in favor of filename #11
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11 +/- ##
=========================================
- Coverage 95.87% 93.57% -2.3%
=========================================
Files 1 1
Lines 97 109 +12
=========================================
+ Hits 93 102 +9
- Misses 4 7 +3
Continue to review full report at Codecov.
|
@anapaulagomes I'd also like your feedback here. The issue came up, because glob doesn't allow exclusion. I believe it to be better to just ditch glob and use regex everywhere. After all this is a regex linter. I believe users will be able to cope. |
Sure, makes sense. I'm on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature! I've tested in a big repo (😇) but I'm not sure if I got the examples right. After this first round and clarification about the pattern, I'll test it again.
README.rst
Outdated
- "**/test_*.py" | ||
- "conftest.py" | ||
- "**/conftest.py" | ||
filePattern: "(test_.*|conftest)\.py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filePattern: "(test_.*|conftest)\.py" | |
filePattern: "(test_.*|conftest)\\.py" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, in JSON backslashes need to be escaped. In YAML however they don't:
>>> import re, yaml
>>> re.compile(yaml.load('1: \\.')[1]).search('test.png')
<re.Match object; span=(4, 5), match='.'>
>>> re.compile(yaml.load('1: \.')[1]).search('test.png')
<re.Match object; span=(4, 5), match='.'>
To be honest I wasn't aware of that myself, after reading more into it, I see that we could write plain old RegEx into the YAML config. I wonder if we should change all example to reflect that. I know that the quoting makes the examples even harder for some to understand. What do you think @anapaulagomes
8722927
to
1585e9e
Compare
@anapaulagomes I rewrote all patterns to use either none or single quotes where needed. As a result we no longer need to JSON escape characters. I personally think it's a lot more readable. Check out the new README, what do you think? BTW, thanks for the review, much appreciated 🥇 |
I'll take a look soon, @codingjoe! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🏅 nice!
Please note that model_mommy
was deprecated in favor of model_bakery
. There is a script to help on the migration from mommy to baker in the new repo.
Released in 1.2.0 🎉
@anapaulagomes cool! I head from @amureki that the two of you have been working on a new stable release, nice 🥇 Would you mind updating the example in the |
No description provided.