Skip to content

Enabled flake8-print plugin rules for ruff linter#4399

Open
JayeshHire wants to merge 5 commits intoopen-telemetry:mainfrom
JayeshHire:T20-rule
Open

Enabled flake8-print plugin rules for ruff linter#4399
JayeshHire wants to merge 5 commits intoopen-telemetry:mainfrom
JayeshHire:T20-rule

Conversation

@JayeshHire
Copy link
Copy Markdown

@JayeshHire JayeshHire commented Apr 6, 2026

Description

Enabled flake8-print plugin rules for ruff linter. These set of rules will throw errors when print statements or pprint statements are found in the code. If someone has to add debugs while development they should use logger to print the debugs. As sensitive data can be leaked via print statements to the stdout. print and pprint cannot be configured by the users like logs can be configured. This rule adds a check to warn contributors about their use of print and pprint statements inside the code and mandates them to remove these statements from the code.

Below are the Ignored files and directories by this plugin

Below directories are ignored as they are not the direct part of the opentelemetry software and there won't be any harm if they log data to the standard output using print statements. As they are the part of build, test and documentation process of opentelemetry.

  1. scripts/*
  2. **/tests/*
  3. **/examples/*
  4. opentelemetry-instrumentation/src/opentelemetry/instrumentation/bootstrap.py

contributes to opentelemetry-python#4227

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A

This has been tested by running the below command
uv run ruff check

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants