Skip to content

Fix pylint 4.0.4 distro #45006

Open
rads-1996 wants to merge 6 commits intoAzure:mainfrom
rads-1996:fix-pylint-distro
Open

Fix pylint 4.0.4 distro #45006
rads-1996 wants to merge 6 commits intoAzure:mainfrom
rads-1996:fix-pylint-distro

Conversation

@rads-1996
Copy link
Member

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

@github-actions github-actions bot added the Monitor - Distro Monitor OpenTelemetry Distro label Feb 4, 2026
@rads-1996 rads-1996 marked this pull request as ready for review February 5, 2026 21:13
Copilot AI review requested due to automatic review settings February 5, 2026 21:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes pylint 4.0.4 compatibility issues across the azure-monitor-opentelemetry package. The changes address new linting rules by improving code quality through better import ordering, adding necessary encoding specifications, removing unused imports, and adding appropriate pylint disable comments where the warnings are intentional or false positives.

Changes:

  • Removed unused imports and duplicate test methods
  • Standardized import ordering (stdlib → third-party → azure packages)
  • Added encoding='utf-8' parameter to all open() calls
  • Added pylint disable comments for intentional patterns (broad exceptions in samples, unused mock parameters in tests, etc.)
  • Improved code quality (e.g., using context manager for urlopen, renaming unclear parameter names, using sys.exit() instead of exit())

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test_utils.py Removed unused import, added pylint disables for line length and unused arguments
test_configurations.py Reordered imports, removed duplicate test method, added pylint disables
test_configure.py Removed unused imports, added pylint disable for too-many-public-methods
test_psycopg2.py Reordered imports (pytest after stdlib)
test_status_logger.py Added encoding='utf-8' to open() calls
test_diagnostic_logging.py Removed unused import, added encoding, added pylint disables
test_distro.py Added pylint disable for unused-argument
test_configurator.py Removed unused import, added pylint disable
Tracing samples (11 files) Reordered imports, added pylint disables for intentional broad exceptions and other patterns
Django samples (5 files) Import reordering, parameter renames (_request prefix), pylint disables
Metrics samples (5 files) Import reordering, parameter renames (_options prefix), pylint disables
Logging samples (4 files) Import reordering, parameter renames, pylint disables
Authentication samples (2 files) Import reordering
instrumentation.py Added pylint disable for logging warning without debug check
diagnostic_logging.py Added pylint disable for logging error without debug check

Comment on lines +54 to +55
# When configuring sampling via `configure_azure_monitor`, the default sampler is rate limited. To use the classic Application Insights # pylint: disable=line-too-long
# sampler instead, set `sampling_ratio` to 1.0. # pylint: disable=line-too-long
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

The pylint disable comment should not be split across two lines mid-sentence. The comment on line 54 ends abruptly with "Application Insights" followed by a pylint disable, and then line 55 continues the sentence. This makes the comment confusing to read. Consider either keeping the entire comment on one line with the pylint disable at the end, or restructuring to make it clearer.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Distro Monitor OpenTelemetry Distro

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant