-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(): Add ClassTooBig inspection to vb.net
- Loading branch information
Wolfgang Janz
committed
Sep 22, 2016
1 parent
5d76318
commit 3b7dc4d
Showing
3 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
CleanCode/src/CleanCode/Features/ClassTooBig/ClassTooBigCheckVb.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using CleanCode.Resources; | ||
using CleanCode.Settings; | ||
using JetBrains.Application.Settings; | ||
using JetBrains.ReSharper.Daemon.Stages.Dispatcher; | ||
using JetBrains.ReSharper.Feature.Services.Daemon; | ||
using JetBrains.ReSharper.Psi.VB.Tree; | ||
using JetBrains.ReSharper.Psi.Tree; | ||
|
||
namespace CleanCode.Features.ClassTooBig | ||
{ | ||
[ElementProblemAnalyzer(typeof(IClassDeclaration), HighlightingTypes = new [] | ||
{ | ||
typeof(ClassTooBigHighlighting) | ||
})] | ||
public class ClassTooBigCheckVb : ElementProblemAnalyzer<IClassDeclaration> | ||
{ | ||
protected override void Run(IClassDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) | ||
{ | ||
var maxLength = data.SettingsStore.GetValue((CleanCodeSettings s) => s.MaximumMethodsInClass); | ||
|
||
var statementCount = element.CountChildren<IMethodDeclaration>(); | ||
if (statementCount > maxLength) | ||
{ | ||
var declarationIdentifier = element.Name; | ||
var documentRange = declarationIdentifier.GetDocumentRange(); | ||
var highlighting = new ClassTooBigHighlighting(Warnings.ClassTooBig, documentRange); | ||
consumer.AddHighlighting(highlighting); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters