Skip to content

Commit

Permalink
Maintenance PR (#73)
Browse files Browse the repository at this point in the history
* Maintainance PR

* fix lint issues

* fix yml lint failure

* fix lint error codecov

* fix mypy

* autoversion

* removed mypy

* fix failing flake8

Signed-off-by: NilashishC <[email protected]>

* fix units

Signed-off-by: NilashishC <[email protected]>

* add flake8

* added build-import

---------

Signed-off-by: NilashishC <[email protected]>
Co-authored-by: Nilashish Chakraborty <[email protected]>
  • Loading branch information
roverflow and NilashishC authored Apr 9, 2024
1 parent 7049696 commit cff2b6a
Show file tree
Hide file tree
Showing 20 changed files with 136 additions and 275 deletions.
4 changes: 1 addition & 3 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
---
profile: production

exclude_paths:
- changelogs/changelog.yaml
profile: production
67 changes: 67 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[flake8]

builtins = _

# Print the total number of errors:
count = true

# Don't even try to analyze these:
extend-exclude =
# No need to traverse egg info dir
*.egg-info,
# tool cache dirs
*_cache
# project env vars
.env,
# GitHub configs
.github,
# Cache files of MyPy
.mypy_cache,
# Cache files of pytest
.pytest_cache,
# Temp dir of pytest-testmon
.tmontmp,
# Occasional virtualenv dir
.venv
# VS Code
.vscode,
# Temporary build dir
build,
# This contains sdists and wheels of ansible-navigator that we don't want to check
dist,
# Metadata of `pip wheel` cmd is autogenerated
pip-wheel-metadata,
# adjacent venv
venv
# ansible won't let me
__init__.py

# IMPORTANT: avoid using ignore option, always use extend-ignore instead
# Completely and unconditionally ignore the following errors:
extend-ignore =
F841,
# line-length
E501,
# module level import not at top of file
E402

# Accessibility/large fonts and PEP8 unfriendly:
max-line-length = 120

# Allow certain violations in certain files:
# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future
per-file-ignores =
# The following ignores have been researched and should be considered permanent
# each should be preceeded with an explanation of each of the error codes
# If other ignores are added for a specific file in the section following this,
# these will need to be added to that line as well.


# S101: Allow the use of assert within the tests directory, since tests require it.
tests/**.py: S101

# The following were present during the initial implementation.
# They are expected to be fixed and unignored over time.

# Count the number of occurrences of each error/warning code and print a report:
statistics = true
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml
name: ack

name: "Check label"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]
jobs:
ack:
uses: ansible/devtools/.github/workflows/ack.yml@main
check_label:
uses: ansible/ansible-content-actions/.github/workflows/check_label.yaml@main
6 changes: 4 additions & 2 deletions .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
---
name: Code Coverage
name: "Code coverage"

on: # yamllint disable-line rule:truthy
push:
pull_request:
branches: [main]
pull_request:
branches: [ main ]

jobs:
codecoverage:
uses: ansible-network/github_actions/.github/workflows/coverage_network_devices.yml@main
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "Draft release"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on: # yamllint disable-line rule:truthy
workflow_dispatch:
env:
NAMESPACE: ${{ github.repository_owner }}
COLLECTION_NAME: qradar
ANSIBLE_COLLECTIONS_PATHS: ./
jobs:
update_release_draft:
uses: ansible/ansible-content-actions/.github/workflows/draft_release.yaml@main
with:
repo: ${{ github.event.pull_request.head.repo.full_name }}
secrets:
BOT_PAT: ${{ secrets.BOT_PAT }}
13 changes: 0 additions & 13 deletions .github/workflows/lint.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/push.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
name: release
name: "Release collection"
on: # yamllint disable-line rule:truthy
release:
types: [published]

jobs:
release:
uses: ansible/devtools/.github/workflows/release_collection.yml@main
uses: ansible/ansible-content-actions/.github/workflows/release.yaml@main
with:
environment: release
secrets:
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: "CI"

concurrency:
group: ${{ github.head_ref || github.run_id }}
Expand All @@ -10,31 +10,45 @@ on: # yamllint disable-line rule:truthy
branches: [main]
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'


jobs:
changelog:
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
if: github.event_name == 'pull_request'
build-import:
uses: ansible/ansible-content-actions/.github/workflows/build_import.yaml@main
ansible-lint:
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main
unit-galaxy:
uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main
uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main
unit-source:
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
with:
collection_pre_install: >-
git+https://github.com/ansible-collections/ansible.utils.git
git+https://github.com/ansible-collections/ansible.netcommon.git
all_green:
if: ${{ always() && (github.event_name != 'schedule') }}
if: ${{ always() }}
needs:
- changelog
- build-import
- sanity
- unit-galaxy
- ansible-lint
- unit-source
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert 'failure' not in
set([
'${{ needs.changelog.result }}',
'${{ needs.build-import.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}',
'${{ needs.unit-galaxy.result }}'
'${{ needs.ansible-lint.result }}'
'${{ needs.unit-source.result }}'
])"
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
- repo: https://github.com/ansible-network/collection_prep
rev: 1.1.1
hooks:
# - id: autoversion
- id: update-docs

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -37,9 +38,14 @@ repos:
hooks:
- id: isort
name: Sort import statements using isort
args: [--filter-files]
args: ["--filter-files"]

- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
4 changes: 1 addition & 3 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ dependencies:
ansible.netcommon: ">=6.0.0"
description: Ansible Security Collection for IBM Qradar SIEM
license_file: LICENSE
tags:
- security
- qradar
tags: ["security", "qradar"]
repository: https://github.com/ansible-collections/ibm.qradar
documentation: https://github.com/ansible-collections/ibm.qradar
homepage: https://github.com/ansible-collections/ibm.qradar
Expand Down
9 changes: 2 additions & 7 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# For ansible-tox-linters
black==23.3.0 ; python_version >= '3.7'
flake8
yamllint

# Unit test runner
pytest-ansible ; python_version >= '3.9'
git+https://github.com/ansible-community/pytest-ansible-units.git ; python_version < '3.9'
pytest-ansible
pytest-xdist
pytest-cov
Empty file removed tests/unit/compat/__init__.py
Empty file.
Loading

0 comments on commit cff2b6a

Please sign in to comment.