Skip to content

Fix T201: replace print() with logging; remove global suppression#253

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/t201-fix-linter-error-again
Draft

Fix T201: replace print() with logging; remove global suppression#253
Copilot wants to merge 2 commits into
mainfrom
copilot/t201-fix-linter-error-again

Conversation

Copilot AI commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

T201 (print found) was globally suppressed in pyproject.toml rather than properly addressed. This removes the blanket suppression and fixes all violations.

Changes

  • pyproject.toml: remove T201 from global ignore; add per-file T201 ignore for release_tools/* and scripts/* where print() is legitimate CLI user output
  • mcp_servers/codeql/client.py: add logger = logging.getLogger(__name__); replace all print() calls with logger.debug(), logger.info(), or logger.error() as appropriate
  • render_utils.py: replace print(data, end="", flush=True) with sys.stdout.write(data) + sys.stdout.flush() to preserve streaming terminal output semantics

Copilot AI self-assigned this Jun 1, 2026
Copilot AI review requested due to automatic review settings June 1, 2026 13:35
Copilot AI review requested due to automatic review settings June 1, 2026 13:35
Copilot AI linked an issue Jun 1, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot June 1, 2026 13:48
Copilot AI changed the title [WIP] Fix linter error T201 and update suppression list Fix T201: replace print() with logging; remove global suppression Jun 1, 2026
Copilot AI requested a review from kevinbackhouse June 1, 2026 13:52

WAIT_INTERVAL = 0.1

logger = logging.getLogger(__name__)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Logging should be configured here (similar as to our other MCP servers, but with a different file name)
e.g.
https://github.com/GitHubSecurityLab/seclab-taskflows/blob/1eafe13b91b5fa717f96625b24badac9cb4ffe48/src/seclab_taskflows/mcp_servers/gh_file_viewer.py#L21

if log:
render_logger.info(data)
print(data, end="", flush=True)
sys.stdout.write(data)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think a single line linter suppression is better here than using sys.stdout

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

T201

3 participants