Initial commit
This commit is contained in:
		
						commit
						e1ee7b16ee
					
				| 
						 | 
				
			
			@ -0,0 +1,58 @@
 | 
			
		|||
repos:
 | 
			
		||||
  - repo: https://github.com/asottile/pyupgrade
 | 
			
		||||
    rev: v2.3.0
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: pyupgrade
 | 
			
		||||
        args: [--py37-plus]
 | 
			
		||||
  - repo: https://github.com/psf/black
 | 
			
		||||
    rev: 19.10b0
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: black
 | 
			
		||||
        args:
 | 
			
		||||
          - --safe
 | 
			
		||||
          - --quiet
 | 
			
		||||
        files: ^((homeassistant|script|tests)/.+)?[^/]+\.py$
 | 
			
		||||
  - repo: https://github.com/codespell-project/codespell
 | 
			
		||||
    rev: v1.16.0
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: codespell
 | 
			
		||||
        args:
 | 
			
		||||
          - --ignore-words-list=hass,alot,datas,dof,dur,farenheit,hist,iff,ines,ist,lightsensor,mut,nd,pres,referer,ser,serie,te,technik,ue,uint,visability,wan,wanna,withing
 | 
			
		||||
          - --skip="./.*,*.csv,*.json"
 | 
			
		||||
          - --quiet-level=2
 | 
			
		||||
        exclude_types: [csv, json]
 | 
			
		||||
  - repo: https://gitlab.com/pycqa/flake8
 | 
			
		||||
    rev: 3.8.1
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: flake8
 | 
			
		||||
        additional_dependencies:
 | 
			
		||||
          - flake8-docstrings==1.5.0
 | 
			
		||||
          - pydocstyle==5.0.2
 | 
			
		||||
        files: ^(homeassistant|script|tests)/.+\.py$
 | 
			
		||||
  - repo: https://github.com/PyCQA/bandit
 | 
			
		||||
    rev: 1.6.2
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: bandit
 | 
			
		||||
        args:
 | 
			
		||||
          - --quiet
 | 
			
		||||
          - --format=custom
 | 
			
		||||
          - --configfile=tests/bandit.yaml
 | 
			
		||||
        files: ^(homeassistant|script|tests)/.+\.py$
 | 
			
		||||
  - repo: https://github.com/pre-commit/mirrors-isort
 | 
			
		||||
    rev: v4.3.21
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: isort
 | 
			
		||||
  - repo: https://github.com/pre-commit/pre-commit-hooks
 | 
			
		||||
    rev: v2.4.0
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: check-executables-have-shebangs
 | 
			
		||||
        stages: [manual]
 | 
			
		||||
      - id: check-json
 | 
			
		||||
  - repo: https://github.com/pre-commit/mirrors-mypy
 | 
			
		||||
    rev: v0.770
 | 
			
		||||
    hooks:
 | 
			
		||||
      - id: mypy
 | 
			
		||||
        args:
 | 
			
		||||
          - --pretty
 | 
			
		||||
          - --show-error-codes
 | 
			
		||||
          - --show-error-context
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
from homeassistant import core
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def async_setup(hass: core.HomeAssistant, config: dict) -> bool:
 | 
			
		||||
    """Set up the Flickerstrip component."""
 | 
			
		||||
    # @TODO: Add setup code.
 | 
			
		||||
    return True
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
DOMAIN = "flickerstrip"
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,11 @@
 | 
			
		|||
{
 | 
			
		||||
  "codeowners": ["@fifitido"],
 | 
			
		||||
  "config_flow": true,
 | 
			
		||||
  "dependencies": [],
 | 
			
		||||
  "documentation": "https://git.fifitido.net/lib/hass_flickerstrip",
 | 
			
		||||
  "domain": "flickerstrip",
 | 
			
		||||
  "iot_class": "local_polling",
 | 
			
		||||
  "name": "Flickerstrip",
 | 
			
		||||
  "requirements": [],
 | 
			
		||||
  "version": "1.0.0"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
{
 | 
			
		||||
  "name": "Flickerstrip",
 | 
			
		||||
  "render_readme": true,
 | 
			
		||||
  "iot_class": "local_polling"
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
pytest
 | 
			
		||||
pytest-cov==2.9.0
 | 
			
		||||
pytest-homeassistant-custom-component
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
[coverage:run]
 | 
			
		||||
source =
 | 
			
		||||
  custom_components
 | 
			
		||||
 | 
			
		||||
[coverage:report]
 | 
			
		||||
exclude_lines =
 | 
			
		||||
    pragma: no cover
 | 
			
		||||
    raise NotImplemented()
 | 
			
		||||
    if __name__ == '__main__':
 | 
			
		||||
    main()
 | 
			
		||||
show_missing = true
 | 
			
		||||
 | 
			
		||||
[tool:pytest]
 | 
			
		||||
testpaths = tests
 | 
			
		||||
norecursedirs = .git
 | 
			
		||||
addopts =
 | 
			
		||||
    --strict
 | 
			
		||||
    --cov=custom_components
 | 
			
		||||
 | 
			
		||||
[flake8]
 | 
			
		||||
# https://github.com/ambv/black#line-length
 | 
			
		||||
max-line-length = 88
 | 
			
		||||
# E501: line too long
 | 
			
		||||
# W503: Line break occurred before a binary operator
 | 
			
		||||
# E203: Whitespace before ':'
 | 
			
		||||
# D202 No blank lines allowed after function docstring
 | 
			
		||||
# W504 line break after binary operator
 | 
			
		||||
ignore =
 | 
			
		||||
    E501,
 | 
			
		||||
    W503,
 | 
			
		||||
    E203,
 | 
			
		||||
    D202,
 | 
			
		||||
    W504
 | 
			
		||||
 | 
			
		||||
[isort]
 | 
			
		||||
# https://github.com/timothycrosley/isort
 | 
			
		||||
# https://github.com/timothycrosley/isort/wiki/isort-Settings
 | 
			
		||||
# splits long import on multiple lines indented by 4 spaces
 | 
			
		||||
multi_line_output = 3
 | 
			
		||||
include_trailing_comma=True
 | 
			
		||||
force_grid_wrap=0
 | 
			
		||||
use_parentheses=True
 | 
			
		||||
line_length=88
 | 
			
		||||
indent = "    "
 | 
			
		||||
# by default isort don't check module indexes
 | 
			
		||||
not_skip = __init__.py
 | 
			
		||||
# will group `import x` and `from x import` of the same module.
 | 
			
		||||
force_sort_within_sections = true
 | 
			
		||||
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
 | 
			
		||||
default_section = THIRDPARTY
 | 
			
		||||
known_first_party = custom_components,tests
 | 
			
		||||
forced_separate = tests
 | 
			
		||||
combine_as_imports = true
 | 
			
		||||
 | 
			
		||||
[mypy]
 | 
			
		||||
python_version = 3.7
 | 
			
		||||
ignore_errors = true
 | 
			
		||||
follow_imports = silent
 | 
			
		||||
ignore_missing_imports = true
 | 
			
		||||
warn_incomplete_stub = true
 | 
			
		||||
warn_redundant_casts = true
 | 
			
		||||
warn_unused_configs = true
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
# https://bandit.readthedocs.io/en/latest/config.html
 | 
			
		||||
 | 
			
		||||
tests:
 | 
			
		||||
  - B108
 | 
			
		||||
  - B306
 | 
			
		||||
  - B307
 | 
			
		||||
  - B313
 | 
			
		||||
  - B314
 | 
			
		||||
  - B315
 | 
			
		||||
  - B316
 | 
			
		||||
  - B317
 | 
			
		||||
  - B318
 | 
			
		||||
  - B319
 | 
			
		||||
  - B320
 | 
			
		||||
  - B325
 | 
			
		||||
  - B602
 | 
			
		||||
  - B604
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
"""Test component setup."""
 | 
			
		||||
from homeassistant.setup import async_setup_component
 | 
			
		||||
 | 
			
		||||
from custom_components.flickerstrip.const import DOMAIN
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
async def test_async_setup(hass):
 | 
			
		||||
    """Test the component gets setup."""
 | 
			
		||||
    assert await async_setup_component(hass, DOMAIN, {}) is True
 | 
			
		||||
		Loading…
	
		Reference in New Issue