Skip to content

Detection

The most basic use-case of Nomage is to detect the naming convention used for an identifier.

The main entrypoint is a function called naming(), that takes for argument an identifier and return an object Identifier or None.

Python

You can detect which naming convention is used with:

>>> from nomage import naming
>>> id_naming = naming("my-identifier")
>>> id_naming.convention.names
('kebab-case', 'dash-case', 'lisp-case', 'spinal-case')

If no convention is detected, ValueError is raised.

>>> from nomage import naming
>>> naming("my-_-identifier")
nomage.exceptions.UnrecognizedNamingConventionError: no matching naming convention, invalid identifier 'my-_-identifier'

CLI

Check it from a terminal:

nomage my-identifierDetected: kebab-case / dash-case / lisp-case / spinal-case

nomage my-identifier

Unrecognized identifier will fail with a return code not equal to 0.

nomage my-_-identifierNo matching naming convention, invalid identifier 'my-_-identifier'

nomage my-_-identifier