coala / corobo

A bot to help newcomers onboard OS projects! It's awesome!
MIT License
66 stars 103 forks source link

spam plugin should implement check_configuration #600

Open jayvdb opened 6 years ago

jayvdb commented 6 years ago

MAX_LINES = 1 is invalid, as it will mean anyone writing one line is spamming, which is silly.

MAX_MSG_LEN <= length of BOT_PREFIX is invalid, as means invoking a command is spamming, which is silly.

bistaastha commented 6 years ago

@jayvdb Can I be assigned this issue?

jayvdb commented 6 years ago

Sure. i've sent you an invite to join @coala.

bistaastha commented 6 years ago

@jayvdb I am a college fresher right now and I am just getting familiar with python and git. I understand some of the issue but not all of it. Could you please explain it in more detail?

jayvdb commented 6 years ago

Ping @nvzard for help , here or on gitter room for coboro

jayvdb commented 6 years ago

Guide at http://errbot.io/en/latest/user_guide/plugin_development/configuration.html

The existing config (https://github.com/coala/corobo/blob/master/plugins/spam.py#L13)

is

    CONFIG_TEMPLATE = {
        'MAX_MSG_LEN': constants.MAX_MSG_LEN,
        'MAX_LINES': constants.MAX_LINES
    }

And those constants are at https://github.com/coala/corobo/blob/master/plugins/constants.py

so effectively the config default is

    CONFIG_TEMPLATE = {
        'MAX_MSG_LEN': 1000,
        'MAX_LINES': 20,
    }

The first config validation we need is to ensure that the user never sets MAX_LINES to 1 or 0 , as that causes the bot to go into meltdown.

Just try to validate that one to begin with. Then you can try validating MAX_MSG_LEN.

bistaastha commented 6 years ago

@jayvdb I am not sure where exactly am I supposed to write the validation.

jayvdb commented 6 years ago

You add it to spam.py's check_configuration.

First you need to install and run corobo. If you cant do that, you may want to find another issue to work on.

bistaastha commented 6 years ago

Errbot isn't being detected on my system. And running corobo by the docker image shows something like this: https://pastebin.com/kLDFqJn3

nvzard commented 6 years ago

@CodeSparkle To setup corobo, just create a virtualenv and install all the deps in requirements.txt and test-requirements.txt. Then you'll be good to go.

bistaastha commented 6 years ago

While installing the dependencies, I encountered this error. screenshot from 2018-09-03 08-09-41 I haven't been able to find my way around it.