diff options
author | Shawn Wilsher <656602+sdwilsh@users.noreply.github.com> | 2022-09-02 06:22:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 09:22:14 -0400 |
commit | 69a2882d106171f050fac193a552542cdab418a8 (patch) | |
tree | 03e419d47de81b473b96f4f2a2a6c8b9f2bee5f8 | |
parent | 4c116b506d4a529370dd63761f601a89d1adbf92 (diff) | |
download | vyos.vyos-69a2882d106171f050fac193a552542cdab418a8.tar.gz vyos.vyos-69a2882d106171f050fac193a552542cdab418a8.zip |
Fix `pre-commit` Issues (#223)
* Fix `pre-commit` Issues
This change fixes `.pre-commit-config.yaml` so that `main` no longer has
errors on it. To accomplish that, two things had to be done:
* Update the version of `black` that `pre-commit` uses to match what `tox` uses.
* Run `pre-commit run --all-files` and commit the results
Co-authored-by: Kate Case <this.is@katherineca.se>
21 files changed, 37 insertions, 39 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7661ca6..1f7653f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,20 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.1.0 + rev: v4.3.0 hooks: - id: check-merge-conflict - - id: check-symlinks - id: debug-statements - id: end-of-file-fixer - id: no-commit-to-branch - args: [--branch, main] - id: trailing-whitespace + - repo: https://github.com/psf/black - rev: 19.3b0 + rev: 22.6.0 hooks: - id: black - args: [-l, "79"] + - repo: https://github.com/ansible-network/collection_prep - rev: 0.9.4 + rev: 1.0.0 hooks: - id: update-docs diff --git a/changelogs/fragments/fix-precommit-issues.yml b/changelogs/fragments/fix-precommit-issues.yml new file mode 100644 index 0000000..c78c23a --- /dev/null +++ b/changelogs/fragments/fix-precommit-issues.yml @@ -0,0 +1,4 @@ +--- +trivial: + - Bump pre-commit `black` version to match that used by `tox` + - Fix existing errors that pre-commit checks against by running `pre-commit run --all-files` diff --git a/test-requirements.txt b/test-requirements.txt index 8359fc5..f20ec70 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,9 @@ -black==22.3.0 ; python_version > '3.5' +black==22.6.0 +coverage==4.5.4 +git+https://github.com/ansible-community/pytest-ansible-units.git flake8 -mock -pexpect pytest-xdist yamllint -coverage==4.5.4 -git+https://github.com/ansible-community/pytest-ansible-units.git + +mock +pexpect diff --git a/tests/integration/target-prefixes.network b/tests/integration/target-prefixes.network index 0c45eba..2d0f40c 100644 --- a/tests/integration/target-prefixes.network +++ b/tests/integration/target-prefixes.network @@ -1 +1 @@ -vyos
\ No newline at end of file +vyos diff --git a/tests/integration/targets/vyos_config/tests/cli/config.cfg b/tests/integration/targets/vyos_config/tests/cli/config.cfg index 36c98f1..b63703e 100644 --- a/tests/integration/targets/vyos_config/tests/cli/config.cfg +++ b/tests/integration/targets/vyos_config/tests/cli/config.cfg @@ -1,3 +1,2 @@ set service lldp set protocols static - diff --git a/tests/integration/targets/vyos_firewall_interfaces/1 b/tests/integration/targets/vyos_firewall_interfaces/1 index 70ae90f..628ada5 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/1 +++ b/tests/integration/targets/vyos_firewall_interfaces/1 @@ -6,11 +6,11 @@ merged: commands: - "set interfaces ethernet eth1 firewall in name 'INBOUND'" - "set interfaces ethernet eth1 firewall out name 'OUTBOUND'" - - "set interfaces ethernet eth1 firewall local name 'LOCAL'" + - "set interfaces ethernet eth1 firewall local name 'LOCAL'" - "set interfaces ethernet eth1 firewall local ipv6-name 'V6-LOCAL'" - "set interfaces ethernet eth3 firewall in name 'INBOUND'" - "set interfaces ethernet eth3 firewall out name 'OUTBOUND'" - - "set interfaces ethernet eth3 firewall local name 'LOCAL'" + - "set interfaces ethernet eth3 firewall local name 'LOCAL'" - "set interfaces ethernet eth3 firewall local ipv6-name 'V6-LOCAL'" after: diff --git a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_parsed_config.cfg index 54696e8..48f286e 100644 --- a/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_firewall_interfaces/tests/cli/_parsed_config.cfg @@ -7,4 +7,3 @@ set interfaces ethernet eth2 firewall out name 'OUTBOUND' set interfaces ethernet eth2 firewall local name 'LOCAL' set interfaces ethernet eth2 firewall local ipv6-name 'V6-LOCAL' set interfaces ethernet eth0 - diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg index ef070a7..9232a0a 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/_parsed_config.cfg @@ -5,5 +5,3 @@ set interfaces ethernet eth2 address '198.51.100.10/24' set interfaces ethernet eth2 hw-id '08:00:27:d8:70:b0' set interfaces ethernet eth2 vif 101 address '198.51.100.130/25' set interfaces ethernet eth2 vif 101 address '2001:db8::20/32' - - diff --git a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg index ea3bfce..1a275bd 100644 --- a/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_lag_interfaces/tests/cli/_parsed_config.cfg @@ -5,4 +5,4 @@ set interfaces bonding bond1 hash-policy 'layer2+3' set interfaces bonding bond1 mode 'active-backup' set interfaces bonding bond1 primary 'eth2' set interfaces ethernet eth1 bond-group 'bond0' -set interfaces ethernet eth2 bond-group 'bond1'
\ No newline at end of file +set interfaces ethernet eth2 bond-group 'bond1' diff --git a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg index 40c96c4..737449c 100644 --- a/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_lldp_interfaces/tests/cli/_parsed_config.cfg @@ -3,4 +3,4 @@ set service lldp interface eth1 location civic-based country-code 'US' set service lldp interface eth2 location coordinate-based altitude '2200' set service lldp interface eth2 location coordinate-based datum 'WGS84' set service lldp interface eth2 location coordinate-based latitude '33.524449N' -set service lldp interface eth2 location coordinate-based longitude '222.267255W'
\ No newline at end of file +set service lldp interface eth2 location coordinate-based longitude '222.267255W' diff --git a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_parsed_config.cfg b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_parsed_config.cfg index 54696e8..48f286e 100644 --- a/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_parsed_config.cfg +++ b/tests/integration/targets/vyos_ospf_interfaces/tests/cli/_parsed_config.cfg @@ -7,4 +7,3 @@ set interfaces ethernet eth2 firewall out name 'OUTBOUND' set interfaces ethernet eth2 firewall local name 'LOCAL' set interfaces ethernet eth2 firewall local ipv6-name 'V6-LOCAL' set interfaces ethernet eth0 - diff --git a/tests/integration/targets/vyos_prefix_lists/tests/cli/_parsed.cfg b/tests/integration/targets/vyos_prefix_lists/tests/cli/_parsed.cfg index 25744b3..0e508b3 100644 --- a/tests/integration/targets/vyos_prefix_lists/tests/cli/_parsed.cfg +++ b/tests/integration/targets/vyos_prefix_lists/tests/cli/_parsed.cfg @@ -15,4 +15,4 @@ set policy prefix-list6 AllowIPv6Prefix rule 5 prefix '2001:db8:8000::/35' set policy prefix-list6 DenyIPv6Prefix description 'Configured by ansible for disallowing IPv6 networks' set policy prefix-list6 DenyIPv6Prefix rule 8 action 'deny' set policy prefix-list6 DenyIPv6Prefix rule 8 le '37' -set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35'
\ No newline at end of file +set policy prefix-list6 DenyIPv6Prefix rule 8 prefix '2001:db8:2000::/35' diff --git a/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg b/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg index a4aa4d3..affbd28 100644 --- a/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg +++ b/tests/integration/targets/vyos_route_maps/tests/cli/_parsed.cfg @@ -10,4 +10,4 @@ set policy route-map test3 rule 1 set originator-id 192.0.2.34 set policy route-map test3 rule 1 set tag 5 set policy route-map test3 rule 1 set weight 4 set policy route-map test3 rule 1 match metric 1 -set policy route-map test3 rule 1 match peer 192.0.2.32
\ No newline at end of file +set policy route-map test3 rule 1 match peer 192.0.2.32 diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index d753480..496cf86 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -9,4 +9,4 @@ plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py import-2.6 plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py compile-2.6!skip plugins/modules/vyos_logging_global.py import-2.6!skip plugins/module_utils/network/vyos/config/logging_global/logging_global.py import-2.6!skip -plugins/module_utils/network/vyos/config/logging_global/logging_global.py compile-2.6!skip
\ No newline at end of file +plugins/module_utils/network/vyos/config/logging_global/logging_global.py compile-2.6!skip diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index d753480..496cf86 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -9,4 +9,4 @@ plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py import-2.6 plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py compile-2.6!skip plugins/modules/vyos_logging_global.py import-2.6!skip plugins/module_utils/network/vyos/config/logging_global/logging_global.py import-2.6!skip -plugins/module_utils/network/vyos/config/logging_global/logging_global.py compile-2.6!skip
\ No newline at end of file +plugins/module_utils/network/vyos/config/logging_global/logging_global.py compile-2.6!skip diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 83e9150..59d08b5 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -23,4 +23,4 @@ plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py import-2.6 plugins/module_utils/network/vyos/config/prefix_lists/prefix_lists.py compile-2.6!skip plugins/modules/vyos_logging_global.py import-2.6!skip plugins/module_utils/network/vyos/config/logging_global/logging_global.py import-2.6!skip -plugins/module_utils/network/vyos/config/logging_global/logging_global.py compile-2.6!skip
\ No newline at end of file +plugins/module_utils/network/vyos/config/logging_global/logging_global.py compile-2.6!skip diff --git a/tests/unit/modules/network/vyos/fixtures/show_version b/tests/unit/modules/network/vyos/fixtures/show_version index a015d55..e546a14 100644 --- a/tests/unit/modules/network/vyos/fixtures/show_version +++ b/tests/unit/modules/network/vyos/fixtures/show_version @@ -11,4 +11,3 @@ HW model: VMware Virtual Platform HW S/N: VMware-42 3c 26 25 44 c5 0a 91-cf 2c 97 2b fe 9b 25 be HW UUID: 423C2625-44C5-0A91-CF2C-972BFE9B25BE Uptime: 01:08:20 up 52 days, 2:13, 1 user, load average: 0.00, 0.01, 0.05 - diff --git a/tests/unit/modules/network/vyos/fixtures/vyos_lldp_neighbor_config.cfg b/tests/unit/modules/network/vyos/fixtures/vyos_lldp_neighbor_config.cfg index 267958c..48e7c97 100644 --- a/tests/unit/modules/network/vyos/fixtures/vyos_lldp_neighbor_config.cfg +++ b/tests/unit/modules/network/vyos/fixtures/vyos_lldp_neighbor_config.cfg @@ -2,7 +2,7 @@ LLDP neighbors: ------------------------------------------------------------------------------- Interface: eth1, via: LLDP, RID: 1, Time: 0 day, 00:30:34 - Chassis: + Chassis: ChassisID: mac 08:00:27:7c:85:05 SysName: vyos SysDescr: Vyatta Router running on VyOS 1.1.8 (helium) @@ -10,7 +10,7 @@ Interface: eth1, via: LLDP, RID: 1, Time: 0 day, 00:30:34 Capability: Bridge, off Capability: Router, on Capability: Wlan, off - Port: + Port: PortID: mac 08:00:27:04:85:99 PortDescr: eth0 PMD autoneg: supported: yes, enabled: yes @@ -18,7 +18,7 @@ Interface: eth1, via: LLDP, RID: 1, Time: 0 day, 00:30:34 Adv: 100Base-T, HD: yes, FD: yes Adv: 1000Base-T, HD: no, FD: yes MAU oper type: 1000BaseTFD - Four-pair Category 5 UTP, full duplex mode - LLDP-MED: + LLDP-MED: Device Type: Network Connectivity Device Capability: Capabilities Capability: Policy @@ -26,7 +26,7 @@ Interface: eth1, via: LLDP, RID: 1, Time: 0 day, 00:30:34 Capability: MDI/PSE Capability: MDI/PD Capability: Inventory - Inventory: + Inventory: Hardware Revision: 1.2 Software Revision: 3.13.11-1-586-vyos Firmware Revision: VirtualBox @@ -35,7 +35,7 @@ Interface: eth1, via: LLDP, RID: 1, Time: 0 day, 00:30:34 Model: VirtualBox ------------------------------------------------------------------------------- Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 00:32:50 - Chassis: + Chassis: ChassisID: mac 08:00:27:7c:85:05 SysName: vyos SysDescr: Vyatta Router running on VyOS 1.1.8 (helium) @@ -43,7 +43,7 @@ Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 00:32:50 Capability: Bridge, off Capability: Router, on Capability: Wlan, off - Port: + Port: PortID: mac 08:00:27:18:e6:f2 PortDescr: eth1 PMD autoneg: supported: yes, enabled: yes @@ -51,7 +51,7 @@ Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 00:32:50 Adv: 100Base-T, HD: yes, FD: yes Adv: 1000Base-T, HD: no, FD: yes MAU oper type: 1000BaseTFD - Four-pair Category 5 UTP, full duplex mode - LLDP-MED: + LLDP-MED: Device Type: Network Connectivity Device Capability: Capabilities Capability: Policy @@ -59,7 +59,7 @@ Interface: eth0, via: LLDP, RID: 1, Time: 0 day, 00:32:50 Capability: MDI/PSE Capability: MDI/PD Capability: Inventory - Inventory: + Inventory: Hardware Revision: 1.2 Software Revision: 3.13.11-1-586-vyos Firmware Revision: VirtualBox diff --git a/tests/unit/modules/network/vyos/fixtures/vyos_ospfv3_config.cfg b/tests/unit/modules/network/vyos/fixtures/vyos_ospfv3_config.cfg index 060b9b3..8fe2809 100644 --- a/tests/unit/modules/network/vyos/fixtures/vyos_ospfv3_config.cfg +++ b/tests/unit/modules/network/vyos/fixtures/vyos_ospfv3_config.cfg @@ -3,4 +3,4 @@ set protocols ospfv3 area 12 import-list 'import1' set protocols ospfv3 area 12 range '2001:db11::/32' set protocols ospfv3 area 12 range '2001:db22::/32' set protocols ospfv3 area 12 range '2001:db33::/32' -set protocols ospfv3 area 13 range '2001:db44::/32'
\ No newline at end of file +set protocols ospfv3 area 13 range '2001:db44::/32' diff --git a/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg b/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg index c7fd9ef..d115026 100644 --- a/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg +++ b/tests/unit/modules/network/vyos/fixtures/vyos_route_maps_config.cfg @@ -15,4 +15,4 @@ set policy route-map test3 rule 1 set origin 'egp' set policy route-map test3 rule 1 set originator-id '10.0.2.3' set policy route-map test3 rule 1 set src '10.0.2.15' set policy route-map test3 rule 1 set tag '5' -set policy route-map test3 rule 1 set weight '4'
\ No newline at end of file +set policy route-map test3 rule 1 set weight '4' @@ -10,12 +10,12 @@ deps = -r{toxinidir}/requirements.txt [testenv:black] install_command = pip install {opts} {packages} commands = - black -v -l79 {toxinidir} + black --exclude '\.git|\.mypy_cache|\.tox|tests/output' {toxinidir} [testenv:linters] install_command = pip install {opts} {packages} commands = - black -v -l79 --diff --check {toxinidir} + black --exclude '\.git|\.mypy_cache|\.tox|tests/output' --check {toxinidir} flake8 {posargs} yamllint -s . |