Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 1.59 KB

File metadata and controls

31 lines (21 loc) · 1.59 KB

🎤 Interview Q&A - Pre-commit Quality Gate Setup

1. What is the main purpose of pre-commit in a repository?

It runs checks before a commit is recorded so formatting, linting, and security issues are caught early.

2. Why were Black and Flake8 both included?

Black enforces formatting automatically, while Flake8 catches style issues, unused imports, and other quality problems.

3. What did Bandit add to the workflow?

Bandit scanned the Python code for common security issues such as hardcoded passwords and insecure patterns.

4. Why was a virtual environment recommended on Ubuntu 24.04?

It keeps Python tooling isolated from the system-managed interpreter and avoids package conflicts.

5. Why was the initial app.py intentionally weak?

It gave the quality gate something meaningful to detect, including formatting, linting, and security problems.

6. What was the purpose of the custom TODO hook?

It showed how teams can add project-specific policy checks beyond standard community hooks.

7. Why can --no-verify be risky?

It bypasses local quality controls and can allow known issues to enter version control.

8. What is the value of separate .flake8 and .bandit files?

They keep tool behavior explicit, reusable, and easier to tune without cluttering command lines.

9. Why did pretty-format-json matter in this lab?

It demonstrated that repository quality gates can also enforce consistency for non-Python files.

10. How do local hooks relate to CI/CD pipelines?

Local hooks are the first layer of enforcement, while CI/CD pipelines provide a second layer on shared infrastructure.