Your DevOps team uses AI-assisted generators to create Python helper scripts for Linux automation. To meet the code-linting best practice and prevent any commit that violates PEP 8 or introduces obvious logical errors from reaching the shared repository, you need an automated safeguard that still lets developers review their changes locally. Which approach BEST satisfies this requirement?
Enable Git Large File Storage (LFS) for the repository and review code style after each push.
Configure a Git pre-commit hook that runs pylint and black, blocking the commit if violations are detected.
Require all commits to be GPG-signed so the author can be verified by reviewers.
Use git rebase with the --squash option to condense AI-generated commits before merging.
Git supports a pre-commit hook that runs automatically before each commit is recorded. By wiring this hook to tools such as pylint-which checks PEP 8 style and detects likely coding mistakes-and a formatter like black, the commit is rejected until the problems are fixed. This forces developers (including those using AI-generated code) to verify and correct output before the code leaves their workstation, fulfilling the exam objective of code linting and the AI guideline of verify output. Enabling Git LFS only changes how large files are stored; it does not analyze code. Rebasing/squashing tidies history but does not lint. GPG signing confirms authorship but performs no style or logic checks.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is a Git pre-commit hook?
Open an interactive chat with Bash
What does pylint and black do in code linting?
Open an interactive chat with Bash
What is PEP 8 and why is it important?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Automation, Orchestration, and Scripting
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access