This commit is contained in:
Даниил Заикин
2026-06-17 20:44:53 +03:00
parent 9d153773c2
commit b133e7c656
1880 changed files with 244545 additions and 0 deletions
@@ -0,0 +1,50 @@
using System.Reflection;
namespace QFSW.QC.ScanRules
{
public class AssemblyExclusionScanRule : IQcScanRule
{
public ScanRuleResult ShouldScan<T>(T entity) where T : ICustomAttributeProvider
{
if (entity is Assembly assembly)
{
string[] bannedPrefixes = new string[]
{
"System", "Unity", "Microsoft", "Mono.", "mscorlib", "NSubstitute", "JetBrains", "nunit.",
"GeNa."
#if QC_DISABLE_BUILTIN_ALL
, "QFSW.QC"
#elif QC_DISABLE_BUILTIN_EXTRA
, "QFSW.QC.Extra"
#endif
};
string[] bannedAssemblies = new string[]
{
"mcs", "AssetStoreTools",
"Facepunch.Steamworks"
};
string assemblyFullName = assembly.FullName;
foreach (string prefix in bannedPrefixes)
{
if (assemblyFullName.StartsWith(prefix))
{
return ScanRuleResult.Reject;
}
}
string assemblyShortName = assembly.GetName().Name;
foreach (string name in bannedAssemblies)
{
if (assemblyShortName == name)
{
return ScanRuleResult.Reject;
}
}
}
return ScanRuleResult.Accept;
}
}
}