-
Notifications
You must be signed in to change notification settings - Fork 103
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
plugins:Add plugin for saying no to 'sir' #651
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kindly use VSCode or any other editor to avoid such warnings.
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.
I use VS code only
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
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.
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() |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
W191 indentation contains tabs
Origin: PycodestyleBear (W191), Section: all.autopep8
.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sladyn98 it's in
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KVGarg Definitely if you have any suggestions you could have written here :)
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.
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!
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.
Please re-base your branch!
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() |
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.
@sladyn98 it's in
from errbot import BotPlugin | ||
|
||
|
||
class no_sir(BotPlugin): |
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.
class name not starting with caps 😱
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.
Thats by mistake @meetmangukiya i will correct all the issues now in this pr
Reviewers Checklist
botcmd
andre_botcmd
decorators.