From 140a5b3b2173828ce2ac6cf954f6b0a5811f64d9 Mon Sep 17 00:00:00 2001 From: Rudy Huyn Date: Sat, 9 Mar 2019 08:09:51 -0800 Subject: [PATCH 1/2] add .editorconfig to set some basic coding styles (#225) To maintain consistent code style between contributors and simplify merging, the solution should provide a .editorconfig to set some basic rules (already used by the current code source). - use `UTF-8` with BOM (some files are without) - use CR-LF - use Space to indent (sorry #teamTab) - trim trailing whitespace - be sure to add a new line at the end of files. [Documentation](https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2017) --- src/.editorconfig | 11 +++++++++++ src/Calculator.sln | 1 + 2 files changed, 12 insertions(+) create mode 100644 src/.editorconfig diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 00000000..9a13de81 --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*.{xaml,cpp,h}] +charset = utf-8-bom +indent_style = space +indent_size = 4 +end_of_line = crlf + +[*.{cpp,h}] +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/src/Calculator.sln b/src/Calculator.sln index 2d36a93f..2a6989f1 100644 --- a/src/Calculator.sln +++ b/src/Calculator.sln @@ -9,6 +9,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcManager", "CalcManager\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A5DF651-B8A1-45CA-9135-964A6FC7F5D1}" ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig nuget.config = nuget.config EndProjectSection EndProject From a98cb50a70a2961402b8fc8005b9cbbeed6c5472 Mon Sep 17 00:00:00 2001 From: Shamkhal Maharramov <9804406+Maharramoff@users.noreply.github.com> Date: Sat, 9 Mar 2019 20:16:05 +0400 Subject: [PATCH 2/2] fix: redundant semicolons (#230) ### Description of the changes: - Remove redundant semicolons in: - [x] UnitConverter.cpp - [x] DateCalculator.xaml.cpp - [x] CopyPasteManagerTest.cpp ### How changes were validated: - Manual --- src/CalcManager/UnitConverter.cpp | 4 ++-- src/Calculator/Views/DateCalculator.xaml.cpp | 2 +- src/CalculatorUnitTests/CopyPasteManagerTest.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/CalcManager/UnitConverter.cpp b/src/CalcManager/UnitConverter.cpp index 07f75d33..e30934f4 100644 --- a/src/CalcManager/UnitConverter.cpp +++ b/src/CalcManager/UnitConverter.cpp @@ -302,8 +302,8 @@ wstring UnitConverter::Serialize() out << std::to_wstring(m_currentHasDecimal) << delimiter << std::to_wstring(m_returnHasDecimal) << delimiter << std::to_wstring(m_switchedActive) << delimiter; out << m_currentDisplay << delimiter << m_returnDisplay << delimiter << "|"; wstringstream categoryString(wstringstream::out); - wstringstream categoryToUnitString(wstringstream::out);; - wstringstream unitToUnitToDoubleString(wstringstream::out);; + wstringstream categoryToUnitString(wstringstream::out); + wstringstream unitToUnitToDoubleString(wstringstream::out); for (const Category& c : m_categories) { categoryString << CategoryToString(c, delimiter) << ","; diff --git a/src/Calculator/Views/DateCalculator.xaml.cpp b/src/Calculator/Views/DateCalculator.xaml.cpp index 0df8cd3e..574ad4b5 100644 --- a/src/Calculator/Views/DateCalculator.xaml.cpp +++ b/src/Calculator/Views/DateCalculator.xaml.cpp @@ -46,7 +46,7 @@ DateCalculator::DateCalculator() // Set Calendar Identifier DateDiff_FromDate->CalendarIdentifier = localizationSettings.GetCalendarIdentifier(); - DateDiff_ToDate->CalendarIdentifier = localizationSettings.GetCalendarIdentifier();; + DateDiff_ToDate->CalendarIdentifier = localizationSettings.GetCalendarIdentifier(); // Setting the FirstDayofWeek DateDiff_FromDate->FirstDayOfWeek = localizationSettings.GetFirstDayOfWeek(); diff --git a/src/CalculatorUnitTests/CopyPasteManagerTest.cpp b/src/CalculatorUnitTests/CopyPasteManagerTest.cpp index 2e90d845..9f3afc93 100644 --- a/src/CalculatorUnitTests/CopyPasteManagerTest.cpp +++ b/src/CalculatorUnitTests/CopyPasteManagerTest.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #include "pch.h" @@ -34,7 +34,7 @@ namespace CalculatorUnitTests #define ASSERT_NEGATIVE_TESTCASES(func, dataSet) \ {\ - int size = sizeof(dataSet)/sizeof(*dataSet);;\ + int size = sizeof(dataSet)/sizeof(*dataSet);\ while(--size)\ {\ VERIFY_ARE_EQUAL(func(dataSet[size]), StringReference(L"NoOp"));\