Skip to content

Commit

Permalink
Add yamllint (in pre-commit and CI) (#33676)
Browse files Browse the repository at this point in the history
* Add yamllint (in pre-commit and CI)

* Fix linting for all YAML files

* Bump and add it to requirements

* Fix gen_requirements for pre-commit, remove 'v' from version
  • Loading branch information
frenck committed Apr 5, 2020
1 parent 7653dc9 commit 24840b5
Show file tree
Hide file tree
Showing 73 changed files with 621 additions and 507 deletions.
2 changes: 1 addition & 1 deletion .github/lock.yml
Expand Up @@ -24,4 +24,4 @@ only: pulls

# Optionally, specify configuration settings just for `issues` or `pulls`
issues:
daysUntilLock: 30
daysUntilLock: 30
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Expand Up @@ -46,6 +46,10 @@ repos:
- --branch=dev
- --branch=master
- --branch=rc
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.21.0
hooks:
- id: yamllint
- repo: local
hooks:
# Run mypy through our wrapper script in order to get the possible
Expand Down
61 changes: 61 additions & 0 deletions .yamllint
@@ -0,0 +1,61 @@
ignore: |
azure-*.yml
rules:
braces:
level: error
min-spaces-inside: 0
max-spaces-inside: 1
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
brackets:
level: error
min-spaces-inside: 0
max-spaces-inside: 0
min-spaces-inside-empty: -1
max-spaces-inside-empty: -1
colons:
level: error
max-spaces-before: 0
max-spaces-after: 1
commas:
level: error
max-spaces-before: 0
min-spaces-after: 1
max-spaces-after: 1
comments:
level: error
require-starting-space: true
min-spaces-from-content: 2
comments-indentation:
level: error
document-end:
level: error
present: false
document-start:
level: error
present: false
empty-lines:
level: error
max: 1
max-start: 0
max-end: 1
hyphens:
level: error
max-spaces-after: 1
indentation:
level: error
spaces: 2
indent-sequences: true
check-multi-line-strings: false
key-duplicates:
level: error
line-length: disable
new-line-at-end-of-file:
level: error
new-lines:
level: error
type: unix
trailing-spaces:
level: error
truthy:
level: error
4 changes: 4 additions & 0 deletions azure-pipelines-ci.yml
Expand Up @@ -64,6 +64,10 @@ stages:
. venv/bin/activate
pre-commit run check-json --all-files
displayName: 'Run check-json'
- script: |
. venv/bin/activate
pre-commit run yamllint --all-files
displayName: 'Run yamllint'
- job: 'Validate'
pool:
vmImage: 'ubuntu-latest'
Expand Down
6 changes: 3 additions & 3 deletions codecov.yml
Expand Up @@ -12,8 +12,8 @@ coverage:
default:
url: "secret:TgWDUM4Jw0w7wMJxuxNF/yhSOHglIo1fGwInJnRLEVPy2P2aLimkoK1mtKCowH5TFw+baUXVXT3eAqefbdvIuM8BjRR4aRji95C6CYyD0QHy4N8i7nn1SQkWDPpS8IthYTg07rUDF7s5guurkKv2RrgoCdnnqjAMSzHoExMOF7xUmblMdhBTWJgBpWEhASJy85w/xxjlsE1xoTkzeJu9Q67pTXtRcn+5kb5/vIzPSYg="
comment:
require_changes: yes
require_changes: true
layout: reach
branches:
- master
- !dev
- master
- !dev
16 changes: 12 additions & 4 deletions homeassistant/components/abode/services.yaml
@@ -1,13 +1,21 @@
capture_image:
description: Request a new image capture from a camera device.
fields:
entity_id: {description: Entity id of the camera to request an image., example: camera.downstairs_motion_camera}
entity_id:
description: Entity id of the camera to request an image.
example: camera.downstairs_motion_camera
change_setting:
description: Change an Abode system setting.
fields:
setting: {description: Setting to change., example: beeper_mute}
value: {description: Value of the setting., example: '1'}
setting:
description: Setting to change.
example: beeper_mute
value:
description: Value of the setting.
example: "1"
trigger_automation:
description: Trigger an Abode automation.
fields:
entity_id: {description: Entity id of the automation to trigger., example: switch.my_automation}
entity_id:
description: Entity id of the automation to trigger.
example: switch.my_automation
2 changes: 1 addition & 1 deletion homeassistant/components/arlo/services.yaml
@@ -1,4 +1,4 @@
# Describes the format for available arlo services

update:
description: Update the state for all cameras and the base station.
description: Update the state for all cameras and the base station.
11 changes: 5 additions & 6 deletions homeassistant/components/automation/services.yaml
@@ -1,35 +1,34 @@
# Describes the format for available automation services

turn_on:
description: Enable an automation.
fields:
entity_id:
description: Name of the automation to turn on.
example: 'automation.notify_home'
example: "automation.notify_home"

turn_off:
description: Disable an automation.
fields:
entity_id:
description: Name of the automation to turn off.
example: 'automation.notify_home'
example: "automation.notify_home"

toggle:
description: Toggle an automation.
fields:
entity_id:
description: Name of the automation to toggle on/off.
example: 'automation.notify_home'
example: "automation.notify_home"

trigger:
description: Trigger the action of an automation.
fields:
entity_id:
description: Name of the automation to trigger.
example: 'automation.notify_home'
example: "automation.notify_home"
skip_condition:
description: Whether or not the condition will be skipped (defaults to True).
example: True
example: true

reload:
description: Reload the automation configuration.
28 changes: 14 additions & 14 deletions homeassistant/components/blink/services.yaml
@@ -1,21 +1,21 @@
# Describes the format for available Blink services

blink_update:
description: Force a refresh.
description: Force a refresh.

trigger_camera:
description: Request named camera to take new image.
fields:
name:
description: Name of camera to take new image.
example: 'Living Room'
description: Request named camera to take new image.
fields:
name:
description: Name of camera to take new image.
example: "Living Room"

save_video:
description: Save last recorded video clip to local file.
fields:
name:
description: Name of camera to grab video from.
example: 'Living Room'
filename:
description: Filename to writable path (directory may need to be included in whitelist_dirs in config)
example: '/tmp/video.mp4'
description: Save last recorded video clip to local file.
fields:
name:
description: Name of camera to grab video from.
example: "Living Room"
filename:
description: Filename to writable path (directory may need to be included in whitelist_dirs in config)
example: "/tmp/video.mp4"
10 changes: 5 additions & 5 deletions homeassistant/components/bluesound/services.yaml
Expand Up @@ -3,28 +3,28 @@ join:
fields:
master:
description: Entity ID of the player that should become the master of the group.
example: 'media_player.bluesound_livingroom'
example: "media_player.bluesound_livingroom"
entity_id:
description: Name(s) of entities that will coordinate the grouping. Platform dependent.
example: 'media_player.bluesound_livingroom'
example: "media_player.bluesound_livingroom"

unjoin:
description: Unjoin the player from a group.
fields:
entity_id:
description: Name(s) of entities that will be unjoined from their group. Platform dependent.
example: 'media_player.bluesound_livingroom'
example: "media_player.bluesound_livingroom"

set_sleep_timer:
description: "Set a Bluesound timer. It will increase timer in steps: 15, 30, 45, 60, 90, 0"
fields:
entity_id:
description: Name(s) of entities that will have a timer set.
example: 'media_player.bluesound_livingroom'
example: "media_player.bluesound_livingroom"

clear_sleep_timer:
description: Clear a Bluesound timer.
fields:
entity_id:
description: Name(s) of entities that will have the timer cleared.
example: 'media_player.bluesound_livingroom'
example: "media_player.bluesound_livingroom"
2 changes: 1 addition & 1 deletion homeassistant/components/bluetooth_tracker/services.yaml
@@ -1,2 +1,2 @@
update:
description: Trigger manual tracker update
description: Trigger manual tracker update
3 changes: 0 additions & 3 deletions homeassistant/components/conversation/services.yaml
@@ -1,10 +1,7 @@
# Describes the format for available component services

process:
description: Launch a conversation from a transcribed text.
fields:
text:
description: Transcribed text
example: Turn all lights on


2 changes: 1 addition & 1 deletion homeassistant/components/demo/services.yaml
@@ -1,2 +1,2 @@
randomize_device_tracker_data:
description: Demonstrates using a device tracker to see where devices are located
description: Demonstrates using a device tracker to see where devices are located
10 changes: 5 additions & 5 deletions homeassistant/components/downloader/services.yaml
@@ -1,15 +1,15 @@
download_file:
description: Downloads a file to the download location.
fields:
url:
url:
description: The URL of the file to download.
example: 'http://example.org/myfile'
example: "http://example.org/myfile"
subdir:
description: Download into subdirectory.
example: 'download_dir'
example: "download_dir"
filename:
description: Determine the filename.
example: 'my_file_name'
example: "my_file_name"
overwrite:
description: Whether to overwrite the file or not.
example: 'false'
example: "false"
14 changes: 7 additions & 7 deletions homeassistant/components/dyson/services.yaml
Expand Up @@ -5,7 +5,7 @@ set_night_mode:
fields:
entity_id:
description: Name(s) of the entities to enable/disable night mode
example: 'fan.living_room'
example: "fan.living_room"
night_mode:
description: Night mode status
example: true
Expand All @@ -15,7 +15,7 @@ set_auto_mode:
fields:
entity_id:
description: Name(s) of the entities to enable/disable auto mode
example: 'fan.living_room'
example: "fan.living_room"
auto_mode:
description: Auto mode status
example: true
Expand All @@ -25,7 +25,7 @@ set_angle:
fields:
entity_id:
description: Name(s) of the entities for which to set the angle
example: 'fan.living_room'
example: "fan.living_room"
angle_low:
description: The angle at which the oscillation should start
example: 1
Expand All @@ -38,7 +38,7 @@ flow_direction_front:
fields:
entity_id:
description: Name(s) of the entities to set frontal flow direction for
example: 'fan.living_room'
example: "fan.living_room"
flow_direction_front:
description: Frontal flow direction
example: true
Expand All @@ -48,7 +48,7 @@ set_timer:
fields:
entity_id:
description: Name(s) of the entities to set the sleep timer for
example: 'fan.living_room'
example: "fan.living_room"
timer:
description: The value in minutes to set the timer to, 0 to disable it
example: 30
Expand All @@ -58,7 +58,7 @@ set_speed:
fields:
entity_id:
description: Name(s) of the entities to set the speed for
example: 'fan.living_room'
example: "fan.living_room"
dyson_speed:
description: Speed
example: 1
example: 1
2 changes: 1 addition & 1 deletion homeassistant/components/ebusd/services.yaml
Expand Up @@ -3,4 +3,4 @@ write:
fields:
call:
description: Property name and value to set
example: '{"name": "Hc1MaxFlowTempDesired", "value": 21}'
example: '{"name": "Hc1MaxFlowTempDesired", "value": 21}'
4 changes: 2 additions & 2 deletions homeassistant/components/econet/services.yaml
Expand Up @@ -3,7 +3,7 @@ add_vacation:
fields:
entity_id:
description: Name(s) of entities to change.
example: 'water_heater.econet'
example: "water_heater.econet"
start_date:
description: The timestamp of when the vacation should start. (Optional, defaults to now)
example: 1513186320
Expand All @@ -16,4 +16,4 @@ delete_vacation:
fields:
entity_id:
description: Name(s) of entities to change.
example: 'water_heater.econet'
example: "water_heater.econet"

0 comments on commit 24840b5

Please sign in to comment.