Skip to content

feat(linter): Adapter for docformatter#129

Merged
justinchuby merged 5 commits intojustinchuby:mainfrom
Sebastian-Larsson:main
Jan 12, 2026
Merged

feat(linter): Adapter for docformatter#129
justinchuby merged 5 commits intojustinchuby:mainfrom
Sebastian-Larsson:main

Conversation

@Sebastian-Larsson
Copy link
Copy Markdown
Contributor

@justinchuby
Copy link
Copy Markdown
Owner

Comment thread lintrunner_adapters/adapters/docformatter_linter.py Fixed
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Fixed
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Fixed
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Fixed
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Fixed
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Fixed
@Sebastian-Larsson
Copy link
Copy Markdown
Contributor Author

Thank you for the comment @justinchuby! Please have another look when you have time 😄

Comment thread examples/adapters/docformatter_linter/.lintrunner.toml Fixed
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Copy link
Copy Markdown
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 PR adds a new adapter for docformatter, a Python docstring formatter, to the lintrunner_adapters collection. The implementation follows the general structure of other formatters in the codebase but has several deviations from established patterns that should be addressed.

  • Implements a docformatter adapter with configuration support
  • Uses docformatter's --diff output with the patch command to obtain reformatted code
  • Includes an example lintrunner configuration file

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 11 comments.

File Description
lintrunner_adapters/adapters/docformatter_linter.py New adapter implementation for docformatter with check_file and main functions, includes multi-threaded execution support
examples/adapters/docformatter_linter/.lintrunner.toml Example configuration file demonstrating docformatter integration with lintrunner

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lintrunner_adapters/adapters/docformatter_linter.py
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
justinchuby and others added 2 commits December 12, 2025 17:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@justinchuby
Copy link
Copy Markdown
Owner

Could you check the copilot comments and ensure consistency with the other linter adapters? Thanks

@justinchuby justinchuby requested a review from Copilot December 15, 2025 16:53
Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Sebastian-Larsson
Copy link
Copy Markdown
Contributor Author

Hello @justinchuby, I hope you enjoyed the holidays!

Just wanted to check if you're happy with the changes I've made?

@justinchuby
Copy link
Copy Markdown
Owner

Thanks for the reminder!

Copy link
Copy Markdown
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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lintrunner_adapters/adapters/docformatter_linter.py
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Comment thread lintrunner_adapters/adapters/docformatter_linter.py Outdated
Using docformatter with stdin results in the replacement being output
"raw" to stdout. This is perfect since the raw output is exactly what we
want "replacement" to be.

This changes errors handling as the return code is now always 0,
regardless of if there was a change or not.

Also add error handling for decoding utf-8.
@justinchuby
Copy link
Copy Markdown
Owner

Thanks for updating! I’m glad you found a way to return the whole file.

@justinchuby justinchuby merged commit f7378d8 into justinchuby:main Jan 12, 2026
25 checks passed
@justinchuby
Copy link
Copy Markdown
Owner

@Sebastian-Larsson do you plan to make additional changes, or would you like me to make a release?

@Sebastian-Larsson
Copy link
Copy Markdown
Contributor Author

@justinchuby we're planning on making at least one more contribution. I think that PR should come up this week. So you can hold off and wait for that if you'd like!

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.

4 participants