Skip to content

command-id-convention: trailing colon in multi-colon command IDs bypasses empty name check #159

Open

Description

@Yash990-bit

Description

In the command-id-convention rule (src/rules/command-id-convention.ts), checking for an empty name segment uses separator === commandId.length - 1, where separator = commandId.indexOf(':').

Because indexOf(':') matches the first colon, this check only detects an empty name if the command ID contains exactly one colon (e.g. 'my-extension:'). Multi-colon command IDs with sub-namespaces (such as 'my-extension:sub:' or 'notebook:run-cell:') bypass the emptySegment check completely and silently pass without reporting an error.

Reproduce

  1. Enable the jupyter/command-id-convention rule.
  2. Lint code containing a command ID with multiple colons ending in a trailing colon:
    app.commands.addCommand('my-extension:sub:', {
      execute: () => {}
    });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions