Skip to content

Refactor converters, add unit tests, and enhance CI workflows - #12

Merged
TheMysteriousStranger90 merged 7 commits into
masterfrom
develop
Jun 2, 2026
Merged

Refactor converters, add unit tests, and enhance CI workflows#12
TheMysteriousStranger90 merged 7 commits into
masterfrom
develop

Conversation

@TheMysteriousStranger90

Copy link
Copy Markdown
Owner

This pull request introduces a comprehensive overhaul of the repository's build, test, and release infrastructure, focusing on modernizing the CI/CD pipeline, enforcing code style consistency, and centralizing configuration. The changes include new GitHub Actions workflows for CI, security scanning, and NuGet publishing, the addition of repository-wide configuration files for code style and package management, and the removal of legacy test files and workflows.

CI/CD Pipeline Modernization

  • Added new GitHub Actions workflows for continuous integration (ci.yml), CodeQL security scanning (codeql.yml), and automated NuGet publishing (nuget-publish.yml). These workflows use .NET 9, run on both pushes and pull requests, and provide build, test, code coverage, and security analysis automation. The NuGet workflow supports both release-triggered and manual publishing with version extraction and artifact upload. [1] [2] [3]
  • Removed the legacy .NET workflow (dotnet.yml) that used GitVersion and .NET 8, consolidating all CI/CD processes into the new, streamlined workflows.
  • Added detailed documentation for the new workflows in .github/WORKFLOWS.md, including setup instructions, requirements, and status badge integration for the README.

Repository Configuration and Code Style

  • Introduced a root .editorconfig file to enforce consistent code formatting, indentation, C# code style, and naming conventions across the repository.
  • Added a .gitattributes file to ensure consistent line endings (CRLF for most files, LF for shell scripts), text/binary file handling, and source file diff configuration.

Build and Dependency Management

  • Added Directory.Build.props to centralize .NET build configuration, targeting .NET 9, enabling nullable reference types, strict warnings, and code analysis settings, with relaxed rules for test and sample projects.
  • Introduced Directory.Packages.props to enable central package version management and specify versions for all core library and test dependencies.

Test Suite Cleanup

  • Removed legacy test files CsvToJsonConverterTests.cs and CsvToPdfConverterTests.cs from the test project, likely in preparation for a new or refactored test suite. [1] [2]

Copilot AI review requested due to automatic review settings June 2, 2026 10:48
@TheMysteriousStranger90 TheMysteriousStranger90 added the enhancement New feature or request label Jun 2, 2026
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@TheMysteriousStranger90
TheMysteriousStranger90 merged commit 3180b7d into master Jun 2, 2026
5 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR is a wide-ranging modernization of the repository: it restructures the project into src/tests/samples, migrates to .NET 9 with Central Package Management, adds new CI/CodeQL/NuGet-publish GitHub Actions workflows, introduces .editorconfig/.gitattributes/Directory.Build.props/Directory.Packages.props, deletes the legacy test suite and replaces it with a much broader NUnit-based test suite, refactors many converters/readers/writers for code-analysis cleanliness (static helpers, InvariantCulture, StringComparison.Ordinal, replacing generic Exception with InvalidDataException/InvalidOperationException), and rewrites the console sample as an interactive demo. FileConverter is also tweaked to hold concrete InMemoryConverter/StreamConverter instances and route all Convert* methods through them.

Changes:

  • New CI/CD: ci.yml, codeql.yml, nuget-publish.yml (+ WORKFLOWS.md), removal of dotnet.yml.
  • Repo structure / config: src/tests/samples layout, Directory.Build.props, Directory.Packages.props, .editorconfig, .gitattributes, updated .gitignore, new nuget.config.
  • Library/test refactor: many converters made static-helper-clean and culture-invariant; XmlToCsvConverter now returns empty CSV instead of throwing on empty input and prepends root-element attributes as columns; CsvToWordConverter/CsvToPdfConverter add a "No data available" message; new comprehensive NUnit tests for every Csv*/Xml* converter.

Reviewed changes

Copilot reviewed 67 out of 87 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.editorconfig, .gitattributes, .gitignore, nuget.config New/updated repo-wide formatting, line-ending, ignore, and NuGet source config.
Directory.Build.props, Directory.Packages.props Centralized build settings (.NET 9, nullable, analyzers) and central package versions.
.github/workflows/{ci,codeql,nuget-publish}.yml, .github/WORKFLOWS.md, removed dotnet.yml New CI, security-scan, and release workflows replacing legacy GitVersion pipeline.
FileConversionLibrary.sln, removed old FileConversionLibrary* projects, new src/, tests/, samples/ projects Solution restructured into src/tests/samples layout.
src/FileConversionLibrary/FileConversionLibrary.csproj New csproj using CPM; v1.8.0; suppresses specific warnings; packs README/icon.
src/FileConversionLibrary/FileConverter.cs Routes file conversions through InMemoryConverter; uses concrete types; reflows long signatures.
src/FileConversionLibrary/Converters/*.cs Many helpers made static; InvariantCulture/Ordinal usages; XmlToCsvConverter adds root-attribute columns and returns empty CSV on empty input; CsvToWord/CsvToPdf add no-data messages; misc cleanup.
src/FileConversionLibrary/Readers/*, Writers/*, Models/*, Interfaces/*, Exceptions/*, Factories/ConverterFactory.cs BOM removal, static helpers, replace Exception with specific exception types, formatting/whitespace cleanup, XmlData/CsvData moved under src/.
tests/FileConversionLibrary.Tests/* New NUnit test project using CPM; broad test coverage for all converters; old tests removed.
samples/FileConversionLibraryConsoleExample/* New interactive sample replacing the old console example.
README.md Reformatted (line-wrap, bullet style) and updated content.
Comments suppressed due to low confidence (2)

src/FileConversionLibrary/Converters/XmlToCsvConverter.cs:326

  • These lines use unnecessarily fully-qualified Linq/collection types (e.g., System.Linq.Enumerable.ToList(System.Linq.Enumerable.Select(...)), System.Collections.Generic.List<System.Xml.Linq.XAttribute>). Since ImplicitUsings is enabled (via Directory.Build.props), using System.Linq; is already available and the rest of this file consistently uses extension-method syntax like input.Headers.Select(...) and new List<...>(). This verbose style is inconsistent with the surrounding code and harder to read.
    src/FileConversionLibrary/Converters/CsvToWordConverter.cs:373
  • The "No data available" paragraph is appended to the body after the (empty) table has already been appended. When Rows.Count == 0, the document will contain both an empty <w:tbl> (with only the header row, if addHeaderRow is true, or completely empty otherwise) and the "No data available" message. Consider either skipping the table append when there are no rows, or moving this check earlier so the table is not added at all in the no-data case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +129 to +130
Assert.That(xml, Does.Contain("1"));
}
var result = _converter.Convert(_simpleXmlData);
var lines = result.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
Assert.That(lines.Length, Is.GreaterThanOrEqualTo(2)); // At least header + 1 row
Assert.That(lines[0], Does.Contain("id")); // Attribute with @ prefix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants