plugins:Add plugin for saying no to 'sir'#651
plugins:Add plugin for saying no to 'sir'#651AkshJain99 wants to merge 1 commit intocoala:masterfrom
Conversation
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
Origin: SpaceConsistencyBear, Section: all.whitespace.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/plugins/no_sir.py
+++ b/tmp/tmpa6hrtctc/plugins/no_sir.py
@@ -14,5 +14,5 @@
msg.frm,
'@{}, Do not use sir in your conversation. {}'.format(
msg.frm.nick, emots[0]
- )
+ )
)```There was a problem hiding this comment.
Kindly use VSCode or any other editor to avoid such warnings.
plugins/no_sir.py
Outdated
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) | ||
| ) No newline at end of file |
There was a problem hiding this comment.
Line contains following spacing inconsistencies:
- No newline at EOF.
- Tabs used instead of spaces.
Origin: SpaceConsistencyBear, Section: all.whitespace.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/plugins/no_sir.py
+++ b/tmp/tmpa6hrtctc/plugins/no_sir.py
@@ -15,4 +15,4 @@
'@{}, Do not use sir in your conversation. {}'.format(
msg.frm.nick, emots[0]
)
- )+ )
tests/no_sir_test.py
Outdated
|
|
||
| def test_no_sir(self, testbot): | ||
| testbot.push_message('sir') | ||
| assert 'Do not use sir in your conversation' in testbot.pop_message() No newline at end of file |
There was a problem hiding this comment.
Line contains following spacing inconsistencies:
- No newline at EOF.
Origin: SpaceConsistencyBear, Section: all.whitespace.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/tests/no_sir_test.py
+++ b/tmp/tmpa6hrtctc/tests/no_sir_test.py
@@ -8,4 +8,4 @@
def test_no_sir(self, testbot):
testbot.push_message('sir')
- assert 'Do not use sir in your conversation' in testbot.pop_message()+ assert 'Do not use sir in your conversation' in testbot.pop_message()
plugins/no_sir.py
Outdated
| @@ -0,0 +1,18 @@ | |||
| import re | |||
|
|
|||
| from errbot import BotPlugin, re_botcmd | |||
There was a problem hiding this comment.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: all.python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/plugins/no_sir.py
+++ b/tmp/tmpa6hrtctc/plugins/no_sir.py
@@ -1,6 +1,7 @@
import re
-from errbot import BotPlugin, re_botcmd
+from errbot import BotPlugin
+from errbot import re_botcmd
class no_sir(BotPlugin):
tests/no_sir_test.py
Outdated
| @@ -0,0 +1,11 @@ | |||
| import os | |||
There was a problem hiding this comment.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: all.python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/tests/no_sir_test.py
+++ b/tmp/tmpa6hrtctc/tests/no_sir_test.py
@@ -1,4 +1,3 @@
-import os
import no_sir
from errbot.backends.test import testbot
plugins/no_sir.py
Outdated
|
|
||
|
|
||
| class no_sir(BotPlugin): | ||
| """ |
There was a problem hiding this comment.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/plugins/no_sir.py
+++ b/tmp/tmpa6hrtctc/plugins/no_sir.py
@@ -4,15 +4,16 @@
class no_sir(BotPlugin):
- """
- Do not use sir
- """
- def callback_message(self, msg):
- emots = [':D']
- if match_sir:
- self.send(
- msg.frm,
- '@{}, Do not use sir in your conversation. {}'.format(
- msg.frm.nick, emots[0]
- )
- )+ """
+ Do not use sir
+ """
+
+ def callback_message(self, msg):
+ emots = [':D']
+ if match_sir:
+ self.send(
+ msg.frm,
+ '@{}, Do not use sir in your conversation. {}'.format(
+ msg.frm.nick, emots[0]
+ )
+ )
plugins/no_sir.py
Outdated
|
|
||
|
|
||
| class no_sir(BotPlugin): | ||
| """ |
There was a problem hiding this comment.
E111 indentation is not a multiple of four
Origin: PycodestyleBear (E111), Section: all.autopep8.
plugins/no_sir.py
Outdated
| """ | ||
| Do not use sir | ||
| """ | ||
| def callback_message(self, msg): |
There was a problem hiding this comment.
E111 indentation is not a multiple of four
Origin: PycodestyleBear (E111), Section: all.autopep8.
plugins/no_sir.py
Outdated
| def callback_message(self, msg): | ||
| emots = [':D'] | ||
| if match_sir: | ||
| self.send( |
There was a problem hiding this comment.
E111 indentation is not a multiple of four
Origin: PycodestyleBear (E111), Section: all.autopep8.
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
E101 indentation contains mixed spaces and tabs
Origin: PycodestyleBear (E101), Section: all.autopep8.
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
W191 indentation contains tabs
Origin: PycodestyleBear (W191), Section: all.autopep8.
plugins/no_sir.py
Outdated
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) | ||
| ) No newline at end of file |
There was a problem hiding this comment.
W191 indentation contains tabs
Origin: PycodestyleBear (W191), Section: all.autopep8.
plugins/no_sir.py
Outdated
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) | ||
| ) No newline at end of file |
There was a problem hiding this comment.
W292 no newline at end of file
Origin: PycodestyleBear (W292), Section: all.autopep8.
tests/no_sir_test.py
Outdated
|
|
||
| def test_no_sir(self, testbot): | ||
| testbot.push_message('sir') | ||
| assert 'Do not use sir in your conversation' in testbot.pop_message() No newline at end of file |
There was a problem hiding this comment.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpa6hrtctc/tests/no_sir_test.py
+++ b/tmp/tmpa6hrtctc/tests/no_sir_test.py
@@ -8,4 +8,4 @@
def test_no_sir(self, testbot):
testbot.push_message('sir')
- assert 'Do not use sir in your conversation' in testbot.pop_message()+ assert 'Do not use sir in your conversation' in testbot.pop_message()
tests/no_sir_test.py
Outdated
|
|
||
| def test_no_sir(self, testbot): | ||
| testbot.push_message('sir') | ||
| assert 'Do not use sir in your conversation' in testbot.pop_message() No newline at end of file |
There was a problem hiding this comment.
W292 no newline at end of file
Origin: PycodestyleBear (W292), Section: all.autopep8.
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
Origin: SpaceConsistencyBear, Section: all.whitespace.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpbr1ao5rr/plugins/no_sir.py
+++ b/tmp/tmpbr1ao5rr/plugins/no_sir.py
@@ -14,5 +14,5 @@
msg.frm,
'@{}, Do not use sir in your conversation. {}'.format(
msg.frm.nick, emots[0]
- )
+ )
)
plugins/no_sir.py
Outdated
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Line contains following spacing inconsistencies:
- Tabs used instead of spaces.
Origin: SpaceConsistencyBear, Section: all.whitespace.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpbr1ao5rr/plugins/no_sir.py
+++ b/tmp/tmpbr1ao5rr/plugins/no_sir.py
@@ -15,4 +15,4 @@
'@{}, Do not use sir in your conversation. {}'.format(
msg.frm.nick, emots[0]
)
- )
+ )
plugins/no_sir.py
Outdated
| @@ -0,0 +1,18 @@ | |||
| import re | |||
|
|
|||
| from errbot import BotPlugin, re_botcmd | |||
There was a problem hiding this comment.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: all.python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpbr1ao5rr/plugins/no_sir.py
+++ b/tmp/tmpbr1ao5rr/plugins/no_sir.py
@@ -1,6 +1,7 @@
import re
-from errbot import BotPlugin, re_botcmd
+from errbot import BotPlugin
+from errbot import re_botcmd
class no_sir(BotPlugin):
tests/no_sir_test.py
Outdated
| @@ -0,0 +1,11 @@ | |||
| import os | |||
There was a problem hiding this comment.
This file contains unused source code.
Origin: PyUnusedCodeBear, Section: all.python.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpbr1ao5rr/tests/no_sir_test.py
+++ b/tmp/tmpbr1ao5rr/tests/no_sir_test.py
@@ -1,4 +1,3 @@
-import os
import no_sir
from errbot.backends.test import testbot
plugins/no_sir.py
Outdated
|
|
||
|
|
||
| class no_sir(BotPlugin): | ||
| """ |
There was a problem hiding this comment.
The code does not comply to PEP8.
Origin: PEP8Bear, Section: all.autopep8.
The issue can be fixed by applying the following patch:
--- a/tmp/tmpbr1ao5rr/plugins/no_sir.py
+++ b/tmp/tmpbr1ao5rr/plugins/no_sir.py
@@ -4,15 +4,16 @@
class no_sir(BotPlugin):
- """
- Do not use sir
- """
- def callback_message(self, msg):
- emots = [':D']
- if match_sir:
- self.send(
- msg.frm,
- '@{}, Do not use sir in your conversation. {}'.format(
- msg.frm.nick, emots[0]
- )
- )
+ """
+ Do not use sir
+ """
+
+ def callback_message(self, msg):
+ emots = [':D']
+ if match_sir:
+ self.send(
+ msg.frm,
+ '@{}, Do not use sir in your conversation. {}'.format(
+ msg.frm.nick, emots[0]
+ )
+ )
plugins/no_sir.py
Outdated
|
|
||
|
|
||
| class no_sir(BotPlugin): | ||
| """ |
There was a problem hiding this comment.
E111 indentation is not a multiple of four
Origin: PycodestyleBear (E111), Section: all.autopep8.
plugins/no_sir.py
Outdated
| """ | ||
| Do not use sir | ||
| """ | ||
| def callback_message(self, msg): |
There was a problem hiding this comment.
E111 indentation is not a multiple of four
Origin: PycodestyleBear (E111), Section: all.autopep8.
plugins/no_sir.py
Outdated
| def callback_message(self, msg): | ||
| emots = [':D'] | ||
| if match_sir: | ||
| self.send( |
There was a problem hiding this comment.
E111 indentation is not a multiple of four
Origin: PycodestyleBear (E111), Section: all.autopep8.
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
E101 indentation contains mixed spaces and tabs
Origin: PycodestyleBear (E101), Section: all.autopep8.
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
W191 indentation contains tabs
Origin: PycodestyleBear (W191), Section: all.autopep8.
plugins/no_sir.py
Outdated
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) | ||
| ) |
There was a problem hiding this comment.
W191 indentation contains tabs
Origin: PycodestyleBear (W191), Section: all.autopep8.
sladyn98
left a comment
There was a problem hiding this comment.
Kindly run coala before you submit the changes :)
plugins/no_sir.py
Outdated
| """ | ||
| def callback_message(self, msg): | ||
| emots = [':D'] | ||
| if match_sir: |
There was a problem hiding this comment.
@AkshJain99 What are you trying to do here? You instead should use a regex expression because the word sir could be present anywhere in the message.
plugins/no_sir.py
Outdated
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( | ||
| msg.frm.nick, emots[0] | ||
| ) |
There was a problem hiding this comment.
Kindly use VSCode or any other editor to avoid such warnings.
tests/no_sir_test.py
Outdated
| extra_plugin_dir = '.' | ||
|
|
||
| def test_no_sir(self, testbot): | ||
| testbot.push_message('sir') |
There was a problem hiding this comment.
Please read the above comment,this is just covering one of the scenarios.
|
|
||
| def test_no_sir(self, testbot): | ||
| testbot.push_message('sir') | ||
| assert 'Do not use sir in your conversation' in testbot.pop_message() |
There was a problem hiding this comment.
The assert statement does not match the bot output message, the test would always throw an assertion error because of the missing emot at the end
There was a problem hiding this comment.
@meetmangukiya Yeah your right,so it would pass, but it would be better to keep the outputs same although it doesnt matter :)
bbedddb to
735270b
Compare
we have added a plugin and related test to prevent any contributor from saying sir. Closes coala#337
| if match_sir: | ||
| self.send( | ||
| msg.frm, | ||
| '@{}, Do not use sir in your conversation. {}'.format( |
There was a problem hiding this comment.
Please remove comma after mentioning the user!
Although the returned message is OK, I guess it could be more informative.
What do you think @sladyn98?
There was a problem hiding this comment.
@KVGarg Definitely if you have any suggestions you could have written here :)
There was a problem hiding this comment.
I guess we can frame a message somewhat like this
Hi @<username> :wave:! We don't use "Sir" in the community during the
conversation. It's perfectly fine to call them via there usernames or handle.
Also, If you want to do such think you can better go with buddy or something else :smiley:
Something like this the message can be framed!
|
Okay ,sure I will do that in bit
…On Tue, 23 Apr 2019, 10:47 pm Keshav Garg, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Please re-base your branch!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#651 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHCL3B5FX3TOY5CRYOEGRMTPR5ADPANCNFSM4G432YBA>
.
|
|
@KVGarg sure I will look after ur suggestions , actually I m quite busy for
a day or two soon I will look towards this pr
Thanks
…On Tue, 23 Apr 2019, 11:06 pm Keshav Garg, ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In plugins/no_sir.py
<#651 (comment)>:
> +import re
+from errbot import BotPlugin
+
+
+class no_sir(BotPlugin):
+ """
+ Do not use sir
+ """
+
+ def callback_message(self, msg):
+ emots = [':D']
+ match_sir = re.search(r'\bsir\b', '\bSir\b', msg.body)
+ if match_sir:
+ self.send(
+ msg.frm,
+ '@{}, Do not use sir in your conversation. {}'.format(
I guess we can frame a message somewhat like this
Hi @<username> 👋! We don't use "Sir" in the community during the conversation. It's perfectly fine to call them via there usernames or handle. Also, If you to do such think you can better go with buddy 😃
Something like this the message can be framed!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#651 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHCL3B3LYBUB2IGAHLASYCLPR5CKDANCNFSM4G432YBA>
.
|
|
|
||
| def test_no_sir(self, testbot): | ||
| testbot.push_message('sir') | ||
| assert 'Do not use sir in your conversation' in testbot.pop_message() |
| from errbot import BotPlugin | ||
|
|
||
|
|
||
| class no_sir(BotPlugin): |
There was a problem hiding this comment.
class name not starting with caps 😱
There was a problem hiding this comment.
Thats by mistake @meetmangukiya i will correct all the issues now in this pr
Reviewers Checklist
botcmdandre_botcmddecorators.