Abstract Classes

LinesMetric

class ansiblemetrics.lines_metric.LinesMetric(script: str)

This is an abstract class the concrete classes measuring lines of code will extend.

__init__(script: str)

The class constructor.

Parameters

script (str) – A plain Ansible file

count()

Method to execute the metric.

Example

from ansiblemetrics.lines_metric import LinesMetric
LinesMetric().count()
property yml

The plain Ansible file

AnsibleMetric

class ansiblemetrics.ansible_metric.AnsibleMetric(script: str)
__init__(script: str)

The class constructor.

Parameters

script (str) – A plain Ansible file

Raises

TypeError – If the script is empty or an invalid YAML file

count()

Method to execute the metric.

Example

from ansiblemetrics.ansible_metric import AnsibleMetric
AnsibleMetric().count()
property playbook

The list of items plays and tasks in the playbook

property plays

The list of plays in the playbook

property tasks

The list of tasks in the playbook.