Init
This commit is contained in:
+50
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e69859a6299c144f9abfc102508ec8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "QFSW.QC.ScanRules",
|
||||
"references": [
|
||||
"GUID:fb24642277b1db2449da7ac148ce939d"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8dcd70c80f8cde24a8b189460e9c2a06
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using QFSW.QC.Utilities;
|
||||
|
||||
namespace QFSW.QC.ScanRules
|
||||
{
|
||||
public class QcIgnoreScanRule : IQcScanRule
|
||||
{
|
||||
public ScanRuleResult ShouldScan<T>(T entity) where T : ICustomAttributeProvider
|
||||
{
|
||||
if (entity.HasAttribute<QcIgnoreAttribute>(false))
|
||||
{
|
||||
return ScanRuleResult.Reject;
|
||||
}
|
||||
|
||||
// Allow compiler generated members as this includes backing fields which may be used by the user
|
||||
if (!(entity is MemberInfo) && entity.HasAttribute<CompilerGeneratedAttribute>(true))
|
||||
{
|
||||
return ScanRuleResult.Reject;
|
||||
}
|
||||
|
||||
return ScanRuleResult.Accept;
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8acf993d4de8094da0d60c578420f8e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user