azure-powershell/tools/StaticAnalysis/ReportRecordFactory.cs

81 строка
2.5 KiB
C#
Исходник Постоянная ссылка Обычный вид История

//
// Copyright (c) Microsoft. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using StaticAnalysis.BreakingChangeAnalyzer;
using StaticAnalysis.DependencyAnalyzer;
using StaticAnalysis.HelpAnalyzer;
using StaticAnalysis.SignatureVerifier;
[StaticAnalysis] CI ExampleAnalysis (#18454) * add scriptAnalyzer * test for change cs * test for change both .cs and .md * fix a bug: error when no changed file * fix output of result * test for wrong md * fix import-module * sync up with shiying/ci-example * output by issueChecker * fix the bug for exceptionFilePath * Report errors according to the .csv * Test output of scriptAnalyzer * test * restore * fix bug for module name * fix bug for module name * build dependent-module for md; complete csv; output in one ps1 * illustration for example issue; add suppress; change problemId * Update Program.cs * Update Measure-MarkdownOrScript.ps1 * add suppress function * Delete ExampleAnalyzer.cs * Update ParameterNameAndValue.psm1 fix a bug for not found module name * skip autogenerated example * fix output; output missing errors for placeholders; fix description * fix bugs * Combine install platyPS and PSScriptAnalyzer together into a "Install PowerShell Dependencies" * abandon Jenkins for CI * Apply suggestions from code review Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com> * comment for problemID * Update analyze-steps.yml * use absolute path instead of relative path * output unexcepted error * fix a bug * optimize writing * Update tools/StaticAnalysis/ExampleAnalyzer/utils.ps1 Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com> * change regular expression for exampletitle * restore * change severity * change severity * change comment * match autogenerated examples * fix getting function name Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com>
2022-06-17 12:29:43 +03:00
using StaticAnalysis.ExampleAnalyzer;
using StaticAnalysis.UXMetadataAnalyzer;
using StaticAnalysis.GeneratedSdkAnalyzer;
using System;
using System.Collections.Generic;
using System.Text;
using Tools.Common.Issues;
namespace StaticAnalysis
{
public static class ReportRecordFactory
{
public static IReportRecord Create(string type)
{
if (type.Equals(typeof(BreakingChangeIssue).FullName))
{
return new BreakingChangeIssue();
}
if (type.Equals(typeof(AssemblyVersionConflict).FullName))
{
return new AssemblyVersionConflict();
}
if (type.Equals(typeof(SharedAssemblyConflict).FullName))
{
return new SharedAssemblyConflict();
}
if (type.Equals(typeof(MissingAssembly).FullName))
{
return new MissingAssembly();
}
if (type.Equals(typeof(ExtraAssembly).FullName))
{
return new ExtraAssembly();
}
if (type.Equals(typeof(HelpIssue).FullName))
{
return new HelpIssue();
}
if (type.Equals(typeof(SignatureIssue).FullName))
{
return new SignatureIssue();
}
[StaticAnalysis] CI ExampleAnalysis (#18454) * add scriptAnalyzer * test for change cs * test for change both .cs and .md * fix a bug: error when no changed file * fix output of result * test for wrong md * fix import-module * sync up with shiying/ci-example * output by issueChecker * fix the bug for exceptionFilePath * Report errors according to the .csv * Test output of scriptAnalyzer * test * restore * fix bug for module name * fix bug for module name * build dependent-module for md; complete csv; output in one ps1 * illustration for example issue; add suppress; change problemId * Update Program.cs * Update Measure-MarkdownOrScript.ps1 * add suppress function * Delete ExampleAnalyzer.cs * Update ParameterNameAndValue.psm1 fix a bug for not found module name * skip autogenerated example * fix output; output missing errors for placeholders; fix description * fix bugs * Combine install platyPS and PSScriptAnalyzer together into a "Install PowerShell Dependencies" * abandon Jenkins for CI * Apply suggestions from code review Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com> * comment for problemID * Update analyze-steps.yml * use absolute path instead of relative path * output unexcepted error * fix a bug * optimize writing * Update tools/StaticAnalysis/ExampleAnalyzer/utils.ps1 Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com> * change regular expression for exampletitle * restore * change severity * change severity * change comment * match autogenerated examples * fix getting function name Co-authored-by: Yeming Liu <11371776+isra-fel@users.noreply.github.com>
2022-06-17 12:29:43 +03:00
if (type.Equals(typeof(ExampleIssue).FullName))
{
return new ExampleIssue();
}
if (type.Equals(typeof(UXMetadataIssue).FullName))
{
return new UXMetadataIssue();
}
if (type.Equals(typeof(GeneratedSdkIssue).FullName))
{
return new GeneratedSdkIssue();
}
return null;
}
}
}