Linter

class yangify.linter.ContainerLinter

Placeholder for functions to lint classes processing YANG containers

static lint(cls: Union[Type[yangify.parser.Parser], Type[yangify.translator.Translator]], dm: yangson.datamodel.DataModel, recursive: bool, ignore: Optional[Set[str]]) → yangify.linter.ContainerLinterResult

Lint supported objects

class yangify.linter.ContainerLinterResult(name: str, path: str, filepath: str, lineno: int, messages: yangify.linter.Messages = <factory>, children: Dict[str, LinterResult] = <factory>, type: str = 'container', class_name: str = '', implements: List[str] = <factory>, metadata: Dict[str, Any] = <factory>)

Result of linting a class processing a YANG container

class_name = ''
serialize() → Dict[str, Any]

Representation of the object using native types

to_ascii_tree(prefix: str, is_last: bool = False) → str

ASCII tree representation of the object linted

type = 'container'
class yangify.linter.FileLinter

Placeholder for functions to lint files with python code

static lint(path: pathlib.Path, dm: yangson.datamodel.DataModel, recursive: bool, ignore: Optional[Set[str]]) → yangify.linter.FileLinterResult

Lint supported objects

class yangify.linter.FileLinterResult(name: str, path: str, filepath: str, lineno: int, messages: yangify.linter.Messages = <factory>, children: Dict[str, LinterResult] = <factory>, type: str = 'file')

Result of linting a file with python code

type = 'file'
class yangify.linter.FolderLinter

Placeholder for functions to lint folders with python code

static lint(path: pathlib.Path, dm: yangson.datamodel.DataModel, recursive: bool, ignore: Optional[Set[str]]) → yangify.linter.FolderLinterResult

Lint supported objects

class yangify.linter.FolderLinterResult(name: str, path: str, filepath: str, lineno: int, messages: yangify.linter.Messages = <factory>, children: Dict[str, LinterResult] = <factory>, type: str = 'folder')

Result of linting a folder with python code

type = 'folder'
class yangify.linter.Linter

Placeholder for functions to lint supported objects

static lint(obj: Union[Type[yangify.parser.Parser], Type[yangify.parser.RootParser], Type[yangify.translator.Translator], Type[yangify.translator.RootTranslator], module, str], dm: yangson.datamodel.DataModel, recursive: bool = False, ignore: Optional[Set[str]] = None) → yangify.linter.LinterResult

Lint supported objects

exception yangify.linter.LinterException(message: yangify.linter.Message)
class yangify.linter.LinterResult(name: str, path: str, filepath: str, lineno: int, messages: yangify.linter.Messages = <factory>, children: Dict[str, LinterResult] = <factory>, type: str = 'unknown')

Parent class for results of linting object.

name

name of the object linted

path

YANG path of the object

filepath

path fo the file where the object resides

lineno

line number where the object resides

messages

Messages generated while liniting the object

children

Result of linting descending objects

type

Type of the object linted (module, file, folder, container…)

serialize() → Dict[str, Any]

Representation of the object using native types

to_ascii_tree(prefix: str, is_last: bool = False) → str

ASCII tree representation of the object linted

to_text() → str

A text representation of the object

type = 'unknown'
class yangify.linter.Message(message: str, message_type: str)

A message, usually indicating some error or warning.

message

Text of the message

message_type

Code identifying the type of message, i.e., E101 or W101

serialize() → Dict[str, str]

Representation of the object using native types

to_text() → str

A text representation of the object

class yangify.linter.MessageType
ATTRIBUTE_EXTRA = 'W101'
CHILDREN_MISSING = 'W001'
PATH_EMPTY = 'E001'
SCHEMA_INVALID = 'E102'
SCHEMA_NOT_FOUND = 'E101'
static help() → Dict[str, Tuple[str, str]]
class yangify.linter.Messages(ignore: Optional[Set[str]] = None)

A list of Message objects

ignore

Populated with a list of message codes (see MessageType) it will cause the functions append and extend to ignore messages of message_type included in this list.

append(object) → None -- append object to end
extend(iterable) → None -- extend list by appending elements from the iterable
serialize() → List[Any]

Representation of the object using native types

class yangify.linter.ModuleLinter

Placeholder for functions to lint python modules

static lint(cls: module, dm: yangson.datamodel.DataModel, recursive: bool, ignore: Optional[Set[str]]) → yangify.linter.ModuleLinterResult

Lint supported objects

class yangify.linter.ModuleLinterResult(name: str, path: str, filepath: str, lineno: int, messages: yangify.linter.Messages = <factory>, children: Dict[str, LinterResult] = <factory>, type: str = 'module')

Result of linting a python module

type = 'module'
class yangify.linter.RootLinter

Placeholder for functions to lint yangify.parser.RootParser and yangify.translator.RootTranslator objects

static lint(cls: Union[Type[yangify.parser.RootParser], Type[yangify.translator.RootTranslator]], dm: yangson.datamodel.DataModel, recursive: bool, ignore: Optional[Set[str]]) → yangify.linter.RootLinterResult

Lint supported objects

class yangify.linter.RootLinterResult(name:str, path:str, filepath:str, lineno:int, messages:yangify.linter.Messages=<factory>, children:Dict[str, _ForwardRef('LinterResult')]=<factory>, type:str='root')
to_ascii_tree(prefix: str, is_last: bool = False) → str

ASCII tree representation of the object linted

type = 'root'