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

Remove obsolete files #65

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Overview

A library of SQL best practices implemented as more than 150 [database code analysis rules](https://learn.microsoft.com/sql/tools/sql-database-projects/concepts/sql-code-analysis/sql-code-analysis?view=sql-server-ver15&pivots=sq1-visual-studio-sdk#sql-project-file-sample-and-syntax) checked at build.
A library of SQL best practices implemented as more than 120 [database code analysis rules](https://learn.microsoft.com/sql/tools/sql-database-projects/concepts/sql-code-analysis/sql-code-analysis?view=sql-server-ver15&pivots=sq1-visual-studio-sdk#sql-project-file-sample-and-syntax) checked at build.

The rules can be added as NuGet packages to SQL projects based on either [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) or [Microsoft.Build.Sql](https://github.com/microsoft/DacFx)

Expand Down
22 changes: 0 additions & 22 deletions SqlServer.Rules.Generator/App.config

This file was deleted.

3 changes: 0 additions & 3 deletions SqlServer.Rules.Generator/Directory.Build.props

This file was deleted.

4 changes: 2 additions & 2 deletions SqlServer.Rules.Generator/SqlServer.Rules.Generator.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SqlServer.Rules.Report\SqlServer.Rules.Report.csproj" />
Expand Down
3 changes: 0 additions & 3 deletions SqlServer.Rules.Report/Directory.Build.props

This file was deleted.

3 changes: 2 additions & 1 deletion SqlServer.Rules.Report/Information.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using System;
using System;

namespace SqlServer.Rules.Report;

[Serializable]
public class Information
{
public string Solution { get; set; }

public DateTime ReportDate { get; set; } = DateTime.Now;

public InspectionScope InspectionScope { get; set; }
Expand Down
35 changes: 0 additions & 35 deletions SqlServer.Rules.Report/Properties/AssemblyInfo.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
using System;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SqlServer.Rules.Report;

[Serializable]
public class Report
public class ReportEntity
{
[XmlAttribute]
public string ToolsVersion { get; set; }

public Information Information { get; set; }

#pragma warning disable CA2227 // Collection properties should be read only
public List<IssueType> IssueTypes { get; set; }

public List<RulesProject> Issues { get; set; }

public Report()
#pragma warning restore CA2227 // Collection properties should be read only
public ReportEntity()
{
}

public Report(string solutionName, List<IssueType> issueTypes, string projectName, List<Issue> problems)
public ReportEntity(string solutionName, List<IssueType> issueTypes, string projectName, List<Issue> problems)
{
ToolsVersion = typeof(Report).Assembly.GetName().Version.ToString();
ToolsVersion = typeof(ReportEntity).Assembly.GetName().Version.ToString();
Information = new Information { Solution = $"{solutionName}.sln" };
IssueTypes = issueTypes;
Issues =
Expand Down
8 changes: 4 additions & 4 deletions SqlServer.Rules.Report/ReportFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void Create(ReportRequest request)
SendNotification($"Running rules complete, elapsed: {sw.Elapsed.ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture)}");

// create report object
var report = new Report(
var report = new ReportEntity(
request.Solution,
GetIssueTypes(service.GetRules(), request.SuppressIssueTypes).ToList(),
request.FileName,
Expand Down Expand Up @@ -192,9 +192,9 @@ private static IEnumerable<Issue> GetProblems(IEnumerable<SqlRuleProblem> proble
};
}

private static void SerializeReport(Report report, string outputPath)
private static void SerializeReport(ReportEntity report, string outputPath)
{
var serializer = new XmlSerializer(typeof(Report));
var serializer = new XmlSerializer(typeof(ReportEntity));
var ns = new XmlSerializerNamespaces([new XmlQualifiedName(string.Empty, string.Empty)]);
var xmlSettings = new XmlWriterSettings
{
Expand All @@ -209,7 +209,7 @@ private static void SerializeReport(Report report, string outputPath)
}
}

private static void SerializeReportToCSV(Report report, string outputPath)
private static void SerializeReportToCSV(ReportEntity report, string outputPath)
{
var sb = new StringBuilder();
sb.AppendLine("Issue Id,Message,Line/Offset,File Name");
Expand Down
2 changes: 2 additions & 0 deletions SqlServer.Rules.Report/ReportRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace SqlServer.Rules.Report;
public class ReportRequest
{
public string Solution { get; set; }

public string InputPath { get; set; }

public string SolutionName
Expand All @@ -17,6 +18,7 @@ public string SolutionName
public string OutputDirectory { get; set; } = string.Empty;

private string outputFileName;

public string OutputFileName
{
get
Expand Down
4 changes: 3 additions & 1 deletion SqlServer.Rules.Report/RulesProject.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

Expand All @@ -12,5 +12,7 @@ public class RulesProject
public string Name { get; set; }

[XmlElement(ElementName = "Issue")]
#pragma warning disable CA2227 // Collection properties should be read only
public List<Issue> Issues { get; set; }
#pragma warning restore CA2227 // Collection properties should be read only
}
4 changes: 2 additions & 2 deletions SqlServer.Rules.Report/SqlServer.Rules.Report.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup>
<SatelliteResourceLanguages>en-US</SatelliteResourceLanguages>
<NeutralLanguage>en-US</NeutralLanguage>
</PropertyGroup>
<ItemGroup>
<Content Include="Resources\RulesTransform.xslt" />
Expand Down
16 changes: 10 additions & 6 deletions SqlServer.Rules.Test/Docs/DocsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,7 @@ private static void GenerateRuleMarkdown(TypeComments comments, List<string> ele

if (comments?.FullCommentText != null)
{
var fullXml = "<comments>" + comments.FullCommentText.Trim() + "</comments>";
var fullComments = new XmlDocument();
fullComments.LoadXml(fullXml);
var fullComments = LoadXml(comments);

isIgnorable = fullComments.SelectSingleNode("comments/IsIgnorable")?.InnerText ?? "false";
friendlyName = fullComments.SelectSingleNode("comments/FriendlyName")?.InnerText;
Expand Down Expand Up @@ -271,9 +269,7 @@ private static void GenerateTocMarkdown(List<Type> sqlServerRules, List<string>

if (comments?.FullCommentText != null)
{
var fullXml = "<comments>" + comments.FullCommentText.Trim() + "</comments>";
var fullComments = new XmlDocument();
fullComments.LoadXml(fullXml);
var fullComments = LoadXml(comments);

isIgnorable = fullComments.SelectSingleNode("comments/IsIgnorable")?.InnerText ?? "No";
friendlyName = fullComments.SelectSingleNode("comments/FriendlyName")?.InnerText;
Expand Down Expand Up @@ -315,6 +311,14 @@ private static void GenerateTocMarkdown(List<Type> sqlServerRules, List<string>
File.WriteAllText(Path.Combine(docsFolder, "table_of_contents.md"), stringBuilder.ToString(), Encoding.UTF8);
}

private static XmlDocument LoadXml(TypeComments comments)
{
var fullXml = "<comments>" + comments.FullCommentText.Trim() + "</comments>";
var fullComments = new XmlDocument();
fullComments.LoadXml(fullXml);
return fullComments;
}

private static Dictionary<string, List<string>> CollectRuleScripts(string rulesScriptFolder)
{
var ruleScripts = new Dictionary<string, List<string>>();
Expand Down
21 changes: 0 additions & 21 deletions SqlServer.Rules/LICENSE

This file was deleted.

Loading