Compare commits

...

5 Commits

Author SHA1 Message Date
Lauro Moura ba4bc8ae05 Start re-enabling some warnings after fixes 2019-12-06 14:07:38 -03:00
Lauro Moura e0cf0301b1 csharp: Ignore all warnings individually
Make it easier to be working on each one
2019-12-06 14:07:38 -03:00
Lauro Moura 9d406f939e csharp: Analyze test code too 2019-12-06 14:07:38 -03:00
Lauro Moura 6622dc568e Lets silence some rules 2019-12-06 14:07:38 -03:00
Lauro Moura 6b2c25f177 csharp: Add StyleCop support to dotnet build
Summary:
This patch builds on top of D9717 by adding support to run the StyleCop
rules (It imported the initial ruleset from P278 in
src/bindings/mono/ca.ruleset).

Depends on D9717

Reviewers: Jaehyun_Cho, YOhoho, woohyun

Subscribers: cedric, brunobelo, felipealmeida, #reviewers, segfaultxavi, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D10433
2019-12-06 14:07:38 -03:00
4 changed files with 341 additions and 1 deletions

View File

@ -0,0 +1,328 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="CustomRulset" Description="Custom Rulset" ToolsVersion="14.0">
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<!-- Do not declare static members on Generic Types -->
<Rule Id="CA1000" Action="None"/>
<!-- Consider making Raise an event -->
<Rule Id="CA1030" Action="None"/>
<!-- Catch generic exception -->
<Rule Id="CA1031" Action="None"/>
<!-- Add extra exception constructors -->
<Rule Id="CA1032" Action="Warning"/>
<!-- Do not nest NativeTypes -->
<Rule Id="CA1034" Action="None"/>
<!-- IComparable must implement other comparison operators -->
<Rule Id="CA1036" Action="None"/>
<!-- Avoid empty interface -->
<Rule Id="CA1040" Action="Warning"/>
<!-- Consider making property with getter -->
<Rule Id="CA1044" Action="None"/>
<!-- Visible instance fields -->
<Rule Id="CA1051" Action="None"/>
<!-- Static holder can be static -->
<Rule Id="CA1052" Action="None"/>
<!-- Using parameters before checking for null -->
<Rule Id="CA1062" Action="None"/>
<!-- Remove IDisposable as Object already has it -->
<Rule Id="CA1063" Action="Warning"/>
<!-- Exceptions must be public -->
<Rule Id="CA1064" Action="Warning"/>
<!-- Do not raise exception in unexpected locations -->
<Rule Id="CA1065" Action="None"/>
<!-- String localization -->
<Rule Id="CA1303" Action="None"/>
<!-- Specify IFormatProvider -->
<Rule Id="CA1305" Action="None"/>
<!-- Specify Stringcomparison -->
<Rule Id="CA1307" Action="Warning"/>
<!-- PInvoke should not be visible -->
<Rule Id="CA1401" Action="Warning"/>
<!-- Use nameof -->
<Rule Id="CA1507" Action="None"/>
<!-- Parameter underscore -->
<Rule Id="CA1707" Action="None"/>
<!-- Attribute classes must have the Attribute Suffix -->
<Rule Id="CA1710" Action="None"/>
<!-- Replace generic parameter with T -->
<Rule Id="CA1715" Action="None"/>
<!-- Parameter End conflicts with VB -->
<Rule Id="CA1716" Action="None"/>
<!-- Enum field must be plural -->
<Rule Id="CA1717" Action="Warning"/>
<!-- Variable has type name -->
<Rule Id="CA1720" Action="None"/>
<!-- Property with same name as getter -->
<Rule Id="CA1721" Action="None"/>
<!-- Type name must not match namespace -->
<Rule Id="CA1724" Action="None"/>
<!-- Unused parameter. Lots of warnings regarding Dispose(disposing) -->
<Rule Id="CA1801" Action="None"/>
<!-- Do not ignore function result -->
<Rule Id="CA1806" Action="None"/>
<!-- Remove static constructors -->
<Rule Id="CA1810" Action="None"/>
<!-- Realized classes are never instantiated -->
<Rule Id="CA1812" Action="None"/>
<!-- Override equal and operator equal on Value Types-->
<Rule Id="CA1815" Action="Warning"/>
<!-- Dispose must call SuppressFinalizers -->
<Rule Id="CA1816" Action="Warning"/>
<!-- Member can be static -->
<Rule Id="CA1822" Action="None"/>
<!-- Consider zero length array allocation -->
<Rule Id="CA1825" Action="Warning"/>
<!-- Use Count instead of Count() -->
<Rule Id="CA1829" Action="Warning"/>
<!-- Call dispose before going out of scope -->
<Rule Id="CA2000" Action="None"/>
<!-- Call ConfigureWait-->
<Rule Id="CA2007" Action="Warning"/>
<!-- PInvoke should specify string marshalling -->
<Rule Id="CA2101" Action="None"/>
<!-- Rethrow loses stack info -->
<Rule Id="CA2200" Action="Warning"/>
<!-- Declare static fields when they are declared and remove static constructor -->
<Rule Id="CA2207" Action="Warning"/>
<!-- Instantiate exception params correctly -->
<Rule Id="CA2208" Action="Warning"/>
<!-- Dot not call overrideable methods in constructors -->
<Rule Id="CA2214" Action="None"/>
<!-- Replace implicit operator -->
<Rule Id="CA2225" Action="Warning"/>
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- Ignore docs -->
<Rule Id="SA0001" Action="None"/>
<!-- 10** Spacing rules -->
<Rule Id="SA1000" Action="None"/>
<Rule Id="SA1001" Action="None"/>
<Rule Id="SA1002" Action="None"/>
<Rule Id="SA1003" Action="None"/>
<!-- Documentation must start with single space -->
<Rule Id="SA1004" Action="None"/>
<Rule Id="SA1005" Action="None"/>
<Rule Id="SA1006" Action="None"/>
<Rule Id="SA1007" Action="None"/>
<Rule Id="SA1008" Action="None"/>
<Rule Id="SA1009" Action="None"/>
<Rule Id="SA1010" Action="None"/>
<Rule Id="SA1011" Action="None"/>
<Rule Id="SA1012" Action="None"/>
<Rule Id="SA1013" Action="None"/>
<Rule Id="SA1014" Action="None"/>
<Rule Id="SA1015" Action="None"/>
<Rule Id="SA1016" Action="None"/>
<Rule Id="SA1017" Action="None"/>
<Rule Id="SA1018" Action="None"/>
<Rule Id="SA1019" Action="None"/>
<Rule Id="SA1020" Action="None"/>
<Rule Id="SA1021" Action="None"/>
<Rule Id="SA1022" Action="None"/>
<Rule Id="SA1023" Action="None"/>
<Rule Id="SA1024" Action="None"/>
<Rule Id="SA1025" Action="None"/>
<Rule Id="SA1026" Action="None"/>
<Rule Id="SA1027" Action="None"/>
<Rule Id="SA1028" Action="None"/>
<!-- Readability -->
<Rule Id="SA1100" Action="None"/>
<Rule Id="SA1101" Action="None"/>
<Rule Id="SA1102" Action="None"/>
<Rule Id="SA1103" Action="None"/>
<Rule Id="SA1104" Action="None"/>
<Rule Id="SA1105" Action="None"/>
<Rule Id="SA1106" Action="None"/>
<Rule Id="SA1107" Action="None"/>
<Rule Id="SA1108" Action="None"/>
<Rule Id="SA1109" Action="None"/>
<Rule Id="SA1110" Action="None"/>
<Rule Id="SA1111" Action="None"/>
<Rule Id="SA1112" Action="None"/>
<Rule Id="SA1113" Action="None"/>
<Rule Id="SA1114" Action="None"/>
<Rule Id="SA1115" Action="None"/>
<Rule Id="SA1116" Action="None"/>
<Rule Id="SA1117" Action="None"/>
<Rule Id="SA1118" Action="None"/>
<Rule Id="SA1119" Action="None"/>
<Rule Id="SA1120" Action="None"/>
<Rule Id="SA1121" Action="None"/>
<Rule Id="SA1122" Action="None"/>
<Rule Id="SA1123" Action="None"/>
<Rule Id="SA1124" Action="None"/>
<Rule Id="SA1125" Action="None"/>
<Rule Id="SA1126" Action="None"/>
<Rule Id="SA1127" Action="None"/>
<Rule Id="SA1128" Action="None"/>
<Rule Id="SA1129" Action="None"/>
<Rule Id="SA1130" Action="None"/>
<Rule Id="SA1131" Action="None"/>
<Rule Id="SA1132" Action="None"/>
<Rule Id="SA1133" Action="None"/>
<Rule Id="SA1134" Action="None"/>
<Rule Id="SA1135" Action="None"/>
<Rule Id="SA1136" Action="None"/>
<Rule Id="SA1137" Action="None"/>
<Rule Id="SA1138" Action="None"/>
<Rule Id="SA1139" Action="None"/>
<!-- 12** Ordering -->
<!-- FIXME Check if this somehow affects docfx output -->
<Rule Id="SA1200" Action="None"/>
<Rule Id="SA1201" Action="None"/>
<Rule Id="SA1202" Action="None"/>
<Rule Id="SA1203" Action="None"/>
<Rule Id="SA1204" Action="None"/>
<Rule Id="SA1205" Action="None"/>
<Rule Id="SA1206" Action="None"/>
<Rule Id="SA1207" Action="None"/>
<Rule Id="SA1208" Action="None"/>
<Rule Id="SA1209" Action="None"/>
<Rule Id="SA1210" Action="None"/>
<Rule Id="SA1211" Action="None"/>
<Rule Id="SA1212" Action="None"/>
<Rule Id="SA1213" Action="None"/>
<Rule Id="SA1214" Action="None"/>
<Rule Id="SA1215" Action="None"/>
<Rule Id="SA1216" Action="None"/>
<Rule Id="SA1217" Action="None"/>
<!-- 13** Naming Rules -->
<!-- Element start with upper case -->
<Rule Id="SA1300" Action="None"/>
<Rule Id="SA1301" Action="None"/>
<!-- Interface start with I -->
<Rule Id="SA1302" Action="None"/>
<!-- Upper/lower score rules -->
<Rule Id="SA1303" Action="None"/>
<Rule Id="SA1304" Action="None"/>
<Rule Id="SA1305" Action="None"/>
<Rule Id="SA1306" Action="None"/>
<Rule Id="SA1307" Action="None"/>
<!-- Variable field prefixes -->
<Rule Id="SA1308" Action="None"/>
<Rule Id="SA1309" Action="None"/>
<Rule Id="SA1310" Action="None"/>
<Rule Id="SA1311" Action="None"/>
<Rule Id="SA1312" Action="None"/> <!-- Variables, not part of public API -->
<Rule Id="SA1313" Action="None"/>
<Rule Id="SA1314" Action="None"/>
<!-- 14** Maintainability -->
<!-- Access modifier -->
<Rule Id="SA1400" Action="None"/>
<!-- Field must be private -->
<Rule Id="SA1401" Action="None"/>
<!-- File Must contain single class or namespace -->
<Rule Id="SA1402" Action="None"/>
<Rule Id="SA1403" Action="None"/>
<!-- CodeAnalysis suppress does not have justification -->
<Rule Id="SA1404" Action="None"/>
<!-- Debug.Assert/Fail must provide a message -->
<Rule Id="SA1405" Action="None"/>
<Rule Id="SA1406" Action="None"/>
<!-- Arithmetic/Conditional expression must declare precedence -->
<Rule Id="SA1407" Action="None"/>
<Rule Id="SA1408" Action="None"/>
<!-- Remove unecessary code -->
<Rule Id="SA1409" Action="None"/>
<!-- Delegate/Attribute parentheses -->
<Rule Id="SA1410" Action="None"/>
<Rule Id="SA1411" Action="None"/>
<!-- Utf8 file -->
<Rule Id="SA1412" Action="None"/>
<!-- Trailing commas multiline initializer -->
<Rule Id="SA1413" Action="None"/>
<!-- 15** Layout Rules -->
<Rule Id="SA1500" Action="None"/>
<Rule Id="SA1501" Action="None"/>
<Rule Id="SA1502" Action="None"/>
<Rule Id="SA1503" Action="None"/>
<Rule Id="SA1504" Action="None"/>
<Rule Id="SA1505" Action="None"/>
<Rule Id="SA1506" Action="None"/>
<Rule Id="SA1507" Action="None"/>
<Rule Id="SA1508" Action="None"/>
<Rule Id="SA1509" Action="None"/>
<Rule Id="SA1510" Action="None"/>
<Rule Id="SA1511" Action="None"/>
<Rule Id="SA1512" Action="None"/>
<Rule Id="SA1513" Action="None"/>
<Rule Id="SA1514" Action="None"/>
<Rule Id="SA1515" Action="None"/>
<Rule Id="SA1516" Action="None"/>
<Rule Id="SA1517" Action="None"/>
<Rule Id="SA1518" Action="None"/>
<Rule Id="SA1519" Action="None"/>
<Rule Id="SA1520" Action="None"/>
<!-- 16** Documentation rules -->
<!-- Things must be documented -->
<Rule Id="SA1600" Action="None"/>
<Rule Id="SA1601" Action="None"/>
<Rule Id="SA1602" Action="None"/>
<!-- Valid xml in docs -->
<Rule Id="SA1603" Action="None"/>
<Rule Id="SA1604" Action="None"/>
<Rule Id="SA1605" Action="None"/>
<Rule Id="SA1606" Action="None"/>
<Rule Id="SA1607" Action="None"/>
<Rule Id="SA1608" Action="None"/>
<Rule Id="SA1609" Action="None"/>
<Rule Id="SA1610" Action="None"/>
<Rule Id="SA1611" Action="None"/>
<Rule Id="SA1612" Action="None"/>
<Rule Id="SA1613" Action="None"/>
<Rule Id="SA1614" Action="None"/>
<Rule Id="SA1615" Action="None"/>
<Rule Id="SA1616" Action="None"/>
<Rule Id="SA1617" Action="None"/>
<Rule Id="SA1618" Action="None"/>
<Rule Id="SA1619" Action="None"/>
<Rule Id="SA1620" Action="None"/>
<Rule Id="SA1621" Action="None"/>
<Rule Id="SA1622" Action="None"/>
<Rule Id="SA1623" Action="None"/>
<Rule Id="SA1624" Action="None"/>
<Rule Id="SA1625" Action="None"/> <!-- Copy paste doc. May be problematic with generated code -->
<Rule Id="SA1626" Action="None"/>
<Rule Id="SA1627" Action="None"/>
<Rule Id="SA1628" Action="None"/>
<Rule Id="SA1629" Action="None"/>
<Rule Id="SA1630" Action="None"/>
<Rule Id="SA1631" Action="None"/>
<Rule Id="SA1632" Action="None"/>
<!-- File headers -->
<Rule Id="SA1633" Action="None"/>
<Rule Id="SA1634" Action="None"/>
<Rule Id="SA1635" Action="None"/>
<Rule Id="SA1636" Action="None"/>
<Rule Id="SA1637" Action="None"/>
<Rule Id="SA1638" Action="None"/>
<Rule Id="SA1639" Action="None"/>
<Rule Id="SA1640" Action="None"/>
<Rule Id="SA1641" Action="None"/>
<!-- Constructor/Destructor -->
<Rule Id="SA1642" Action="None"/>
<Rule Id="SA1643" Action="None"/>
<!-- File header -->
<Rule Id="SA1644" Action="None"/>
<!-- Miscellaneous doc -->
<Rule Id="SA1645" Action="None"/>
<Rule Id="SA1646" Action="None"/>
<Rule Id="SA1647" Action="None"/>
<Rule Id="SA1648" Action="None"/>
<!-- Filename must match file type -->
<Rule Id="SA1649" Action="None"/>
<!-- Spelling -->
<Rule Id="SA1650" Action="None"/>
<!-- Placeholder -->
<Rule Id="SA1651" Action="None"/>
</Rules>
</RuleSet>

View File

@ -41,4 +41,13 @@
<Compile Include="./*.cs" />
</ItemGroup>
<!-- Code style configuration -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
</ItemGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>@BINDING_SRC@/ca.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
</Project>

View File

@ -173,7 +173,7 @@ if (get_option('dotnet'))
configuration: lib_csproj_conf_data)
efl_mono = custom_target('efl_mono',
input: mono_generator_target + mono_files + [efl_src] + [lib_csproj],
input: mono_generator_target + mono_files + [efl_src] + [lib_csproj] + ['ca.ruleset'],
output: 'efl_sharp.dll',
build_by_default: true,
command: [dotnet,

View File

@ -19,6 +19,9 @@
<ItemGroup>
<ProjectReference Include="../../bindings/mono/efl_sharp.csproj" />
</ItemGroup>
<PropertyGroup>
<CodeAnalysisRuleSet>@BINDING_TEST_SRC@/../../bindings/mono/ca.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Compile Include="@BINDING_TEST_SRC@/*.cs" />