From fee3bd390d39097e57a1b96b158878c752ba4d69 Mon Sep 17 00:00:00 2001 From: khvitaly Date: Wed, 30 Dec 2020 23:15:21 +0200 Subject: [PATCH 1/5] Introduce GH action running official dotnet formatter --- .github/workflows/dotnet-format.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/dotnet-format.yaml diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml new file mode 100644 index 000000000000..e5b48607ec2c --- /dev/null +++ b/.github/workflows/dotnet-format.yaml @@ -0,0 +1,27 @@ +name: dotnet format + +on: + pull_request: + branches: [ master ] + paths: + - '**.cs' + - '.editorconfig' + +jobs: + check-format: + runs-on: windows-latest + + steps: + - name: check out code + uses: actions/checkout@v2 + + - name: Setup .NET Core 3.1 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.x + + - name: Install format tool + run: dotnet tool install -g dotnet-format + + - name: dotnet format + run: dotnet-format --folder --check --verbosity diag From 207f2e88228cd5970961e8aef65f4b15a4b32dd0 Mon Sep 17 00:00:00 2001 From: khvitaly Date: Wed, 30 Dec 2020 23:21:15 +0200 Subject: [PATCH 2/5] invalid var --- .../Selection/RectangleSelection.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Files/UserControls/Selection/RectangleSelection.cs b/Files/UserControls/Selection/RectangleSelection.cs index 69dec3091cf7..9adf23813304 100644 --- a/Files/UserControls/Selection/RectangleSelection.cs +++ b/Files/UserControls/Selection/RectangleSelection.cs @@ -66,45 +66,45 @@ public enum SelectionState Active } - protected void DrawRectangle(PointerPoint currentPoint, Point originDragPointShifted) + protected void DrawRectangle(PointerPoint CurrentPoint, Point originDragPointShifted) { // Redraw selection rectangle according to the new point - if (currentPoint.Position.X >= originDragPointShifted.X) + if (CurrentPoint.Position.X >= originDragPointShifted.X) { - if (currentPoint.Position.Y <= originDragPointShifted.Y) + if (CurrentPoint.Position.Y <= originDragPointShifted.Y) { // Pointer was moved up and right Canvas.SetLeft(selectionRectangle, Math.Max(0, originDragPointShifted.X)); - Canvas.SetTop(selectionRectangle, Math.Max(0, currentPoint.Position.Y)); - selectionRectangle.Width = Math.Max(0, currentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); - selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, currentPoint.Position.Y)); + Canvas.SetTop(selectionRectangle, Math.Max(0, CurrentPoint.Position.Y)); + selectionRectangle.Width = Math.Max(0, CurrentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); + selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, CurrentPoint.Position.Y)); } else { // Pointer was moved down and right Canvas.SetLeft(selectionRectangle, Math.Max(0, originDragPointShifted.X)); Canvas.SetTop(selectionRectangle, Math.Max(0, originDragPointShifted.Y)); - selectionRectangle.Width = Math.Max(0, currentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); - selectionRectangle.Height = Math.Max(0, currentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); + selectionRectangle.Width = Math.Max(0, CurrentPoint.Position.X - Math.Max(0, originDragPointShifted.X)); + selectionRectangle.Height = Math.Max(0, CurrentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); } } else { - if (currentPoint.Position.Y <= originDragPointShifted.Y) + if (CurrentPoint.Position.Y <= originDragPointShifted.Y) { // Pointer was moved up and left - Canvas.SetLeft(selectionRectangle, Math.Max(0, currentPoint.Position.X)); - Canvas.SetTop(selectionRectangle, Math.Max(0, currentPoint.Position.Y)); - selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, currentPoint.Position.X)); - selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, currentPoint.Position.Y)); + Canvas.SetLeft(selectionRectangle, Math.Max(0, CurrentPoint.Position.X)); + Canvas.SetTop(selectionRectangle, Math.Max(0, CurrentPoint.Position.Y)); + selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, CurrentPoint.Position.X)); + selectionRectangle.Height = Math.Max(0, originDragPointShifted.Y - Math.Max(0, CurrentPoint.Position.Y)); } else { // Pointer was moved down and left - Canvas.SetLeft(selectionRectangle, Math.Max(0, currentPoint.Position.X)); + Canvas.SetLeft(selectionRectangle, Math.Max(0, CurrentPoint.Position.X)); Canvas.SetTop(selectionRectangle, Math.Max(0, originDragPointShifted.Y)); - selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, currentPoint.Position.X)); - selectionRectangle.Height = Math.Max(0, currentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); + selectionRectangle.Width = Math.Max(0, originDragPointShifted.X - Math.Max(0, CurrentPoint.Position.X)); + selectionRectangle.Height = Math.Max(0, CurrentPoint.Position.Y - Math.Max(0, originDragPointShifted.Y)); } } } From bbce8a3682f5591d6d12aa1fb6fe92800099ee96 Mon Sep 17 00:00:00 2001 From: Don-Vito Date: Wed, 30 Dec 2020 23:24:59 +0200 Subject: [PATCH 3/5] Update dotnet-format.yaml --- .github/workflows/dotnet-format.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml index e5b48607ec2c..77b74e6cd33a 100644 --- a/.github/workflows/dotnet-format.yaml +++ b/.github/workflows/dotnet-format.yaml @@ -24,4 +24,4 @@ jobs: run: dotnet tool install -g dotnet-format - name: dotnet format - run: dotnet-format --folder --check --verbosity diag + run: dotnet-format --folder --check -w --verbosity diag From f5026c9fd01674b6bbcc686c9e9d359032717330 Mon Sep 17 00:00:00 2001 From: Don-Vito Date: Wed, 30 Dec 2020 23:25:48 +0200 Subject: [PATCH 4/5] Update dotnet-format.yaml --- .github/workflows/dotnet-format.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml index 77b74e6cd33a..6fc8cffffe78 100644 --- a/.github/workflows/dotnet-format.yaml +++ b/.github/workflows/dotnet-format.yaml @@ -24,4 +24,4 @@ jobs: run: dotnet tool install -g dotnet-format - name: dotnet format - run: dotnet-format --folder --check -w --verbosity diag + run: dotnet-format --folder --check -ws --verbosity diag From c82e2d2ebab2e8c1322f3bc7aee9dea633a5ea61 Mon Sep 17 00:00:00 2001 From: Don-Vito Date: Wed, 30 Dec 2020 23:28:47 +0200 Subject: [PATCH 5/5] Update dotnet-format.yaml --- .github/workflows/dotnet-format.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-format.yaml b/.github/workflows/dotnet-format.yaml index 6fc8cffffe78..075c1db4488f 100644 --- a/.github/workflows/dotnet-format.yaml +++ b/.github/workflows/dotnet-format.yaml @@ -24,4 +24,4 @@ jobs: run: dotnet tool install -g dotnet-format - name: dotnet format - run: dotnet-format --folder --check -ws --verbosity diag + run: dotnet-format --folder --check --fix-style --fix-whitespace --verbosity diag