JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.2p0 | CONFIDENTIAL | CodeSecure Inc |
A class is never instantiated, or never used.
Classes that are defined in a project but never used are possibly legacy code, that could be removed or left in the version control system only. This would clean the project and avoid spurious code. Moreover, in some cases an unused class might be the sign of a bug, if the programmer expected it to be used.
Methods or constructors never used in the code are often harmless, except for an increase in size of the application. In some cases, however, unused methods are the sign of a stale application interface that needs cleaning or of the necessity to introduce an abstract method.
| クラス名 | Unused Class (C#) | |||
|---|---|---|---|---|
| 日本語クラス名 | Unused Class (C#) | |||
| クラス分類 | 信頼性 (reliability) | |||
| ニーモニック | CSHARP.STRUCT.UUCLASS | |||
| カテゴリー |
|
|||
| 対応言語 | C# で利用可能です。 |
|||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Unused Class (C#)" |
using System;
namespace DocumentationExamples {
public class UnusedClass {
interface ITask {
void Go();
}
abstract class SubTask : ITask { // "Unused Class (C#)" warning issued here
// - this class is never used in the code and could be removed
private static int goCounter;
void ITask.Go(){
goCounter++;
GoImpl();
}
protected abstract void GoImpl();
protected static int HowManyRuns(){
return goCounter;
}
}
class Tmp : ITask {
void ITask.Go(){
Console.WriteLine("I'm running");
}
};
public static void Main(string[] args){
new Tmp();
}
}
}
For a concrete class, remove the class from the program and simplify the code. If you expected the class to be used, determine why it is not.
For an interface or abstract class, check to see if can be simplified, or if an abstract method could replace a non-abstract method.
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。
To report problems with this documentation, please visit https://support.codesecure.com/.