Skip to content

feat(Formatter): Add YAPF Python formatter and refactor#640

Closed
coder3101 wants to merge 18 commits intomasterfrom
add-yapf
Closed

feat(Formatter): Add YAPF Python formatter and refactor#640
coder3101 wants to merge 18 commits intomasterfrom
add-yapf

Conversation

@coder3101
Copy link
Copy Markdown
Member

@coder3101 coder3101 commented Oct 26, 2020

Description

The clang-formatter is able to format code in C/C++/Java but there was
no formatter support for python language. In this commit we add a new
Extensions YAPF Format that can format any valid python code. It also
accepts many configuration that can be set up by user in style.

In addition to this new formatter, the complete formatter code has been refactored.
Notable ideas included in refactoring are as follow:

  • Add a generic code-formatter abstract class that can be used to add new formatters for other languages.
  • Reuse code across formatters.
  • Purge XXXXFormatter::check(), We report error at execution in formatters if any.

Related Issues / Pull Requests

Motivation and Context

To correctly format python codes

How Has This Been Tested?

Arch linux

Screenshots (if appropriate)

Checklist

  • If the key of a setting is changed, the old attribute is updated or it is resolved in SettingsUpdater.
  • If there are changes of the text displayed in the UI, they are wrapped in tr() or QCoreApplication::translate().
  • If needed, I have opened a pull request or an issue to update the documentation.
  • If these changes are notable, they are documented in CHANGELOG.md.

Additional text

Documentation PR at cpeditor/cpeditor.github.io#101

The clang-formatter is able to format code in C/C++/Java but there was
no formatter support for python language. In this commit we add a new
Extensions YAPF Format that can format any valid python code. It also
accepts many configuration that can be set up by user in style.
@coder3101 coder3101 added awaiting for docs Associated PR required to update the docs in cpeditor.github.io awaiting for translation:RU Associated PR is waiting for russian translations to be updated awaiting for translation:CN Associated PR is waiting for chinese translations to be updated labels Oct 26, 2020
@coder3101 coder3101 marked this pull request as draft October 26, 2020 18:55
@coder3101
Copy link
Copy Markdown
Member Author

There is a lot of code common between clang formatter and this formatter, I will try tosomewhow reuse most of the code.

coder3101 and others added 4 commits October 29, 2020 17:43
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coder3101 coder3101 changed the title feat(Formatter): Add YAPF Python code formatter feat & refactor(Formatter): Add YAPF Python code formatter Oct 29, 2020
coder3101 and others added 3 commits October 29, 2020 17:53
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coder3101 coder3101 changed the title feat & refactor(Formatter): Add YAPF Python code formatter feat & refactor(Formatter): Add YAPF Python code formatter and Formatter interface Oct 31, 2020
coder3101 and others added 4 commits October 31, 2020 11:53
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@coder3101
Copy link
Copy Markdown
Member Author

Documentation PR at cpeditor/cpeditor.github.io#101

@coder3101
Copy link
Copy Markdown
Member Author

@IZOBRETATEL777 and @StudyingFather need your help in translating.

@coder3101 coder3101 removed the awaiting for docs Associated PR required to update the docs in cpeditor.github.io label Oct 31, 2020
@coder3101 coder3101 changed the title feat & refactor(Formatter): Add YAPF Python code formatter and Formatter interface feat(Formatter): Add YAPF Python formatter and refactor Oct 31, 2020
@StudyingFather StudyingFather removed the awaiting for translation:CN Associated PR is waiting for chinese translations to be updated label Oct 31, 2020
@coder3101
Copy link
Copy Markdown
Member Author

Closed in favour of #652

@coder3101 coder3101 closed this Nov 1, 2020
@coder3101 coder3101 deleted the add-yapf branch November 1, 2020 09:20
@ouuan ouuan mentioned this pull request Nov 1, 2020
4 tasks
@coder3101 coder3101 removed the awaiting for translation:RU Associated PR is waiting for russian translations to be updated label Nov 9, 2020
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.

3 participants