Set all checkers class "final"
This commit is contained in:
parent
ab0ac1be43
commit
8c44dd5092
|
@ -12,7 +12,7 @@ import dscanner.analysis.base;
|
|||
/**
|
||||
* Checks for uses of the old alias syntax.
|
||||
*/
|
||||
class AliasSyntaxCheck : BaseAnalyzer
|
||||
final class AliasSyntaxCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ if (param < 0)
|
|||
}
|
||||
------------
|
||||
*/
|
||||
class AllManCheck : BaseAnalyzer
|
||||
final class AllManCheck : BaseAnalyzer
|
||||
{
|
||||
///
|
||||
this(string fileName, const(Token)[] tokens, bool skipTests = false)
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_ : Scope;
|
|||
* Checks for confusing asm expressions.
|
||||
* See_also: $(LINK https://issues.dlang.org/show_bug.cgi?id=9738)
|
||||
*/
|
||||
class AsmStyleCheck : BaseAnalyzer
|
||||
final class AsmStyleCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import std.algorithm;
|
|||
/**
|
||||
* Check that all asserts have an explanatory message.
|
||||
*/
|
||||
class AssertWithoutMessageCheck : BaseAnalyzer
|
||||
final class AssertWithoutMessageCheck : BaseAnalyzer
|
||||
{
|
||||
enum string KEY = "dscanner.style.assert_without_msg";
|
||||
enum string MESSAGE = "An assert should have an explanatory message";
|
||||
|
|
|
@ -12,7 +12,7 @@ import dscanner.analysis.base;
|
|||
/**
|
||||
* Checks for assignment to auto-ref function parameters.
|
||||
*/
|
||||
class AutoRefAssignmentCheck : BaseAnalyzer
|
||||
final class AutoRefAssignmentCheck : BaseAnalyzer
|
||||
{
|
||||
///
|
||||
this(string fileName, bool skipTests = false)
|
||||
|
|
|
@ -27,7 +27,7 @@ import std.algorithm : map;
|
|||
* }
|
||||
* ---
|
||||
*/
|
||||
class BuiltinPropertyNameCheck : BaseAnalyzer
|
||||
final class BuiltinPropertyNameCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import dsymbol.scope_;
|
|||
/**
|
||||
* Check for uses of the comma expression.
|
||||
*/
|
||||
class CommaExpressionCheck : BaseAnalyzer
|
||||
final class CommaExpressionCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import dscanner.analysis.base;
|
|||
import dscanner.analysis.helpers;
|
||||
import dsymbol.scope_ : Scope;
|
||||
|
||||
class ConstructorCheck : BaseAnalyzer
|
||||
final class ConstructorCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import dsymbol.scope_;
|
|||
/**
|
||||
* Checks for use of the deprecated 'delete' keyword
|
||||
*/
|
||||
class DeleteCheck : BaseAnalyzer
|
||||
final class DeleteCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import dsymbol.scope_ : Scope;
|
|||
* Checks for duplicate attributes such as @property, @safe,
|
||||
* @trusted, @system, pure, and nothrow
|
||||
*/
|
||||
class DuplicateAttributeCheck : BaseAnalyzer
|
||||
final class DuplicateAttributeCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ void doNothing(string, size_t, size_t, string, bool)
|
|||
{
|
||||
}
|
||||
|
||||
class EnumArrayLiteralCheck : BaseAnalyzer
|
||||
final class EnumArrayLiteralCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import std.stdio;
|
|||
/**
|
||||
* Requires unittests to be explicitly annotated with either @safe or @system
|
||||
*/
|
||||
class ExplicitlyAnnotatedUnittestCheck : BaseAnalyzer
|
||||
final class ExplicitlyAnnotatedUnittestCheck : BaseAnalyzer
|
||||
{
|
||||
enum string KEY = "dscanner.style.explicitly_annotated_unittest";
|
||||
enum string MESSAGE = "A unittest should be annotated with at least @safe or @system";
|
||||
|
|
|
@ -15,7 +15,7 @@ import dsymbol.scope_ : Scope;
|
|||
/**
|
||||
* Checks for use of the deprecated floating point comparison operators.
|
||||
*/
|
||||
class FloatOperatorCheck : BaseAnalyzer
|
||||
final class FloatOperatorCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import dsymbol.scope_;
|
|||
* const int getStuff() {}
|
||||
* ---
|
||||
*/
|
||||
class FunctionAttributeCheck : BaseAnalyzer
|
||||
final class FunctionAttributeCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import std.stdio;
|
|||
* Checks for public declarations without a documented unittests.
|
||||
* For now, variable and enum declarations aren't checked.
|
||||
*/
|
||||
class HasPublicExampleCheck : BaseAnalyzer
|
||||
final class HasPublicExampleCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import std.range;
|
|||
/**
|
||||
Checks whether all if constraints have the same indention as their declaration.
|
||||
*/
|
||||
class IfConstraintsIndentCheck : BaseAnalyzer
|
||||
final class IfConstraintsIndentCheck : BaseAnalyzer
|
||||
{
|
||||
///
|
||||
this(string fileName, const(Token)[] tokens, bool skipTests = false)
|
||||
|
|
|
@ -10,7 +10,7 @@ import dparse.formatter;
|
|||
import dscanner.analysis.base;
|
||||
import dsymbol.scope_ : Scope;
|
||||
|
||||
class IfStatementCheck : BaseAnalyzer
|
||||
final class IfStatementCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
this(string fileName, const(Scope)* sc, bool skipTests = false)
|
||||
|
|
|
@ -20,7 +20,7 @@ import dsymbol.scope_ : Scope;
|
|||
* $(LI == expressions where the left and right are the same)
|
||||
* )
|
||||
*/
|
||||
class IfElseSameCheck : BaseAnalyzer
|
||||
final class IfElseSameCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import std.stdio;
|
|||
/**
|
||||
* Checks the sortedness of module imports
|
||||
*/
|
||||
class ImportSortednessCheck : BaseAnalyzer
|
||||
final class ImportSortednessCheck : BaseAnalyzer
|
||||
{
|
||||
enum string KEY = "dscanner.style.imports_sortedness";
|
||||
enum string MESSAGE = "The imports are not sorted in alphabetical order";
|
||||
|
|
|
@ -13,7 +13,7 @@ import dparse.lexer;
|
|||
/**
|
||||
* Checks for incorrect infinite range definitions
|
||||
*/
|
||||
class IncorrectInfiniteRangeCheck : BaseAnalyzer
|
||||
final class IncorrectInfiniteRangeCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import dscanner.analysis.helpers;
|
|||
/**
|
||||
* Checks for labels and variables that have the same name.
|
||||
*/
|
||||
class LabelVarNameCheck : BaseAnalyzer
|
||||
final class LabelVarNameCheck : BaseAnalyzer
|
||||
{
|
||||
this(string fileName, const(Scope)* sc, bool skipTests = false)
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ import dparse.ast;
|
|||
import dparse.lexer;
|
||||
import dscanner.analysis.base;
|
||||
|
||||
class LambdaReturnCheck : BaseAnalyzer
|
||||
final class LambdaReturnCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_;
|
|||
/**
|
||||
* Checks for subtraction from a .length property. This is usually a bug.
|
||||
*/
|
||||
class LengthSubtractionCheck : BaseAnalyzer
|
||||
final class LengthSubtractionCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import std.typecons : tuple, Tuple;
|
|||
/**
|
||||
* Checks for lines longer than 120 characters
|
||||
*/
|
||||
class LineLengthCheck : BaseAnalyzer
|
||||
final class LineLengthCheck : BaseAnalyzer
|
||||
{
|
||||
///
|
||||
this(string fileName, const(Token)[] tokens, bool skipTests = false)
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_;
|
|||
* Checks for local imports that import all symbols.
|
||||
* See_also: $(LINK https://issues.dlang.org/show_bug.cgi?id=10378)
|
||||
*/
|
||||
class LocalImportCheck : BaseAnalyzer
|
||||
final class LocalImportCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import dsymbol.scope_;
|
|||
* if (a && (b || c)) // good
|
||||
* ---
|
||||
*/
|
||||
class LogicPrecedenceCheck : BaseAnalyzer
|
||||
final class LogicPrecedenceCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_ : Scope;
|
|||
/**
|
||||
* Checks for long and hard-to-read number literals
|
||||
*/
|
||||
class NumberStyleCheck : BaseAnalyzer
|
||||
final class NumberStyleCheck : BaseAnalyzer
|
||||
{
|
||||
public:
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
|
|
@ -17,7 +17,7 @@ import dsymbol.scope_ : Scope;
|
|||
* Checks that opEquals, opCmp, toHash, 'opCast', and toString are either const,
|
||||
* immutable, or inout.
|
||||
*/
|
||||
class ObjectConstCheck : BaseAnalyzer
|
||||
final class ObjectConstCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_ : Scope;
|
|||
* Checks for when a class/struct has the method opEquals without toHash, or
|
||||
* toHash without opEquals.
|
||||
*/
|
||||
class OpEqualsWithoutToHashCheck : BaseAnalyzer
|
||||
final class OpEqualsWithoutToHashCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import dsymbol.scope_ : Scope;
|
|||
* }
|
||||
* ---
|
||||
*/
|
||||
class PokemonExceptionCheck : BaseAnalyzer
|
||||
final class PokemonExceptionCheck : BaseAnalyzer
|
||||
{
|
||||
enum MESSAGE = "Catching Error or Throwable is almost always a bad idea.";
|
||||
enum string KEY = "dscanner.suspicious.catch_em_all";
|
||||
|
|
|
@ -21,7 +21,7 @@ import std.stdio;
|
|||
- Ddoc params entries without a parameter trigger warnings as well
|
||||
- RETURNS: (except if it's void, only functions)
|
||||
*/
|
||||
class ProperlyDocumentedPublicFunctions : BaseAnalyzer
|
||||
final class ProperlyDocumentedPublicFunctions : BaseAnalyzer
|
||||
{
|
||||
enum string MISSING_PARAMS_KEY = "dscanner.style.doc_missing_params";
|
||||
enum string MISSING_PARAMS_MESSAGE = "Parameter %s isn't documented in the `Params` section.";
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_ : Scope;
|
|||
* Checks for .. expressions where the left side is larger than the right. This
|
||||
* is almost always a mistake.
|
||||
*/
|
||||
class BackwardsRangeCheck : BaseAnalyzer
|
||||
final class BackwardsRangeCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import std.range : empty, front, walkLength;
|
|||
/**
|
||||
* Checks for redundant attributes. At the moment only visibility attributes.
|
||||
*/
|
||||
class RedundantAttributesCheck : BaseAnalyzer
|
||||
final class RedundantAttributesCheck : BaseAnalyzer
|
||||
{
|
||||
this(string fileName, const(Scope)* sc, bool skipTests = false)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ import dsymbol.scope_ : Scope;
|
|||
/**
|
||||
* Checks for redundant parenthesis
|
||||
*/
|
||||
class RedundantParenCheck : BaseAnalyzer
|
||||
final class RedundantParenCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import dsymbol.scope_ : Scope;
|
|||
/**
|
||||
* Checks for redundant storage classes such immutable and __gshared, static and __gshared
|
||||
*/
|
||||
class RedundantStorageClassCheck : BaseAnalyzer
|
||||
final class RedundantStorageClassCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
enum string REDUNDANT_VARIABLE_ATTRIBUTES = "Variable declaration for `%s` has redundant attributes (%-(`%s`%|, %)).";
|
||||
|
|
|
@ -22,7 +22,7 @@ import dscanner.utils : safeAccess;
|
|||
*
|
||||
* However, it's more likely that this is a mistake.
|
||||
*/
|
||||
class StaticIfElse : BaseAnalyzer
|
||||
final class StaticIfElse : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import dparse.ast;
|
|||
import dparse.lexer;
|
||||
import dscanner.analysis.base;
|
||||
|
||||
class StatsCollector : BaseAnalyzer
|
||||
final class StatsCollector : BaseAnalyzer
|
||||
{
|
||||
alias visit = ASTVisitor.visit;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import dsymbol.scope_;
|
|||
/**
|
||||
* Checks that `@trusted` is only applied to a a single function
|
||||
*/
|
||||
class TrustTooMuchCheck : BaseAnalyzer
|
||||
final class TrustTooMuchCheck : BaseAnalyzer
|
||||
{
|
||||
private:
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import std.stdio;
|
|||
* Checks for undocumented public declarations. Ignores some operator overloads,
|
||||
* main functions, and functions whose name starts with "get" or "set".
|
||||
*/
|
||||
class UndocumentedDeclarationCheck : BaseAnalyzer
|
||||
final class UndocumentedDeclarationCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import dparse.lexer;
|
|||
/**
|
||||
* Checks for variables that could have been declared const or immutable
|
||||
*/
|
||||
class UnmodifiedFinder : BaseAnalyzer
|
||||
final class UnmodifiedFinder : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import std.algorithm : all;
|
|||
/**
|
||||
* Checks for unused variables.
|
||||
*/
|
||||
class UnusedVariableCheck : BaseAnalyzer
|
||||
final class UnusedVariableCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ auto filterChars(string chars, S)(S str)
|
|||
/**
|
||||
* Checks for asserts that always succeed
|
||||
*/
|
||||
class UselessAssertCheck : BaseAnalyzer
|
||||
final class UselessAssertCheck : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import std.range: retro;
|
|||
* When not used carefully, virtual calls from constructors can lead to a call
|
||||
* in a derived instance that's not yet constructed.
|
||||
*/
|
||||
class VcallCtorChecker : BaseAnalyzer
|
||||
final class VcallCtorChecker : BaseAnalyzer
|
||||
{
|
||||
alias visit = BaseAnalyzer.visit;
|
||||
|
||||
|
|
Loading…
Reference in New Issue