Skip to content

Commit

Permalink
Add flake8 and black to tox.ini (#1524)
Browse files Browse the repository at this point in the history
Add flake8 and black to tox.ini

SUMMARY


Added linters env to tox.ini.  As suggested here we need not backport this update.
ISSUE TYPE


Bugfix Pull Request
Docs Pull Request
Feature Pull Request
New Module Pull Request

COMPONENT NAME

ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell
Reviewed-by: GomathiselviS
Reviewed-by: Alina Buzachis
  • Loading branch information
GomathiselviS authored May 8, 2023
1 parent 800ed8d commit b3ef6d4
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/add_linters_to_tox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- "Add black and flake8 to linters env in tox.ini."
2 changes: 1 addition & 1 deletion plugins/modules/autoscaling_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -1219,7 +1219,7 @@ def create_autoscaling_group(connection):
else:
ag["LaunchTemplate"] = launch_object["LaunchTemplate"]
else:
module.fail_json_aws(e, msg="Missing LaunchConfigurationName or LaunchTemplate")
module.fail_json(msg="Missing LaunchConfigurationName or LaunchTemplate")

try:
create_asg(connection, **ag)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/ec2_eip.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def associate_ip_and_device(
msg = f"Couldn't associate Elastic IP address with network interface '{device_id}'"
module.fail_json_aws(e, msg=msg)
if not res:
module.fail_json_aws(e, msg="Association failed.")
module.fail_json(msg="Association failed.")

return {"changed": True}

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/rds_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ def main():
preferred_backup_window=dict(aliases=["backup_window"]),
preferred_maintenance_window=dict(aliases=["maintenance_window"]),
processor_features=dict(type="dict"),
promotion_tier=dict(type='int'),
promotion_tier=dict(type="int"),
publicly_accessible=dict(type="bool"),
restore_time=dict(),
s3_bucket_name=dict(),
Expand Down
25 changes: 24 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
skipsdist=True
envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints}
envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints},linters

[testenv]
description = Run the test-suite and generate a HTML coverage report
Expand All @@ -27,3 +27,26 @@ deps =
flake8>=3.3.0,<5.0.0'
flake8-html
commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs:complexity} plugins
[testenv:black]
deps =
black >=23.0, <24.0
commands =
black {toxinidir}/plugins {toxinidir}/tests
[testenv:linters]
deps =
{[testenv:black]deps}
flake8
commands =
black -v --check {toxinidir}/plugins {toxinidir}/tests
flake8 {posargs} {toxinidir}/plugins {toxinidir}/tests
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,E203,E402,E501,E741,F401,F811,F841,W503
max-line-length = 160
builtins = _

0 comments on commit b3ef6d4

Please sign in to comment.