File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/yamllint.cpython-310.pyc
o
�N�gl � @ sz d dl Z d dlZzd dlZd dlmZ d dlmZ dZW n ey' dZY nw e � e
�Zdd� Zdd � Z
dd
d�ZdS )
� N)�linter)�YamlLintConfigTFc C s t S )zY
report if yamllint could be imported safly. allowing for clean import detection
)�HAS_YAMLLINT� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/yamllint.py�has_yamllint s r c C s t jS )zE
report version of yamllint installed for version comparison
)�yamllint�__version__r r r r �version s r
c C sn |dur
t |d�}nd}t |�}tjj�| �}g }t�||�D ]}|�|j|j |j
|jd�� q||d�}|S )z�
lint yaml and return result.
source (required)
yaml as str
yamlconf (optional)
yamllint config file to use, if not set will default to a salty version of realaxed.
N)�filea
extends: relaxed
rules:
line-length: { max: 256, level: warning }
empty-lines: disable
empty-values: {forbid-in-block-mappings: false, forbid-in-flow-mappings: true}
trailing-spaces: disable
key-ordering: disable
)�line�column�levelZcomment)�source�problems)r �salt�utilsZstringutilsZto_strr �run�appendr r
r �message)r ZyamlconfZconfZyaml_outr Zproblem�outputr r r �lint s ��
r )N)�loggingZsalt.utils.stringutilsr r r Zyamllint.configr r �ImportError� getLogger�__name__�logr r
r r r r r �<module> s �
�