Skip to content

CFE-4632: Added python linting in github actions#122

Open
victormlg wants to merge 3 commits intocfengine:masterfrom
victormlg:linting
Open

CFE-4632: Added python linting in github actions#122
victormlg wants to merge 3 commits intocfengine:masterfrom
victormlg:linting

Conversation

@victormlg
Copy link
Contributor

No description provided.

@victormlg victormlg force-pushed the linting branch 11 times, most recently from 5c9acec to 6db2a0c Compare February 13, 2026 15:17
@victormlg victormlg marked this pull request as ready for review February 13, 2026 15:18
@victormlg victormlg force-pushed the linting branch 4 times, most recently from 50474a2 to 387dc68 Compare February 16, 2026 09:24
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Copy link
Contributor

@craigcomstock craigcomstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sweet. thanks for the change to mostly in a script! Just one more nudge to move linting.sh to modules/ci directory. 👍

- name: Check the formatting
run: cfbs --check pretty ./cfbs.json
- name: Linting
run: ./.github/workflows/linting.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this in a modules/ci directory instead so it is more "visible" and standardized with our other repos.

black --check .

echo "Running pyflakes"
pyflakes . No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline at the end of this file.

Comment on lines -7 to -16
try:
from ansible import context
from ansible.cli import CLI
from ansible.executor.playbook_executor import PlaybookExecutor
from ansible.inventory.manager import InventoryManager
from ansible.module_utils.common.collections import ImmutableDict
from ansible.parsing.dataloader import DataLoader
from ansible.plugins.callback import CallbackBase
from ansible.vars.manager import VariableManager
from ansible.plugins.loader import init_plugin_loader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big change in behavior. The previous version would try to import and handle it if it doesn't work, i.e. if Ansible is not installed.

This is presumably because we don't know if Ansible is installed on the host where this runs (or is imported).

In this case, I think you should add an exception for this file, and not make such a big change. And if / when you're going to make that change, it should be in its own commit, with some more thorough explanation of why, why it's okay, how it is tested, how we are ensuring that Ansible is always importable, or similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants