File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,7 @@ reported a the [GibHub repository](https://github.com/dotnet-project-file-analyz
173173## Generic
174174* [ ** Proj3000** Only use UTF-8 without BOM] ( rules/Proj3000.md )
175175* [ ** Proj3001** Track uses of "TODO" tags] ( rules/Proj3001.md )
176+ * [ ** Proj3002** Remove commented-out code] ( rules/Proj3002.md )
176177
177178## INI
178179* [ ** Proj4000** Invalid INI file] ( rules/Proj4000.md )
Original file line number Diff line number Diff line change 1+ ---
2+ parent : Generic
3+ ancestor : Rules
4+ ---
5+
6+ # Proj3002: Remove commented-out code
7+ Commented-out code adds noise to a code file and makes it harder to follow the
8+ actual code that should be executed. Comments should be reserved to explain
9+ difficult to understand code or the reason for doing something out of the
10+ ordinary.
11+
12+ For code that is no longer needed, [ version control] ( https://en.wikipedia.org/wiki/Version_control )
13+ should be used instead.
14+
15+ ## Non-compliant
16+ ```
17+ <Project Sdk="Microsoft.NET.Sdk">
18+
19+ <PropertyGroup>
20+ <TargetFramework>net8.0</TargetFramework>
21+ <!-- ImplicitUsings>enable</ImplicitUsings -->
22+ </PropertyGroup>
23+
24+ <ItemGroup>
25+ <!-- Reconsider adding this
26+ <PackageReference Include="DotNetProjectFile.Analyzers" Version="1.5.8" PrivateAssets="all" />
27+ -->
28+ <PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" />
29+ </ItemGroup>
30+
31+ </Project>
32+ ```
33+
34+ ## Compliant
35+ ```
36+ <Project Sdk="Microsoft.NET.Sdk">
37+
38+ <PropertyGroup>
39+ <TargetFramework>net8.0</TargetFramework>
40+ </PropertyGroup>
41+
42+ <ItemGroup>
43+ <PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" />
44+ </ItemGroup>
45+
46+ </Project>
47+ ```
48+
49+ ## Similar rules
50+ This rule has been implemented for C#:
51+ * [ S125] ( https://rules.sonarsource.com/csharp/RSPEC-125 ) (Sonar)
You can’t perform that action at this time.
0 commit comments