Standardize spyglass-plugin-xls code with YAPF

Implements documentation updates from [0] to standardize formatting for
all Airship projects.

[0] https://review.opendev.org/#/c/671291/

Change-Id: I723af0d91e24a306f05c06a3ddf456757489f7f0
This commit is contained in:
Ian H. Pittwood 2019-07-24 13:22:31 -05:00 committed by Ian H Pittwood
parent 104c8b56a5
commit 269ce7154f
6 changed files with 39 additions and 25 deletions

10
.style.yapf Normal file
View File

@ -0,0 +1,10 @@
[style]
based_on_style = pep8
spaces_before_comment = 2
column_limit = 79
blank_line_before_nested_class_or_def = false
blank_line_before_module_docstring = true
split_before_logical_operator = true
split_before_first_argument = true
allow_split_before_dict_value = false
split_before_arithmetic_operator = true

View File

@ -22,11 +22,3 @@ classifier =
[files]
packages =
spyglass_plugin_xls
[yapf]
based_on_style = pep8
allow_split_before_dict_value = false
blank_line_before_nested_class_or_def = true
blank_line_before_module_docstring = true
split_before_logical_operator = false
split_before_first_argument = true

View File

@ -28,7 +28,6 @@ LOG = logging.getLogger(__name__)
class ExcelPlugin(BaseDataSourcePlugin):
def __init__(self, region, **kwargs):
super().__init__(region)
LOG.info("Excel Plugin Initializing")

View File

@ -14,11 +14,11 @@
from copy import deepcopy
import logging
import pprint
import re
from openpyxl import load_workbook
from openpyxl import Workbook
import pprint
import re
import yaml
from spyglass_plugin_xls import exceptions

View File

@ -4,6 +4,8 @@ pytest-xdist==1.28.0
pytest-cov==2.6.1
# Formatting
flake8==3.7.8
flake8-import-order==0.18.1
yapf==0.27.0
# Linting

39
tox.ini
View File

@ -22,9 +22,9 @@ commands =
[testenv:fmt]
basepython = python3
deps =
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/test-requirements.txt
commands =
yapf -ir {toxinidir}/spyglass_plugin_xls {toxinidir}/setup.py {toxinidir}/tests
yapf -ir {toxinidir}/spyglass_plugin_xls {toxinidir}/setup.py {toxinidir}/tests
[testenv:pep8]
basepython = python3
@ -41,29 +41,26 @@ whitelist_externals =
[testenv:safety]
basepython = python3
deps =
safety
safety
commands =
safety check -r {toxinidir}/requirements.txt --full-report
safety check -r {toxinidir}/test-requirements.txt --full-report
safety check -r {toxinidir}/doc/requirements.txt --full-report
safety check -r {toxinidir}/requirements.txt --full-report
safety check -r {toxinidir}/test-requirements.txt --full-report
safety check -r {toxinidir}/doc/requirements.txt --full-report
[testenv:bandit]
basepython = python3
deps =
bandit
bandit
commands = bandit -r spyglass_plugin_xls -n 5
[flake8]
ignore = W503
[testenv:docs]
basepython = python3
deps =
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build
sphinx-build -b html doc/source doc/build -n -W -v
rm -rf doc/build
sphinx-build -b html doc/source doc/build -n -W -v
whitelist_externals = rm
[testenv:cover]
@ -77,3 +74,17 @@ commands =
--cov-report term --cov-fail-under 92 tests/'
whitelist_externals =
bash
[flake8]
filename = *.py
show-source = true
# [H106] Don't put vim configuration in source files.
# [H201] No 'except:' at least use 'except Exception:'
# [H904] Delay string interpolations at logging calls.
enable-extensions = H106,H201,H904
# [W503] line break before binary operator
ignore = W503
exclude=.venv,.git,.tox,build,dist,*lib/python*,*egg,tools,*.ini,*.po,*.pot
max-complexity = 24
application-import-names = spyglass_plugin_xls
import-order-style = pep8