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

KeywordBear: Add optional regex_keyword param #311

Closed
sils opened this issue Mar 31, 2016 · 19 comments
Closed

KeywordBear: Add optional regex_keyword param #311

sils opened this issue Mar 31, 2016 · 19 comments

Comments

@sils
Copy link
Member

sils commented Mar 31, 2016

No description provided.

@gitmate-bot
Copy link
Collaborator

Thanks for reporting this issue!

Your aid is required, fellow coalaian. Help us triage and solving this issue!

CC @sils1297, @AbdealiJK

@rubdos
Copy link

rubdos commented Mar 31, 2016

I merely suggested on some form of word detection, but regex variants are easily made too, I suppose. :) -> #312

@underyx
Copy link
Member

underyx commented Sep 2, 2016

It should then probably be renamed to MatchBear, BlacklistBear, or something.

@Makman2
Copy link
Member

Makman2 commented Sep 2, 2016

maybe we could add another parameter, keyword_type='regex' | 'plain' to change the matching behaviour^^

@Nosferatul
Copy link
Member

@rubdos are you still on it?

@Nosferatul
Copy link
Member

Unassigned because of inactivity

@Nosferatul
Copy link
Member

Check bears/general/KeywordBear.py . Add optional param to run method( optional means that the param should have a default value, something like regex_keyword = "Default")

@ghost
Copy link

ghost commented Dec 30, 2016

@Nosferatul @sils All we need to do is to add a setting called regex_keyword and check all words in a file which matches this regex... So basically we need to modify the run function of KeywordBear...Am I on the right track ?

@underyx
Copy link
Member

underyx commented Dec 30, 2016 via email

@ghost
Copy link

ghost commented Dec 30, 2016

@underyx we can have regex_keyword for finding certain keywords and each time a match happens we can prompt a user if he wants to change that word with something else or not and this prompting can be set to false by default... how does this sound ?

@underyx
Copy link
Member

underyx commented Dec 30, 2016 via email

@ghost
Copy link

ghost commented Dec 30, 2016

@underyx IMO the problem with using coala -a is even if we use regex to detect some wrongly written stuff, how will we know what should be the 'correct' phrase to replace the wrong phrase with ?

Consider that we want to replace 'somthng' with 'something', then user can give regex to find 'somthng' but replacing it with 'something' without asking the user seems weird and can cause problems right ?

@underyx
Copy link
Member

underyx commented Dec 30, 2016 via email

@ghost
Copy link

ghost commented Dec 30, 2016

@underyx so finally what we would like to do is to find keywords using the regex specified in regex_keyword and each time a match occurs replace it with whatever is specified in coafile. So basically there should be two settings specified in coafile regex_keyword and replace_keyword.
Is that it or do you want to add something more to this ?

@underyx
Copy link
Member

underyx commented Dec 30, 2016 via email

@ghost
Copy link

ghost commented Dec 30, 2016

@underyx so what's the point of just matching some keywords and not doing anything ?

@ghost
Copy link

ghost commented Dec 30, 2016

I would like to work on this... however IMO there should be one more issue for the functionality that we discussed here... 😄

@Makman2 Makman2 assigned ghost Dec 30, 2016
@underyx
Copy link
Member

underyx commented Dec 30, 2016 via email

@ghost
Copy link

ghost commented Jan 1, 2017

@underyx I have one more doubt... Do we still want to keep existing setting keywords because if we are introducing a setting regex_keyword it can already take care of matching the exact words (which is done currently using keywords). So my point is that a user can do the following :
regex_keyword = word1|word2|word3 and so on instead of keywords=word1, word2, word3
and moreover if a user supplies a more complex regex, that can be handled by regex_keyword.

gosom pushed a commit to gosom/coala-bears that referenced this issue Jul 15, 2017
Ensures that keywords within a file can be matched against
a user defined regex. A testcase is also added in KeywordBearTest.py
for this feature.

Closes coala#311
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants