Skip to content

refactor: remove redundant pylint disable from celery instrumentation#3839

Merged
lzchen merged 19 commits into
open-telemetry:mainfrom
forafox:cleanup/remove-pylint-disable-celery
May 7, 2026
Merged

refactor: remove redundant pylint disable from celery instrumentation#3839
lzchen merged 19 commits into
open-telemetry:mainfrom
forafox:cleanup/remove-pylint-disable-celery

Conversation

@forafox
Copy link
Copy Markdown
Contributor

@forafox forafox commented Oct 13, 2025

Description

This PR removes the redundant pylint: disable=attribute-defined-outside-init comment from the celery instrumentation and adds this rule to the global pylint disable list in .pylintrc.

The attribute-defined-outside-init pylint rule is problematic for OpenTelemetry instrumentations because attributes are commonly set during instrumentation (in methods like _instrument()) rather than in __init__. This pattern is used throughout the codebase (30+ occurrences) and is a standard practice for OpenTelemetry instrumentations where attributes are initialized during the instrumentation process.

By disabling this rule globally, we eliminate the need for individual pylint: disable comments across the codebase, making the code cleaner and more maintainable.

Fixes #3828

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Verified that the celery instrumentation file compiles without syntax errors
  • Confirmed that the pylint disable comment has been completely removed from celery instrumentation
  • Verified that attribute-defined-outside-init has been added to the global pylint disable list
  • Ran pylint checks to ensure no new warnings are introduced

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@forafox forafox requested a review from a team as a code owner October 13, 2025 17:47
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Oct 13, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@forafox forafox closed this Oct 13, 2025
@forafox forafox reopened this Oct 13, 2025
@forafox forafox force-pushed the cleanup/remove-pylint-disable-celery branch from e00110a to d501764 Compare October 14, 2025 15:59
@xrmx xrmx moved this to Reviewed PRs that need fixes in Python PR digest Oct 15, 2025
Copy link
Copy Markdown
Contributor

@xrmx xrmx left a comment

Choose a reason for hiding this comment

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

If we are going to move this globally I would expect the other 30 occurences of the pylint disable to move removed too. Said that the lint warning may be useful in other cases.

@forafox forafox force-pushed the cleanup/remove-pylint-disable-celery branch from d501764 to 985b02f Compare October 15, 2025 21:43
@forafox
Copy link
Copy Markdown
Contributor Author

forafox commented Oct 15, 2025

If we are going to move this globally I would expect the other 30 occurences of the pylint disable to move removed too. Said that the lint warning may be useful in other cases.

Pull request updated
@xrmx

@forafox forafox requested a review from xrmx October 15, 2025 23:31
@tammy-baylis-swi
Copy link
Copy Markdown
Contributor

Please also do tox -e precommit on your local then push changes to address some formatting stuff.

@forafox
Copy link
Copy Markdown
Contributor Author

forafox commented Dec 9, 2025

Please also do tox -e precommit on your local then push changes to address some formatting stuff.

@tammy-baylis-swi

Hi! Thanks for the feedback — I’ve addressed the formatting issues
Everything should be fixed now

Copy link
Copy Markdown
Contributor

@tammy-baylis-swi tammy-baylis-swi left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm! Others will also review

@xrmx xrmx moved this from Reviewed PRs that need fixes to Easy to review / merge / close in Python PR digest Dec 22, 2025
@tammy-baylis-swi
Copy link
Copy Markdown
Contributor

Please also add a Changelog entry.

@MikeGoldsmith MikeGoldsmith moved this from Easy to review / merge / close to Approved PRs that need fixes in Python PR digest Feb 27, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Mar 13, 2026
@forafox forafox requested a review from MikeGoldsmith March 17, 2026 13:45
@forafox
Copy link
Copy Markdown
Contributor Author

forafox commented Mar 17, 2026

@tammy-baylis-swi Hi!
Everything should be fixed now

@github-actions github-actions Bot removed the Stale label Mar 18, 2026
Copy link
Copy Markdown
Contributor

@tammy-baylis-swi tammy-baylis-swi left a comment

Choose a reason for hiding this comment

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

Lgtm again, a Maintainer (not me) will have to merge. Please resolve the latest merge conflict.

forafox added 4 commits March 21, 2026 13:05
…lery' into cleanup/remove-pylint-disable-celery
- Add missing `Instrument` import in botocore __init__.py
- Fix PLC0207 string split in boto3sqs __init__.py
@forafox
Copy link
Copy Markdown
Contributor Author

forafox commented Mar 21, 2026

Lgtm again, a Maintainer (not me) will have to merge. Please resolve the latest merge conflict.
@tammy-baylis-swi
Everything should be fixed now

Copy link
Copy Markdown
Member

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Thanks @forafox 🚀

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Apr 14, 2026
@tammy-baylis-swi tammy-baylis-swi moved this from Approved PRs that need fixes to Approved PRs in Python PR digest Apr 14, 2026
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 days of this comment.
If you're still working on this, please add a comment or push new commits.

@github-actions github-actions Bot added the Stale label Apr 29, 2026
@aabmass aabmass enabled auto-merge (squash) May 7, 2026 15:46
@aabmass aabmass moved this from Approved PRs to Ready for merge in Python PR digest May 7, 2026
@xrmx xrmx disabled auto-merge May 7, 2026 15:55
@lzchen lzchen enabled auto-merge (squash) May 7, 2026 17:22
@lzchen lzchen merged commit db84ba5 into open-telemetry:main May 7, 2026
753 checks passed
@github-project-automation github-project-automation Bot moved this from Ready for merge to Done in Python PR digest May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Remove pylint: disable=attribute-defined-outside-init use from celery instrumentation

6 participants