Skip to content
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

GitAuto: [FEATURE] Add YAML format to the output formats #167

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e64a653
Update BancosBrasileiros.MergeTool/Helpers/Writer.cs.
gitauto-ai[bot] Oct 23, 2024
5484684
Update README.md.
gitauto-ai[bot] Oct 23, 2024
f5a9a70
Update .editorconfig.
gitauto-ai[bot] Oct 23, 2024
c05352b
Update BancosBrasileiros.MergeTool/Program.cs.
gitauto-ai[bot] Oct 23, 2024
e0806f6
Update BancosBrasileiros.MergeTool.Tests/WriterTests.cs.
gitauto-ai[bot] Oct 23, 2024
ac6b95a
Update BancosBrasileiros.MergeTool/BancosBrasileiros.MergeTool.csproj.
gitauto-ai[bot] Oct 23, 2024
9704777
Update BancosBrasileiros.MergeTool.Tests/BancosBrasileiros.MergeTool.…
gitauto-ai[bot] Oct 23, 2024
76e199b
Update .github/workflows/deep-source.yml.
gitauto-ai[bot] Oct 23, 2024
c86ba1d
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 17, 2024
9831ee0
Update deep-source.yml
guibranco Nov 17, 2024
16bc249
Update BancosBrasileiros.MergeTool.Tests.csproj
guibranco Nov 17, 2024
ce0db4a
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 17, 2024
df61f77
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 17, 2024
4d185d0
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 17, 2024
176bee9
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 19, 2024
3c8dd7a
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 20, 2024
c4092e8
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 20, 2024
4356baf
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 20, 2024
a13b39d
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Nov 26, 2024
59e89c2
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Dec 3, 2024
beb9ecd
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Dec 9, 2024
694d280
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Dec 16, 2024
691c879
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Dec 24, 2024
a487c49
Update Program.cs
guibranco Dec 24, 2024
5cb39de
Update README.md
guibranco Dec 24, 2024
8d0fd23
Update .editorconfig
guibranco Dec 24, 2024
ee44ce6
Update BancosBrasileiros.MergeTool.Tests.csproj
guibranco Dec 24, 2024
125d809
Merge branch 'main' into gitauto/issue-#156-b65c0f67-2645-4513-8d04-2…
gstraccini[bot] Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# YAML files
[*.yml]
indent_style = space
[*.{cs,vb}]

# IDE0041: Use 'is null' check
Expand Down Expand Up @@ -86,4 +89,4 @@ csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
1 change: 1 addition & 0 deletions .github/workflows/deep-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Deep Source
on:
push:
branches:
dotnet test BancosBrasileiros.MergeTool.Tests/BancosBrasileiros.MergeTool.Tests.csproj
- main
pull_request:
types: [opened, synchronize, reopened]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions BancosBrasileiros.MergeTool.Tests/WriterTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.IO;
using Xunit;

public class WriterTests
{
[Fact]
public void SaveYaml_CreatesYamlFile()
{
// Arrange
var banks = new List<Bank> { new Bank { Compe = "001", Ispb = "12345678", Document = "00.000.000/0001-91", LongName = "Test Bank", ShortName = "TB" } };
var expectedFilePath = Path.Combine(Directory.GetCurrentDirectory(), "result", "bancos.yml");

// Act
Writer.SaveYaml(banks);

// Assert
Assert.True(File.Exists(expectedFilePath));
var content = File.ReadAllText(expectedFilePath);
Assert.Contains("compe: '001'", content);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<None Include="..\.editorconfig" Link=".editorconfig" />
</ItemGroup>

Expand Down
381 changes: 202 additions & 179 deletions BancosBrasileiros.MergeTool/Helpers/Writer.cs

Large diffs are not rendered by default.

88 changes: 50 additions & 38 deletions BancosBrasileiros.MergeTool/Program.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,50 @@
// ***********************************************************************
// Assembly : BancosBrasileiros.MergeTool
// Author : Guilherme Branco Stracini
// Created : 18/05/2020
//
// Last Modified By : Guilherme Branco Stracini
// Last Modified On : 06-01-2022
// ***********************************************************************
// <copyright file="Program.cs" company="Guilherme Branco Stracini ME">
// Copyright (c) Guilherme Branco Stracini ME. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************

namespace BancosBrasileiros.MergeTool;

using System;
using System.Text;
using Helpers;

/// <summary>
/// Class Program.
/// </summary>
static class Program
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
static void Main()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

Logger.Log("Bancos Brasileiros - Merge tool", ConsoleColor.Cyan);

var worker = new Worker();
worker.Work();
}
}
// ***********************************************************************
// Assembly : BancosBrasileiros.MergeTool
// Author : Guilherme Branco Stracini
// Created : 18/05/2020
//
// Last Modified By : Guilherme Branco Stracini
// Last Modified On : 06-01-2022
// ***********************************************************************
// <copyright file="Program.cs" company="Guilherme Branco Stracini ME">
// Copyright (c) Guilherme Branco Stracini ME. All rights reserved.
static string outputFormat = "json"; // default format

Check failure on line 11 in BancosBrasileiros.MergeTool/Program.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

The modifier 'static' is not valid for this item
// </copyright>
// <summary></summary>
// ***********************************************************************

namespace BancosBrasileiros.MergeTool;

using System;
using System.Text;
using Helpers;

if (args.Length > 0 && args[0].StartsWith("--format="))

Check failure on line 22 in BancosBrasileiros.MergeTool/Program.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

) expected

Check failure on line 22 in BancosBrasileiros.MergeTool/Program.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

A namespace cannot directly contain members such as fields, methods or statements

Check failure on line 22 in BancosBrasileiros.MergeTool/Program.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

Type or namespace definition, or end-of-file expected

Check failure on line 22 in BancosBrasileiros.MergeTool/Program.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

Type or namespace definition, or end-of-file expected

Check failure on line 22 in BancosBrasileiros.MergeTool/Program.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

Type or namespace definition, or end-of-file expected
{
outputFormat = args[0].Split('=')[1];
}

/// <summary>
/// Class Program.
/// </summary>
static class Program
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
static void Main()
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

Logger.Log("Bancos Brasileiros - Merge tool", ConsoleColor.Cyan);

var worker = new Worker();
worker.Work();
}
}
switch (outputFormat.ToLower())

Check failure on line 45 in BancosBrasileiros.MergeTool/Program.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

BancosBrasileiros.MergeTool/Program.cs#L45

Add a 'default' clause to this 'switch' statement.

Check notice on line 45 in BancosBrasileiros.MergeTool/Program.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

BancosBrasileiros.MergeTool/Program.cs#L45

Define the locale to be used in this string operation.

Check notice on line 45 in BancosBrasileiros.MergeTool/Program.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

BancosBrasileiros.MergeTool/Program.cs#L45

Replace this 'switch' statement with 'if' statements to increase readability.
{
case "yaml":
Writer.SaveYaml(banks);
break;
break;
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![time tracker](https://wakatime.com/badge/github/guibranco/BancosBrasileiros-MergeTool.svg)](https://wakatime.com/badge/github/guibranco/BancosBrasileiros-MergeTool)

![Bancos Brasileiros logo](https://raw.githubusercontent.com/guibranco/BancosBrasileiros-MergeTool/main/logo.png)
- To generate YAML output, use the `--format=yaml` or `-f yaml` option.

Check notice on line 11 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L11

Expected: 1; Actual: 2

Check notice on line 11 in README.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

README.md#L11

Lists should be surrounded by blank lines

---

Expand Down
Loading