XFEExtension
【DLL】XFE各类拓展是一个C#的DLL库,旨在优化C#代码中常用语句的使用,并提供更简洁的访问方式,同时提供Xunit测试框架,快速搭建服务器/客户端,免费ChatGPTAPI接口,免费通讯服务器,XFE下载器,新增格式等
关注
0
Fork
0
Star
0
返回提交历史
Modified
XFEExtension.NetCore.Analyzer/AnalyzerReleases.Unshipped.md
+1
-0
Modified
XFEExtension.NetCore.Analyzer/Diagnostics/ProfileExtensionDiagnostics.cs
+13
-5
XFEstudio/XFEExtension
修改版号为2.1.0
f3289dd
代码差异
2 个文件
+14
-5
@@ -6,4 +6,5 @@
6
6
Rule ID | Category | Severity | Notes
7
7
--------|----------|----------|-------
8
8
XFE0002 | XFEExtension.NetCore.Analyzer.Diagnostics | Error | ProfileExtensionDiagnostics, [Documentation](https://www.xfegzs.com/codespace/diagnostics/XFE0002.html)
9
XFE0003 | XFEExtension.NetCore.Analyzer.Diagnostics | Error | ProfileExtensionDiagnostics, [Documentation](https://www.xfegzs.com/codespace/diagnostics/XFE0003.html)
9
10
XFW0001 | XFEExtension.NetCore.Analyzer.Diagnostics | Warning | ProfileExtensionDiagnostics, [Documentation](https://www.xfegzs.com/codespace/diagnostics/XFW0001.html)
@@ -5,17 +5,16 @@ using Microsoft.CodeAnalysis.Diagnostics;
5
5
using System.Collections.Immutable;
6
6
using System.Linq;
7
7
using System.Text.RegularExpressions;
8
using XFEExtension.NetCore.Analyzer.CodeFix;
9
8
using XFEExtension.NetCore.Analyzer.Generator;
10
using static System.Net.Mime.MediaTypeNames;
11
12
9
namespace XFEExtension.NetCore.Analyzer.Diagnostics
13
10
{
14
11
[DiagnosticAnalyzer(LanguageNames.CSharp)]
15
12
public class ProfileExtensionDiagnostics : DiagnosticAnalyzer
16
13
{
17
14
public const string AddGetNoResultErrorId = "XFE0002";
15
public const string PropertyOrFieldNotStaticId = "XFE0003";
18
16
public const string AddSetNoSetResultWarningId = "XFW0001";
17
19
18
public static readonly DiagnosticDescriptor AddGetNoResultError = new DiagnosticDescriptor(AddGetNoResultErrorId,
20
19
"Get方法没有返回值",
21
20
"设置了自定义的Get方法但是没有返回值:'{0}'",
@@ -24,6 +23,7 @@ namespace XFEExtension.NetCore.Analyzer.Diagnostics
24
23
true,
25
24
"设置了自定义的Get方法但是没有返回值.",
26
25
"https://www.xfegzs.com/codespace/diagnostics/XFE0002.html");
26
27
27
public static readonly DiagnosticDescriptor AddSetNoSetResultWarning = new DiagnosticDescriptor(AddSetNoSetResultWarningId,
28
28
"Set方法没有设置值",
29
29
"设置了自定义的Set方法但是没有对实际字段进行操作:'{0}'",
@@ -33,8 +33,16 @@ namespace XFEExtension.NetCore.Analyzer.Diagnostics
33
33
"设置了自定义的Set方法但是没有对实际字段进行操作.",
34
34
"https://www.xfegzs.com/codespace/diagnostics/XFW0001.html");
35
35
36
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(AddGetNoResultError, AddSetNoSetResultWarning);
36
public static readonly DiagnosticDescriptor PropertyOrFieldNotStatic = new DiagnosticDescriptor(PropertyOrFieldNotStaticId,
37
"配置属性或字段不是静态的",
38
"配置类的{0}不是静态的:'{1}'",
39
"XFEExtension.NetCore.Analyzer.Diagnostics",
40
DiagnosticSeverity.Error,
41
true,
42
"配置类的属性或字段不是静态的.",
43
"https://www.xfegzs.com/codespace/diagnostics/XFE0003.html");
37
44
45
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(AddGetNoResultError, AddSetNoSetResultWarning, PropertyOrFieldNotStatic);
38
46
39
47
public override void Initialize(AnalysisContext context)
40
48
{
@@ -47,7 +55,7 @@ namespace XFEExtension.NetCore.Analyzer.Diagnostics
47
55
foreach (var syntaxTree in context.Compilation.SyntaxTrees)
48
56
{
49
57
var root = syntaxTree.GetRoot();
50
foreach (var classDeclaration in ProfilePropertyAutoGenerator.GetClassDeclarations(root))
58
foreach (var classDeclaration in root.DescendantNodes().OfType<ClassDeclarationSyntax>())
51
59
{
52
60
foreach (var fieldDeclaration in ProfilePropertyAutoGenerator.GetFieldDeclarations(classDeclaration))
53
61
{