-
Notifications
You must be signed in to change notification settings - Fork 590
Apply clang-format #6799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply clang-format #6799
Conversation
consider committing the tools separate from the re-format. |
good call |
I think we shouldn't delete diff --git a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/TextParsingTest.cpp b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/TextParsingTest.cpp
index bc7c8afc3..fd02fdeed 100644
--- a/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/TextParsingTest.cpp
+++ b/source/shared/cpp/AdaptiveCardsSharedModel/AdaptiveCardsSharedModelUnitTest/TextParsingTest.cpp
@@ -7,49 +7,40 @@ using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace AdaptiveCards;
using namespace std::string_literals;
-namespace AdaptiveCardsSharedModelUnitTest
-{
- TEST_CLASS(TextParsingTests)
- {
- public:
- TEST_METHOD(HtmlEncodingPositiveTest)
- {
- const std::string textBlockText = _GetTextBlockText("\"Foo & Bar\" <[email protected]>");
- const std::string expectedText = "\"Foo & Bar\" <[email protected]>";
- Assert::AreEqual(expectedText, textBlockText, L"Make sure supported HTML entities are decoded");
- }
+namespace AdaptiveCardsSharedModelUnitTest {
+TEST_CLASS(TextParsingTests){public : TEST_METHOD(HtmlEncodingPositiveTest){
+ const std::string textBlockText = _GetTextBlockText("\"Foo & Bar\" <[email protected]>");
+const std::string expectedText = "\"Foo & Bar\" <[email protected]>";
+Assert::AreEqual(expectedText, textBlockText, L"Make sure supported HTML entities are decoded");
+} // namespace AdaptiveCardsSharedModelUnitTest
- TEST_METHOD(HtmlEncodingAmpTest)
- {
- // we should be doing a single pass through HTML character encoding, so the resulting " " below
- // shouldn't be further decoded to " "
- const std::string textBlockText = _GetTextBlockText("&nbsp;");
- Assert::AreEqual(" "s, textBlockText);
- }
+TEST_METHOD(HtmlEncodingAmpTest)
+{
+ // we should be doing a single pass through HTML character encoding, so the resulting " " below
+ // shouldn't be further decoded to " "
+ const std::string textBlockText = _GetTextBlockText("&nbsp;");
+ Assert::AreEqual(" "s, textBlockText);
+}
- // Test for strings that should roundtrip without modification
- TEST_METHOD(HtmlEncodingRoundtripTests)
- {
- const std::vector<std::string> testStrings =
- {
- "some test text",
- "&foo;",
- "&am p;"
- };
+// Test for strings that should roundtrip without modification
+TEST_METHOD(HtmlEncodingRoundtripTests)
+{
+ const std::vector<std::string> testStrings = {"some test text", "&foo;", "&am p;"};
- for (const auto& testString : testStrings)
- {
- const std::string textBlockText = _GetTextBlockText(testString);
- Assert::AreEqual(testString, textBlockText);
- }
- }
+ for (const auto& testString : testStrings)
+ {
+ const std::string textBlockText = _GetTextBlockText(testString);
+ Assert::AreEqual(testString, textBlockText);
+ }
+}
- private:
- std::string _GetTextBlockText(const std::string& testString)
- {
- TextBlock textBlock;
- textBlock.SetText(testString);
- return textBlock.GetText();
- }
- };
+private:
+std::string _GetTextBlockText(const std::string& testString)
+{
+ TextBlock textBlock;
+ textBlock.SetText(testString);
+ return textBlock.GetText();
+}
+}
+;
} |
Co-authored-by: Paul Campbell <[email protected]>
Co-authored-by: Paul Campbell <[email protected]>
This reverts commit 700de21.
This reverts commit 700de21.
fix typo update clang.format.json
Co-authored-by: Paul Campbell <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: almedina-ms <[email protected]>
defer the decision to remove clang-format npmjs
* draft * update readme * format project * update pipeline * revert change on ios * revert change on PerfApp because it's C++/CX project and ^ is not well supported * update local vs version and make BasedOnStyle:Microsoft * disable pipeline check and revert change on formatted files * remove .h, .cpp from .editorconfig * Apply suggestions from code review Co-authored-by: Paul Campbell <[email protected]> * Update .clang-format Co-authored-by: Paul Campbell <[email protected]> * enable hooks and recover clang-format hook * rollback to cpp11 * format files * Revert "format files" This reverts commit 700de21. * Revert "format files" This reverts commit 700de21. * add clang-format-launcher fix typo update clang.format.json * clang-format exception * update documents * add npm run format to error * update package-lock * add pipeline to check the format and create patch file if failed * update echo message * move clang.format.json to package.json * address comments * Deleting outdated VsCode extension (microsoft#6831) * provide crossplatform hooks * Update scripts/hooks/clangFormatFunc Co-authored-by: Paul Campbell <[email protected]> * address comment * limit error number * update clang-format-launcher version * Update .clang-format Co-authored-by: almedina-ms <[email protected]> Co-authored-by: Paul Campbell <[email protected]> Co-authored-by: Vsevolod <[email protected]> Co-authored-by: Jonathan Miller <[email protected]> Co-authored-by: almedina-ms <[email protected]>
* draft * update readme * format project * update pipeline * revert change on ios * revert change on PerfApp because it's C++/CX project and ^ is not well supported * update local vs version and make BasedOnStyle:Microsoft * disable pipeline check and revert change on formatted files * remove .h, .cpp from .editorconfig * Apply suggestions from code review Co-authored-by: Paul Campbell <[email protected]> * Update .clang-format Co-authored-by: Paul Campbell <[email protected]> * enable hooks and recover clang-format hook * rollback to cpp11 * format files * Revert "format files" This reverts commit 700de21. * Revert "format files" This reverts commit 700de21. * add clang-format-launcher fix typo update clang.format.json * clang-format exception * update documents * add npm run format to error * update package-lock * add pipeline to check the format and create patch file if failed * update echo message * move clang.format.json to package.json * address comments * Deleting outdated VsCode extension (microsoft#6831) * provide crossplatform hooks * Update scripts/hooks/clangFormatFunc Co-authored-by: Paul Campbell <[email protected]> * address comment * limit error number * update clang-format-launcher version * Update .clang-format Co-authored-by: almedina-ms <[email protected]> Co-authored-by: Paul Campbell <[email protected]> Co-authored-by: Vsevolod <[email protected]> Co-authored-by: Jonathan Miller <[email protected]> Co-authored-by: almedina-ms <[email protected]>
Fix #6658
Enforce the pipeline to check the clang-format.
User has four options to format files and apply clang-format correctly:
npm run format
in source/nodejspowershell -ExecutionPolicy Bypass scripts\FormatSource.ps1 -ModifiedOnly $False
in project root foldergit apply downloadedfile
clang-format 12.0.0 or above is required.
FormatSource.ps1 used clang-format which is built into visual studio by default. so please update visual studio if you see clang-format is still 10.0
npmjs installed clang-format 14.0 automatically, so you only need to make
npm install
is run beforenpm run format
For Windows user, here is the process(a derivative of microsoft/MixedReality-GraphicsTools-Unreal)
Error example:
violations on pipeline:

About .clang-format, refer to https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Note: In this PR, pipeline check is disabled and files will be formatted in another PR.
If you want to review the difference between the formatted files and unformatted files, you can check
8d03136
Microsoft Reviewers: Open in CodeFlow