Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Auto-formatter to keep the same coding style#20356

Merged
szha merged 8 commits intoapache:v1.xfrom
mozga-intel:mozga-intel/coding_style_google_formatter
Jul 16, 2021
Merged

Auto-formatter to keep the same coding style#20356
szha merged 8 commits intoapache:v1.xfrom
mozga-intel:mozga-intel/coding_style_google_formatter

Conversation

@mozga-intel
Copy link
Copy Markdown
Contributor

@mozga-intel mozga-intel commented Jun 16, 2021

Description

This pull-request contains changes associated with a coding style.
Contains:

  1. src/operator/nn/mkldnn/
  2. include/mxnet/ndarray.h
  3. src/ndarray/ndarray.cc
  4. src/operator/operator_common.h
  5. src/operator/quantization/mkldnn/
  6. src/operator/subgraph/mkldnn/
  7. src/operator/tensor/amp_cast.cc
  8. src/operator/tensor/cast_storage-inl.h
  9. tests/cpp/include/test_mkldnn.h
  10. tests/cpp/operator/mkldnn_operator_test

.clang-format file:

---
Language: Cpp
BasedOnStyle: Google
ColumnLimit: 100
#AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
DerivePointerAlignment: false
SortIncludes: true
MaxEmptyLinesToKeep: 1
PointerAlignment: Left
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false

Checklist

Essentials

  • PR's title starts with a category (e.g. [BUGFIX], [MODEL], [TUTORIAL], [FEATURE], [DOC], etc)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@mxnet-bot
Copy link
Copy Markdown

Hey @mozga-intel , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [miscellaneous, centos-gpu, website, clang, unix-gpu, windows-gpu, sanity, unix-cpu, edge, windows-cpu, centos-cpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress labels Jun 16, 2021
@mozga-intel
Copy link
Copy Markdown
Contributor Author

@mxnet-bot run ci [unix-cpu, centos-cpu, unix-gpu]

@mxnet-bot
Copy link
Copy Markdown

Jenkins CI successfully triggered : [centos-cpu, unix-gpu, unix-cpu]

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Jun 16, 2021
@mozga-intel
Copy link
Copy Markdown
Contributor Author

@mxnet-bot run ci [unix-cpu, centos-cpu, unix-gpu]

@mxnet-bot
Copy link
Copy Markdown

Jenkins CI successfully triggered : [centos-cpu, unix-cpu, unix-gpu]

@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test pr-work-in-progress PR is still work in progress and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Jun 17, 2021
@mozga-intel mozga-intel force-pushed the mozga-intel/coding_style_google_formatter branch from 6884eba to 69ca096 Compare June 18, 2021 08:50
@mseth10 mseth10 added pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-work-in-progress PR is still work in progress labels Jun 18, 2021
@mseth10 mseth10 added pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test and removed pr-work-in-progress PR is still work in progress pr-awaiting-testing PR is reviewed and waiting CI build and test labels Jun 30, 2021
@mozga-intel
Copy link
Copy Markdown
Contributor Author

@mxnet-bot run ci [centos-gpu, unix-cpu, unix-gpu]

@mxnet-bot
Copy link
Copy Markdown

Jenkins CI successfully triggered : [unix-cpu, unix-gpu, centos-gpu]

@mozga-intel
Copy link
Copy Markdown
Contributor Author

@mxnet-bot run ci [windows-cpu , windows-gpu, unix-cpu]

@mxnet-bot
Copy link
Copy Markdown

Jenkins CI successfully triggered : [windows-gpu, unix-cpu, windows-cpu]

@szha
Copy link
Copy Markdown
Member

szha commented Jul 1, 2021

Thanks for putting in the work for formatting the code for consistency. In order to keep the code nicely formatted, I think it would be worthwhile to automate the formatting and style checking. Do you have suggestions or plan in that regard?

Copy link
Copy Markdown
Contributor

@sfraczek sfraczek left a comment

Choose a reason for hiding this comment

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

LGTM

@mozga-intel
Copy link
Copy Markdown
Contributor Author

mozga-intel commented Jul 9, 2021

@szha Thanks for a quick answer!

Proposition

Python

For a python, we can try to use the Flake8 tool. This tool might be used to perform additional formatting and semantic checking of code. For our machine, we can use hooks or pre-commit tools to run checker before commit. Please have a look at #20429 (proposition

C++

We can use the clang-format tool to perform additional formatting and semantic checking of code. Please have a look at #20433

Problem

I think that we need to run those scripts to get the same standard in the project.

Further consideration

Should these tools be run also on a CI?

@sfraczek
Copy link
Copy Markdown
Contributor

In the last commit what are the changes something in .clang-format config?

@mozga-intel
Copy link
Copy Markdown
Contributor Author

@sfraczek Yes, please have a look at the description: a few things were added such as BinPackArguments/Params...

@mozga-intel
Copy link
Copy Markdown
Contributor Author

@mxnet-bot run ci [unix-gpu]

@mxnet-bot
Copy link
Copy Markdown

Jenkins CI successfully triggered : [unix-gpu]

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

Labels

pr-awaiting-review PR is waiting for code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants