Red-discordbot: [Downloader/Core] Enforce naming conventions for packages, cogs and commands

Created on 20 Nov 2020  路  4Comments  路  Source: Cog-Creators/Red-DiscordBot

Feature request

To guarantee a smooth user experience and get a consistent behaviour when using Red, all naming conventions from the Cog Creator Guidelines should be enforced.

That means that

  • Cog classes should be TitleCased, using alphabetic characters only.
  • Commands should be lower case, using alphanumeric characters only.
  • Cog modules should be lower case, using alphabetic characters only.

There was previous discussion to this issue here. It was brought up after a conversation with a red user here and here.

The current proposal is to enforce compliance with these guidelines within Red itself.
The option to enforce these guidelines only on approved CCs via QA was discussed but dropped in favor of a unified experience in the long run.

This will break the automatic updating of cogs when running [p]cog update. Users using affected cogs would need to remove and re-add them once they follow the naming conventions.

Select the type of feature you are requesting:

  • [ ] Cog
  • [ ] Command
  • [x] API functionality

Update: I forgot to add links to the conversations

Breaking Change Needs Discussion Feature

Most helpful comment

I am going to sound off here that I am not in favor of enforcing these within Red itself. It restricts cog creator freedom too much. If a cog creator chooses to go against convention on their own users may request from the author themselves to change to make things an easier experience for them. However, it's entirely on the author of the cogs to support user experience and not something Red should deal with. Red deals with Red, cog creators deal with their own cogs and the user experience on them.

All 4 comments

+1 from me on enforcing it at a framework level which will ensure a unified experience.

That said this issue is lacking some additional info.

The discussion summarized on @Twentysix26 and I, agreeing that Enforcing the following on a framework level will be the best experience long term.

Package names can only be loaded if they are lowercase.
Cogs can only be loaded if they are CamelCase.
Commands can only be added if they are lowercase.

Adding these 3 restriction to the framewor will ensure a uniform user experience where all commands, cogs and packages behave in the same manner.

The downsides is reducing the potential namescape for commands, cogs and packages, but given that any variation here will make it for a very confusing user experience, the downside doesn't outweight the positives on this enforcement.

EDIT:

  • I noticed that Dav mention alphanumeric, which is not something i think its a entire requirement here, after all as @Rapptz mentioned I don't think we should enforce latin characters only here.

I have no stake in this but I am strictly opposed at the Anglocentricism in requiring identifiers and names to be in English. Python and the library both allow other language identifiers for users of languages other than English, including those in the CJK space.

I am going to sound off here that I am not in favor of enforcing these within Red itself. It restricts cog creator freedom too much. If a cog creator chooses to go against convention on their own users may request from the author themselves to change to make things an easier experience for them. However, it's entirely on the author of the cogs to support user experience and not something Red should deal with. Red deals with Red, cog creators deal with their own cogs and the user experience on them.

To guarantee a smooth user experience and get a consistent behaviour when using Red, all naming conventions from the Cog Creator Guidelines should be enforced.
...
The current proposal is to enforce compliance with these guidelines within Red itself.

I would just like to chime in here, Guidelines For Cog Creators was never a strictly enforced document, it was just meant as a starting point for CCs to write good code for their review.

What will be enforced is the new Cog Creator Policy (and the docs entry I am going to PR probably later this weekend), however that does not have any mention of the casing of cogs or commands.

I am not for enforcing this via QA, as QA's job for CC apps is being focused around ensuring that code is safe and functional, not that it follows convention or has good UX.

As for enforcing this in downloader/core, I don't think it is worth the breaking change and explaining to users/CCs why this is happening just for some better UX the CC could decided to do in the first place.

Was this page helpful?
0 / 5 - 0 ratings