From 77cdca9204acfe83f661f3d2ce29973c81f17278 Mon Sep 17 00:00:00 2001 From: Roman <78737361+MinTins@users.noreply.github.com> Date: Sun, 22 Mar 2026 19:19:14 +0000 Subject: [PATCH 01/13] lab1: configure SonarCloud CI --- .github/workflows/build.yml | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..798ed10 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: SonarQube +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build and analyze + runs-on: windows-latest + steps: + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: 'zulu' # Alternative distribution options are available. + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Cache SonarQube Cloud packages + uses: actions/cache@v4 + with: + path: ~\sonar\cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache SonarQube Cloud scanner + id: cache-sonar-scanner + uses: actions/cache@v4 + with: + path: ${{ runner.temp }}\scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + - name: Install SonarQube Cloud scanner + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + shell: powershell + run: | + New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory + dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner + - name: Build and analyze + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + shell: powershell + run: | + ${{ runner.temp }}\scanner\dotnet-sonarscanner begin /k:"MinTins_ReengineeringCourse" /o:"roman-flakei" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + dotnet build + ${{ runner.temp }}\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" From 16992a5a3f54689263405564b9ab04929ae6f814 Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 19:32:07 +0000 Subject: [PATCH 02/13] lab1: fix sonarcloud keys, remove build.yml --- .github/workflows/build.yml | 47 -------------------------------- .github/workflows/sonarcloud.yml | 4 +-- 2 files changed, 2 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 798ed10..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: SonarQube -on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened] -jobs: - build: - name: Build and analyze - runs-on: windows-latest - steps: - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: 'zulu' # Alternative distribution options are available. - - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - name: Cache SonarQube Cloud packages - uses: actions/cache@v4 - with: - path: ~\sonar\cache - key: ${{ runner.os }}-sonar - restore-keys: ${{ runner.os }}-sonar - - name: Cache SonarQube Cloud scanner - id: cache-sonar-scanner - uses: actions/cache@v4 - with: - path: ${{ runner.temp }}\scanner - key: ${{ runner.os }}-sonar-scanner - restore-keys: ${{ runner.os }}-sonar-scanner - - name: Install SonarQube Cloud scanner - if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' - shell: powershell - run: | - New-Item -Path ${{ runner.temp }}\scanner -ItemType Directory - dotnet tool update dotnet-sonarscanner --tool-path ${{ runner.temp }}\scanner - - name: Build and analyze - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - shell: powershell - run: | - ${{ runner.temp }}\scanner\dotnet-sonarscanner begin /k:"MinTins_ReengineeringCourse" /o:"roman-flakei" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" - dotnet build - ${{ runner.temp }}\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e784069..e781688 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -56,8 +56,8 @@ jobs: dotnet tool install --global dotnet-sonarscanner echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH dotnet sonarscanner begin ` - /k:"ppanchen_NetSdrClient" ` - /o:"ppanchen" ` + /k:"MinTins_ReengineeringCourse" ` + /o:"mintins" ` /d:sonar.token="${{ secrets.SONAR_TOKEN }}" ` /d:sonar.cs.opencover.reportsPaths="**/coverage.xml" ` /d:sonar.cpd.cs.minimumTokens=40 ` From 7b7ab27809257a250be279b14d99e2934872bc17 Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 19:42:18 +0000 Subject: [PATCH 03/13] lab1: fix sonarcloud keys --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e781688..ceac8b5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -57,7 +57,7 @@ jobs: echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH dotnet sonarscanner begin ` /k:"MinTins_ReengineeringCourse" ` - /o:"mintins" ` + /o:"MinTins" ` /d:sonar.token="${{ secrets.SONAR_TOKEN }}" ` /d:sonar.cs.opencover.reportsPaths="**/coverage.xml" ` /d:sonar.cpd.cs.minimumTokens=40 ` From d186042e0dd8e43334cc5b6f29ad3589a7809631 Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 19:48:10 +0000 Subject: [PATCH 04/13] lab1: fix --- .github/workflows/sonarcloud.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index ceac8b5..4395cf5 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -57,7 +57,7 @@ jobs: echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH dotnet sonarscanner begin ` /k:"MinTins_ReengineeringCourse" ` - /o:"MinTins" ` + /o:"roman-flakei" ` /d:sonar.token="${{ secrets.SONAR_TOKEN }}" ` /d:sonar.cs.opencover.reportsPaths="**/coverage.xml" ` /d:sonar.cpd.cs.minimumTokens=40 ` From 54ab14c5daf0a9a05826edfff8b674f803b02abb Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 20:01:14 +0000 Subject: [PATCH 05/13] lab1: disable qualitygate wait, suppress node deprecation warning --- .github/workflows/sonarcloud.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 4395cf5..514f9ae 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -44,6 +44,8 @@ jobs: runs-on: windows-latest # безпечно для будь-яких .NET проектів steps: - uses: actions/checkout@v4 + env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true with: { fetch-depth: 0 } - uses: actions/setup-dotnet@v4 @@ -63,7 +65,7 @@ jobs: /d:sonar.cpd.cs.minimumTokens=40 ` /d:sonar.cpd.cs.minimumLines=5 ` /d:sonar.exclusions=**/bin/**,**/obj/**,**/sonarcloud.yml ` - /d:sonar.qualitygate.wait=true + /d:sonar.qualitygate.wait=false shell: pwsh # 2) BUILD & TEST - name: Restore From f92d12b26053b35f09e39c80c8d8faec06a1cbc7 Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:10:24 +0000 Subject: [PATCH 06/13] lab2: make _tcpClient readonly --- NetSdrClientApp/NetSdrClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/NetSdrClient.cs b/NetSdrClientApp/NetSdrClient.cs index b0a7c05..cbe55b0 100644 --- a/NetSdrClientApp/NetSdrClient.cs +++ b/NetSdrClientApp/NetSdrClient.cs @@ -14,7 +14,7 @@ namespace NetSdrClientApp { public class NetSdrClient { - private ITcpClient _tcpClient; + private readonly ITcpClient _tcpClient; private IUdpClient _udpClient; public bool IQStarted { get; set; } From 4c83db465a7affb3c0668d45b550a3e949ccfeee Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:13:52 +0000 Subject: [PATCH 07/13] lab2: make _udpClient readonly --- NetSdrClientApp/NetSdrClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/NetSdrClient.cs b/NetSdrClientApp/NetSdrClient.cs index cbe55b0..c4908a6 100644 --- a/NetSdrClientApp/NetSdrClient.cs +++ b/NetSdrClientApp/NetSdrClient.cs @@ -15,7 +15,7 @@ namespace NetSdrClientApp public class NetSdrClient { private readonly ITcpClient _tcpClient; - private IUdpClient _udpClient; + private readonly IUdpClient _udpClient; public bool IQStarted { get; set; } From f1144bc1cf1f83aec945d6f3e7eeaab0a2a3adf0 Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:15:14 +0000 Subject: [PATCH 08/13] lab2: remove empty statement in NetSdrClient --- NetSdrClientApp/NetSdrClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/NetSdrClient.cs b/NetSdrClientApp/NetSdrClient.cs index c4908a6..dbf6cb8 100644 --- a/NetSdrClientApp/NetSdrClient.cs +++ b/NetSdrClientApp/NetSdrClient.cs @@ -66,7 +66,7 @@ public async Task StartIQAsync() return; } -; var iqDataMode = (byte)0x80; + var iqDataMode = (byte)0x80; var start = (byte)0x02; var fifo16bitCaptureMode = (byte)0x01; var n = (byte)1; From 1c999d99f702bf5a1017367e7bd25db1f9a931ac Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:18:03 +0000 Subject: [PATCH 09/13] lab2: discard unused out variables type, code, sequenceNum --- NetSdrClientApp/NetSdrClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/NetSdrClient.cs b/NetSdrClientApp/NetSdrClient.cs index dbf6cb8..fac1c6a 100644 --- a/NetSdrClientApp/NetSdrClient.cs +++ b/NetSdrClientApp/NetSdrClient.cs @@ -116,7 +116,7 @@ public async Task ChangeFrequencyAsync(long hz, int channel) private void _udpClient_MessageReceived(object? sender, byte[] e) { - NetSdrMessageHelper.TranslateMessage(e, out MsgTypes type, out ControlItemCodes code, out ushort sequenceNum, out byte[] body); + NetSdrMessageHelper.TranslateMessage(e, out _, out _, out _, out byte[] body); var samples = NetSdrMessageHelper.GetSamples(16, body); Console.WriteLine($"Samples recieved: " + body.Select(b => Convert.ToString(b, toBase: 16)).Aggregate((l, r) => $"{l} {r}")); From 6642cb929869bf7c487d6def9ef65f4cd6a6775d Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:18:34 +0000 Subject: [PATCH 10/13] lab2: make _host readonly in TcpClientWrapper --- NetSdrClientApp/Networking/TcpClientWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/Networking/TcpClientWrapper.cs b/NetSdrClientApp/Networking/TcpClientWrapper.cs index 1f37e2e..556be58 100644 --- a/NetSdrClientApp/Networking/TcpClientWrapper.cs +++ b/NetSdrClientApp/Networking/TcpClientWrapper.cs @@ -12,7 +12,7 @@ namespace NetSdrClientApp.Networking { public class TcpClientWrapper : ITcpClient { - private string _host; + private readonly string _host; private int _port; private TcpClient? _tcpClient; private NetworkStream? _stream; From 00a7706eca8460f16699539c1c819780e4b2d563 Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:18:54 +0000 Subject: [PATCH 11/13] lab2: make _port readonly in TcpClientWrapper --- NetSdrClientApp/Networking/TcpClientWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/Networking/TcpClientWrapper.cs b/NetSdrClientApp/Networking/TcpClientWrapper.cs index 556be58..737c8ba 100644 --- a/NetSdrClientApp/Networking/TcpClientWrapper.cs +++ b/NetSdrClientApp/Networking/TcpClientWrapper.cs @@ -13,7 +13,7 @@ namespace NetSdrClientApp.Networking public class TcpClientWrapper : ITcpClient { private readonly string _host; - private int _port; + private readonly int _port; private TcpClient? _tcpClient; private NetworkStream? _stream; private CancellationTokenSource _cts; From ccfac4bea511003189135038e340ced00347108b Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:21:55 +0000 Subject: [PATCH 12/13] lab2: remove unused exception variable in OperationCanceledException catch --- NetSdrClientApp/Networking/TcpClientWrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NetSdrClientApp/Networking/TcpClientWrapper.cs b/NetSdrClientApp/Networking/TcpClientWrapper.cs index 737c8ba..49e2a07 100644 --- a/NetSdrClientApp/Networking/TcpClientWrapper.cs +++ b/NetSdrClientApp/Networking/TcpClientWrapper.cs @@ -117,7 +117,7 @@ private async Task StartListeningAsync() } } } - catch (OperationCanceledException ex) + catch (OperationCanceledException) { //empty } From 86430a868fd3424e4e1c946b61b5bf0b74d6e4ed Mon Sep 17 00:00:00 2001 From: Flakei Roman Date: Sun, 22 Mar 2026 21:22:43 +0000 Subject: [PATCH 13/13] lab2: make _cancellationTokenSource readonly in EchoServer --- EchoTcpServer/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EchoTcpServer/Program.cs b/EchoTcpServer/Program.cs index 5966c57..fab6e1f 100644 --- a/EchoTcpServer/Program.cs +++ b/EchoTcpServer/Program.cs @@ -13,7 +13,7 @@ public class EchoServer { private readonly int _port; private TcpListener _listener; - private CancellationTokenSource _cancellationTokenSource; + private readonly CancellationTokenSource _cancellationTokenSource; public EchoServer(int port)