Dependency Graph

Online documentation:

Dependency Matrix

Online documentation:

Visualizing Code Metrics through Treemaping

With the Online documentation, understand how Treemaping can help you see patterns in your code base, that would be hard to spot with other ways.

Abstractness versus Instability Diagram

The Abstractness versus Instability Diagram helps to detect which assemblies are potentially painful to maintain (i.e concrete and stable) and which assemblies are potentially useless (i.e abstract and instable).

Online documentation:

For beginners: Where to start

Code queries and rules results are truncated to list a maximum of 100 code elements in this report

Does this report gets too large?

The list contains only code elements refactored or added since the baseline for comparison.

The setting Recent Violations Only is enabled

Why should I enable the setting Recent Violations Only ?

Quick Tips

Main
Main \ Rules
Main \ Rules \ Code Quality
Main \ Rules \ Object Oriented Design
Main \ Rules \ Design
Main \ Rules \ Architecture and Layering
Main \ Rules \ Dead Code
Main \ Rules \ Visibility
Main \ Rules \ Purity - Immutability - Side-Effects
Main \ Rules \ Naming Conventions
Main \ Rules \ Source Files Organization
Main \ Rules \ .NET Framework Usage
Main \ Rules \ .NET Framework Usage \ System
Main \ Rules \ .NET Framework Usage \ System.Runtime.InteropServices
Main \ Group of Queries \ Object Oriented Design
Main \ Group of Queries \ API Breaking Changes
Main \ Group of Queries \ Code Diff Summary
Main \ Group of Queries \ Test and Code Coverage
Main \ Group of Queries \ Dead Code
Main \ Metrics \ Application Statistics
Main \ Metrics \ Assemblies Metrics
Main \ Metrics \ Namespaces Metrics
Main \ Metrics \ Types Metrics
Main \ Assemblies Dependencies
Main \ Namespaces Dependencies
Main \ Types Dependencies
Main \ Build Order
Main \ Analysis Log
Main \ Trend Charts
ndepend report summary application nameTfsWorkingOnreport build date11/05/2013 15:02:40analysis duration00:03ndepend version 5.0.0.8085baseline for comparison Not Defined. To define a Baseline for Comparison, please read this online documentation. code coverage data Not Defined. To import Code Coverage Data, please read this online documentation.
Get started.Quick tips.Back to NDepend. The present HTML report is a summary of data gathered by the analysis.
It is recommended to use the NDepend interactive UI capabilities
to make the most of NDepend by mastering all aspects of your code.

Diagrams

.NET Assemblies Dependency Graph
Dependency Graph
View as ?fullscaled
.NET Assemblies Dependency Matrix
Dependency Matrix
View as ?fullscaled
Treemap View
Treemap Metric View
View as ?fullscaled
Abstractness versus Instability
Abstractness vs. Instability
View as ?fullscaled

Application Metrics

Note: Further Application Statistics are available.
# Lines of Code
1 813      
921 (NotMyCode)
# Types
44      
2   Assemblies      
7   Namespaces      
459   Methods      
183   Fields      
29   Source Files      
Comment
32.73%      
882   Lines of Comment      
Method Complexity
10   Max      
1.63   Average      
Code Coverage by TestsN/A because no coverage data specified
Third-Party Usage
8   Assemblies used      
32   Namespaces used      
256   Types used      
374   Methods used      
29   Fields used      

Rules summary

101370This section lists all Rules violated, and Rules or Queries with Error
  • Number of Rules or Queries with Error (syntax error, exception thrown, time-out): 0
  • Number of Rules violated: 37

Summary of Rules violated

graphHelp Rules can be checked live at
development-time, from within Visual
Studio. Online documentation.
graphHelp NDepend rules report too many flaws on
existing code base? Use the option
Recent Violations Only!
warningCritical Some Critical Rules are violated. Critical Rules
can be used to break the build process if
violated. Online documentation.
Name # Matches Elements Group
warning   Methods potentially poorly commented
5 methodsCode Quality
warning   Types with too many methods
4 typesCode Quality
warning   Types with too many fields
3 typesCode Quality
warning   Types with poor cohesion
5 typesCode Quality
warning   Class with no descendant should be sealed if possible
15 typesObject Oriented Design
warning   Methods should be declared static if possible
3 methodsObject Oriented Design
warning   Constructor should not call a virtual methods
3 methodsObject Oriented Design
warning   Avoid the Singleton pattern
1 typesObject Oriented Design
warning   Don't assign static fields from instance methods
3 fieldsObject Oriented Design
warning   Avoid custom delegates
8 typesDesign
warning   Avoid namespaces with few types
3 namespacesDesign
warning   Instances size shouldn't be too big
5 typesDesign
warningCritical   Avoid namespaces mutually dependent
1 namespacesArchitecture and Layering
warning   Avoid namespaces dependency cycles
1 namespacesArchitecture and Layering
warningCritical   Potentially dead Methods
2 methodsDead Code
warning   Methods that could have a lower visibility
68 methodsVisibility
warning   Types that could have a lower visibility
5 typesVisibility
warning   Fields that could have a lower visibility
6 fieldsVisibility
warning   Avoid publicly visible constant fields
35 fieldsVisibility
warning   Fields should be declared as private
6 fieldsVisibility
warning   Event handler methods should be declared private
1 methodsVisibility
warning   Fields should be marked as ReadOnly when possible
7 fieldsPurity - Immutability - Side-Effects
warning   Structures should be immutable
1 typesPurity - Immutability - Side-Effects
warning   Property Getters should be immutable
8 methodsPurity - Immutability - Side-Effects
warning   Avoid static fields with a mutable field type
5 fieldsPurity - Immutability - Side-Effects
warning   A field must not be assigned from outside its parent hierarchy types
1 fieldsPurity - Immutability - Side-Effects
warningCritical   Don't assign a field from many methods
2 fieldsPurity - Immutability - Side-Effects
warning   Instance fields should be prefixed with a 'm_'
151 fieldsNaming Conventions
warning   Static fields should be prefixed with a 's_'
14 fieldsNaming Conventions
warning   Methods name should begin with an Upper character
33 methodsNaming Conventions
warning   Avoid types with name too long
3 typesNaming Conventions
warning   Avoid methods with name too long
17 methodsNaming Conventions
warning   Avoid fields with name too long
12 fieldsNaming Conventions
warning   Avoid defining multiple types in a source file
3 typesSource Files Organization
warning   Namespace name should correspond to file location
25 typesSource Files Organization
warning   Uri fields should be of type System.Uri
3 fieldsSystem
warning   Move P/Invokes to NativeMethods class
1 methodsSystem.Runtime.InteropServices

Application Statistics

Stat # Occurences Avg StdDev Max
Properties on interfaces interfaces 00-1 properties on
Methods on interfaces interfaces 00-1 methods on
Arguments on methods on interfaces methods 00-1 arguments on
Public properties on classes 41 Classes 1.612.6212 public properties on Rowan.TfsWorkingOn.Settings
Public methods on classes 41 classes 6.078.9646 public methods on Rowan.TfsWorkingOn.TfsWarehouse.ControllerService
Arguments on public methods on classes 249 methods 0.750.894 arguments on Rowan.TfsWorkingOn.TfsWarehouse.GetWarehouseStatusCompletedEventHandler.BeginInvoke(Object,GetWarehouseStatusCompletedEventArgs,AsyncCallback,Object)
IL instructions in non-abstract methods 469 methods 29.05118.042321 IL instructions in Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.InitializeComponent()
Cyclomatic complexity on non abstract Methods 469 Methods 1.751.8 CC = 14 for Rowan.TfsWorkingOn.WinForm.FormNotificationTray._userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs)

Assemblies Metrics

If you wish to define thresholds on assemblies' Code Metrics, consider writing some Rules.
Clicking column header arrows sorts values.
Clicking column header title text redirect to the online Code Metric definition.
Assemblies # lines of code# IL instruction # Types # Abstract Types # lines of comment% Comment% CoverageAfferent CouplingEfferent CouplingRelational CohesionInstabilityAbstractnessDistance
Rowan.TfsWorkingOn v1.3.5029.15445611565635129032-4951.660.960.030.01
TfsWorkingOn v1.3.5029.15447120279679059232-01921.56100

Types Metrics : Code Quality

For a particular Code Metric defined for types, values in red represent the 15% highest values.
If you wish to define thresholds on types' Code Metrics, consider writing some Rule.
Clicking column header arrows sorts values.
Clicking column header title text redirect to the online Code Metric definition.
Type Name Type Rank# Lines Of Code# IL Instructions# Lines Of Comment% CommentCyclomatic ComplexityIL Cyclomatic Complexity% CoverageAfferent CouplingEfferent Coupling Type Namespace
LASTINPUTINFO2.19000-00-23Rowan.TfsWorkingOn.Monitor
ProjectWorkedOn1.468781260511-413Rowan.TfsWorkingOn.UserHistory
Resources1.39272206771.282525-614Rowan.TfsWorkingOn.Properties
ProjectCollectionWorkedOn1.324190001621-424Rowan.TfsWorkingOn.UserHistory
UserWorkedOnItem1.1910500612-410Rowan.TfsWorkingOn.UserHistory
FormNotificationTray1.05378269512124.25108148-1109Rowan.TfsWorkingOn.WinForm
MonitorEventArgs1.01033910007-46Rowan.TfsWorkingOn.Monitor
GetNextIntervalCompletedEventArgs0.942512022-211Rowan.TfsWorkingOn.TfsWarehouse
UnblockCompletedEventArgs0.942512022-210Rowan.TfsWorkingOn.TfsWarehouse
BlockCompletedEventArgs0.942512022-210Rowan.TfsWorkingOn.TfsWarehouse
GetWarehouseStatusCompletedEventArgs0.942512022-211Rowan.TfsWorkingOn.TfsWarehouse
ChangeSettingCompletedEventArgs0.942512022-211Rowan.TfsWorkingOn.TfsWarehouse
RunCompletedEventArgs0.942512022-210Rowan.TfsWorkingOn.TfsWarehouse
WarehouseStatus0.83--41000--27Rowan.TfsWorkingOn.TfsWarehouse
MonitorBase0.811228700623-415Rowan.TfsWorkingOn.Monitor
Settings0.787757611.284963-546Rowan.TfsWorkingOn
Connection0.674229548.72328-519Rowan.TfsWorkingOn
Estimates0.5430270001423-328Rowan.TfsWorkingOn
Resources0.456048116973.85252-416Rowan.TfsWorkingOn.WinForm.Properties
FormWorkItem0.431197253422.223039-355Rowan.TfsWorkingOn.WinForm
WorkingItem0.4395759---57-328Rowan.TfsWorkingOn
ProjectCollectionWorkedOn+<>c__DisplayClass50.42112---2-16Rowan.TfsWorkingOn.UserHistory
UserActivity0.41504214044.442433-231Rowan.TfsWorkingOn.Monitor
WorkingItemConfiguration0.4897331010.14766-244Rowan.TfsWorkingOn
UserActivityState0.39--0-0--24Rowan.TfsWorkingOn.Monitor
SafeNativeMethods0.33000-00-13Rowan.TfsWorkingOn.Monitor
ChangeSettingCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
RunCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
GetWarehouseStatusCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
NotifyCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
BlockCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
GetNextIntervalCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
UnblockCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
Settings0.283230034-112Rowan.TfsWorkingOn.Properties
ReinitializeCompletedEventHandler0.28-------19Rowan.TfsWorkingOn.TfsWarehouse
Settings+<>c__DisplayClass50.28112---2-16Rowan.TfsWorkingOn
ControllerService0.289011913427.426399-142Rowan.TfsWorkingOn.TfsWarehouse
Nag0.21293012344.231626-125Rowan.TfsWorkingOn.Monitor
FormWorkItemConfiguration0.21473307215224.322540-1126Rowan.TfsWorkingOn.WinForm
FormSearchWorkItems0.21624082931.871620-158Rowan.TfsWorkingOn.WinForm
FormEstimates0.211065754429.3389-143Rowan.TfsWorkingOn.WinForm
FormWorkItemConfiguration+<QueryPickerControl_OnSelectedQueryItemChanged>o__SiteContainerb0.1900---0-19Rowan.TfsWorkingOn.WinForm
FormWorkItemConfiguration+<FormWorkItemConfiguration_Load>o__SiteContainer00.1900---0-119Rowan.TfsWorkingOn.WinForm
Program0.15411342.8611-06Rowan.TfsWorkingOn.WinForm

Types Metrics : Code Members and Inheritance

Type Name # Instance Methods Nb Static Methods Nb Properties # Fields# Children ClassesDepth Of Inheritance Tree Type Namespace
LASTINPUTINFO0002--Rowan.TfsWorkingOn.Monitor
ProjectWorkedOn602302Rowan.TfsWorkingOn.UserHistory
Resources12322201Rowan.TfsWorkingOn.Properties
ProjectCollectionWorkedOn923702Rowan.TfsWorkingOn.UserHistory
UserWorkedOnItem701321Rowan.TfsWorkingOn.UserHistory
FormNotificationTray43403107Rowan.TfsWorkingOn.WinForm
MonitorEventArgs703302Rowan.TfsWorkingOn.Monitor
GetNextIntervalCompletedEventArgs201103Rowan.TfsWorkingOn.TfsWarehouse
UnblockCompletedEventArgs201103Rowan.TfsWorkingOn.TfsWarehouse
BlockCompletedEventArgs201103Rowan.TfsWorkingOn.TfsWarehouse
GetWarehouseStatusCompletedEventArgs201103Rowan.TfsWorkingOn.TfsWarehouse
ChangeSettingCompletedEventArgs201103Rowan.TfsWorkingOn.TfsWarehouse
RunCompletedEventArgs201103Rowan.TfsWorkingOn.TfsWarehouse
WarehouseStatus------Rowan.TfsWorkingOn.TfsWarehouse
MonitorBase1602521Rowan.TfsWorkingOn.Monitor
Settings269133201Rowan.TfsWorkingOn
Connection1437901Rowan.TfsWorkingOn
Estimates1213701Rowan.TfsWorkingOn
Resources15049201Rowan.TfsWorkingOn.WinForm.Properties
FormWorkItem800707Rowan.TfsWorkingOn.WinForm
WorkingItem30081501Rowan.TfsWorkingOn
ProjectCollectionWorkedOn+<>c__DisplayClass5200101Rowan.TfsWorkingOn.UserHistory
UserActivity1705602Rowan.TfsWorkingOn.Monitor
WorkingItemConfiguration28081401Rowan.TfsWorkingOn
UserActivityState------Rowan.TfsWorkingOn.Monitor
SafeNativeMethods010001Rowan.TfsWorkingOn.Monitor
ChangeSettingCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
RunCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
GetWarehouseStatusCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
NotifyCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
BlockCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
GetNextIntervalCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
UnblockCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
Settings222103Rowan.TfsWorkingOn.Properties
ReinitializeCompletedEventHandler400003Rowan.TfsWorkingOn.TfsWarehouse
Settings+<>c__DisplayClass5200101Rowan.TfsWorkingOn
ControllerService55021706Rowan.TfsWorkingOn.TfsWarehouse
Nag1402402Rowan.TfsWorkingOn.Monitor
FormWorkItemConfiguration12204707Rowan.TfsWorkingOn.WinForm
FormSearchWorkItems1101607Rowan.TfsWorkingOn.WinForm
FormEstimates6001207Rowan.TfsWorkingOn.WinForm
FormWorkItemConfiguration+<QueryPickerControl_OnSelectedQueryItemChanged>o__SiteContainerb000201Rowan.TfsWorkingOn.WinForm
FormWorkItemConfiguration+<FormWorkItemConfiguration_Load>o__SiteContainer0000801Rowan.TfsWorkingOn.WinForm
Program010001Rowan.TfsWorkingOn.WinForm

Types Metrics : Lack Of Cohesion Of Methods and Association Between Classes

Type Name Lack Of Cohesion Of MethodsLack Of Cohesion Of Methods HSAssociation Between Classes Type Namespace
LASTINPUTINFO000Rowan.TfsWorkingOn.Monitor
ProjectWorkedOn0.670.88Rowan.TfsWorkingOn.UserHistory
Resources006Rowan.TfsWorkingOn.Properties
ProjectCollectionWorkedOn0.720.8124Rowan.TfsWorkingOn.UserHistory
UserWorkedOnItem0.640.757Rowan.TfsWorkingOn.UserHistory
FormNotificationTray0.920.94224Rowan.TfsWorkingOn.WinForm
MonitorEventArgs001Rowan.TfsWorkingOn.Monitor
GetNextIntervalCompletedEventArgs001Rowan.TfsWorkingOn.TfsWarehouse
UnblockCompletedEventArgs001Rowan.TfsWorkingOn.TfsWarehouse
BlockCompletedEventArgs001Rowan.TfsWorkingOn.TfsWarehouse
GetWarehouseStatusCompletedEventArgs002Rowan.TfsWorkingOn.TfsWarehouse
ChangeSettingCompletedEventArgs001Rowan.TfsWorkingOn.TfsWarehouse
RunCompletedEventArgs001Rowan.TfsWorkingOn.TfsWarehouse
WarehouseStatus--0Rowan.TfsWorkingOn.TfsWarehouse
MonitorBase0.790.8510Rowan.TfsWorkingOn.Monitor
Settings0.920.9549Rowan.TfsWorkingOn
Connection0.830.8916Rowan.TfsWorkingOn
Estimates0.830.924Rowan.TfsWorkingOn
Resources007Rowan.TfsWorkingOn.WinForm.Properties
FormWorkItem0.770.8863Rowan.TfsWorkingOn.WinForm
WorkingItem0.920.9548Rowan.TfsWorkingOn
ProjectCollectionWorkedOn+<>c__DisplayClass5003Rowan.TfsWorkingOn.UserHistory
UserActivity0.750.7944Rowan.TfsWorkingOn.Monitor
WorkingItemConfiguration0.910.9455Rowan.TfsWorkingOn
UserActivityState--0Rowan.TfsWorkingOn.Monitor
SafeNativeMethods000Rowan.TfsWorkingOn.Monitor
ChangeSettingCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
RunCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
GetWarehouseStatusCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
NotifyCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
BlockCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
GetNextIntervalCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
UnblockCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
Settings002Rowan.TfsWorkingOn.Properties
ReinitializeCompletedEventHandler--0Rowan.TfsWorkingOn.TfsWarehouse
Settings+<>c__DisplayClass5003Rowan.TfsWorkingOn
ControllerService0.960.9838Rowan.TfsWorkingOn.TfsWarehouse
Nag0.750.8135Rowan.TfsWorkingOn.Monitor
FormWorkItemConfiguration0.890.96198Rowan.TfsWorkingOn.WinForm
FormSearchWorkItems0.80.8861Rowan.TfsWorkingOn.WinForm
FormEstimates0.760.9251Rowan.TfsWorkingOn.WinForm
FormWorkItemConfiguration+<QueryPickerControl_OnSelectedQueryItemChanged>o__SiteContainerb000Rowan.TfsWorkingOn.WinForm
FormWorkItemConfiguration+<FormWorkItemConfiguration_Load>o__SiteContainer0000Rowan.TfsWorkingOn.WinForm
Program004Rowan.TfsWorkingOn.WinForm

Namespaces Metrics

If you wish to define thresholds on namespaces' Code Metrics, consider writing some Rules.
Clicking column header arrows sorts values.
Clicking column header title text redirect to the online Code Metric definition.
Namespaces # lines of code# IL instruction # Types # lines of comment% Comment% CoverageAfferent CouplingEfferent Coupling
Rowan.TfsWorkingOn33426456154-218
Rowan.TfsWorkingOn.Monitor91104277545-210
Rowan.TfsWorkingOn.Properties3024327471-310
Rowan.TfsWorkingOn.UserHistory4238541222-28
Rowan.TfsWorkingOn.TfsWarehouse1141341166034-110
Rowan.TfsWorkingOn.WinForm11427486838325-027
Rowan.TfsWorkingOn.WinForm.Properties60481117674-110

940
Code Quality  

warningCritical    Rule warning: Methods potentially poorly commented
// <Name>Methods potentially poorly commented</Name>
warnif count > 0 from m in JustMyCode.Methods where 
  
m.PercentageComment < 20 && 
  
m.NbLinesOfCode > 20  
  
orderby m.PercentageComment ascending
select new { m, m.PercentageComment, m.NbLinesOfCode, m.NbLinesOfComment }

// Methods where %Comment < 20 and that have 
// at least 20 lines of code might need to be more commented.
// See the definition of the Comments metric here 
// http://www.ndepend.com/Metrics.aspx#PercentageComment
// http://www.ndepend.com/Metrics.aspx#NbLinesOfComment 

5 methods matched

methodsPercentage Comment# lines of code (LOC)# lines of commentFull Name
_userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs)0290Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs)
CreateNewMenuQueryItems()4241Rowan.TfsWorkingOn.WinForm.FormNotificationTray .CreateNewMenuQueryItems()
Save()8222Rowan.TfsWorkingOn.WinForm.FormWorkItem.Save()
.ctor()12294Rowan.TfsWorkingOn.WinForm.FormNotificationTray..ctor()
FormWorkItemConfiguration_Load(Object,EventArgs)17245Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .FormWorkItemConfiguration_Load(Object,EventArgs)

Statistics

Stat   Percentage Comment   # lines of code (LOC)   # lines of comment
Sum:4112812
Average:8.225.62.4
Minimum:0220
Maximum:17295
Standard deviation:5.952.871.85
Variance:35.368.243.44
warningCritical    Rule warning: Types with too many methods
// <Name>Types with too many methods</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
t.Methods.Count() > 20 
  
orderby t.Methods.Count() descending
select new { t, t.InstanceMethods, t.StaticMethods }

// Types where Methods.Count() > 20 might be hard to 
// understand and maintain 
// but there might be cases where it is relevant 
// to have a high number of methods. 
// For example, the System.Windows.Forms.DataGridView 
// standard class has more than 1000 methods.

4 types matched

typesInstanceMethodsStaticMethodsFull Name
FormNotificationTray42 methods3 methodsRowan.TfsWorkingOn.WinForm.FormNotificationTray
Settings25 methods8 methodsRowan.TfsWorkingOn.Settings
WorkingItem29 methods0 methodRowan.TfsWorkingOn.WorkingItem
WorkingItemConfiguration27 methods0 methodRowan.TfsWorkingOn.WorkingItemConfiguration

Statistics

Stat   InstanceMethods   StaticMethods
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00
warningCritical    Rule warning: Types with too many fields
// <Name>Types with too many fields</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
t.Fields.Count() > 20 && 
  
!t.IsEnumeration 
  
orderby t.Fields.Count() descending
select new { t, t.InstanceFields, t.StaticFields, t.SizeOfInst }

// Types where Fields.Count() > 20 and not IsEnumeration 
// might be hard to understand and maintain 
// but there might be cases where it is relevant 
// to have a high number of fields. 
// For example, the System.Windows.Forms.Control 
// standard class has more than 200 fields.

3 types matched

typesInstanceFieldsStaticFieldsSize of instanceFull Name
FormWorkItemConfiguration46 fields1 field490Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
Settings10 fields22 fields28Rowan.TfsWorkingOn.Settings
FormNotificationTray25 fields6 fields403Rowan.TfsWorkingOn.WinForm.FormNotificationTray

Statistics

Stat   InstanceFields   StaticFields   Size of instance
Sum:00921
Average:00307
Minimum:0028
Maximum:00490
Standard deviation:00200.45
Variance:0040 182
warningCritical    Rule warning: Types with poor cohesion
// <Name>Types with poor cohesion</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
(t.LCOM > 0.8 || t.LCOMHS > 0.95) && 
  
t.NbFields > 10 && 
  
t.NbMethods >10 
  
orderby t.LCOM descending, t.LCOMHS descending
select new { t, t.LCOM, t.LCOMHS, 
                
t.NbMethods, t.NbFields }

// Types where LCOM > 0.8 and NbFields > 10 
// and NbMethods >10 might be problematic. 
// However, it is very hard to avoid such 
// non-cohesive types. The LCOMHS metric
// is often considered as more efficient to 
// detect non-cohesive types.
// See the definition of the LCOM metric here 
// http://www.ndepend.com/Metrics.aspx#LCOM

5 types matched

typesLack of Cohesion Of Methods (LCOM)LCOM Henderson-Sellers (LCOMHS)# Methods# FieldsFull Name
FormNotificationTray0.920.944731Rowan.TfsWorkingOn.WinForm.FormNotificationTray
Settings0.920.953532Rowan.TfsWorkingOn.Settings
WorkingItem0.920.953015Rowan.TfsWorkingOn.WorkingItem
WorkingItemConfiguration0.910.942814Rowan.TfsWorkingOn.WorkingItemConfiguration
FormWorkItemConfiguration0.890.961447Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration

Statistics

Stat   Lack of Cohesion Of Methods (LCOM)   LCOM Henderson-Sellers (LCOMHS)   # Methods   # Fields
Sum:4.554.74154139
Average:0.910.9530.827.8
Minimum:0.890.941414
Maximum:0.920.964747
Standard deviation:0.0130.006710.6812.25
Variance:0.000174.550459E-05114.16150.16

850
Object Oriented Design  

warningCritical    Rule warning: Class with no descendant should be sealed if possible
// <Name>Class with no descendant should be sealed if possible</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
t.IsClass && 
  
t.NbChildren ==0 && 
 
!t.IsSealed && 
 
!t.IsStatic 
  
// && !t.IsPublic <-- You might want to add this condition 
  //                    if you are developing a framework
  //                    with classes that are intended to be 
  //                    sub-classed by your clients.
  orderby t.NbLinesOfCode descending
select new { t, t.NbLinesOfCode }

15 types matched

types# lines of code (LOC)Full Name
FormWorkItemConfiguration473Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
FormNotificationTray378Rowan.TfsWorkingOn.WinForm.FormNotificationTray
FormWorkItem119Rowan.TfsWorkingOn.WinForm.FormWorkItem
FormEstimates106Rowan.TfsWorkingOn.WinForm.FormEstimates
WorkingItem95Rowan.TfsWorkingOn.WorkingItem
WorkingItemConfiguration89Rowan.TfsWorkingOn.WorkingItemConfiguration
Settings77Rowan.TfsWorkingOn.Settings
FormSearchWorkItems62Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems
UserActivity50Rowan.TfsWorkingOn.Monitor.UserActivity
Connection42Rowan.TfsWorkingOn.Connection
Estimates30Rowan.TfsWorkingOn.Estimates
Nag29Rowan.TfsWorkingOn.Monitor.Nag
ProjectCollectionWorkedOn24Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn
ProjectWorkedOn8Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn
MonitorEventArgs0Rowan.TfsWorkingOn.Monitor.MonitorEventArgs

Statistics

Stat   # lines of code (LOC)
Sum:1 582
Average:105.47
Minimum:0
Maximum:473
Standard deviation:131.28
Variance:17 235
warningCritical    Rule warning: Methods should be declared static if possible
// <Name>Methods should be declared static if possible</Name>
warnif count > 0

// When an instance method can be safely declared as static you should declare it as static.
// Since it doesn't use any instance data and method of its type and base-types,
// you should consider if such a method could be moved to a static utility class
// or if it is strongly related enough to its current declaring type to stay in it.
//
// Turning an instance method into a static method is a micro performance optimization
// since a static method is a bit cheaper to invoke than an instance method.

from t in JustMyCode.Types.Where(t =>
   
!t.IsStatic && !t.IsInterface &&
   
!t.IsEnumeration && !t.IsDelegate &&
   
!t.IsGeneratedByCompiler)

let methodsThatCanBeMadeStatic = 
   
from m in t.InstanceMethods

   
// An instance method can be turned to static if it is not virtual, 
   // not using the this reference and also, not using
   // any of its class or base classes instance fields or instance methods.
   where !m.IsAbstract && !m.IsVirtual &&
         
!m.AccessThis && !m.IsExplicitInterfaceImpl &&

          
// Optimization: Using FirstOrDefault() avoid to check all members, 
          //               as soon as one member is found
          //               we know the method m cannot be made static.
          m.MembersUsed.FirstOrDefault(
              
mUsed => !mUsed.IsStatic && 
                       
(mUsed.ParentType == t || 
                        
t.DeriveFrom(mUsed.ParentType))
          
) == null 
   
select m

from m in methodsThatCanBeMadeStatic
let staticFieldsUsed = m.ParentType.StaticFields.UsedBy(m).Where(f => !f.IsGeneratedByCompiler)
select new { m, staticFieldsUsed }

3 methods matched

methodsstaticFieldsUsedFull Name
get_WorkItemTypes()0 fieldRowan.TfsWorkingOn.WorkingItemConfiguration.get_WorkItemTypes()
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)0 fieldRowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)
notifyMenu_Closing(Object,ToolStripDropDownClosingEventArgs)0 fieldRowan.TfsWorkingOn.WinForm.FormNotificationTray.notifyMenu_Closing (Object,ToolStripDropDownClosingEventArgs)

Statistics

Stat   staticFieldsUsed
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Constructor should not call a virtual methods
// <Name>Constructor should not call a virtual methods</Name>

// Returns constructor of a non-sealed type calling virtual methods.
// In such a situation, if a derived class overrides the method,
// then the override method will be called before the derived constructor.
// This makes the class fragile to derive from.
//
// Violations reported can be solved by re-designing object initialisation
// or by marking the parent class as sealed, if possible.

warnif count > 0
from t in Application.Types where 
   
t.IsClass &&
  
!t.IsGeneratedByCompiler &&
  
!t.IsSealed

from ctor in t.Constructors 
let virtualMethodsCalled = from mCalled in ctor.MethodsCalled
                           
where mCalled.IsVirtual &&
                                
(mCalled.ParentType == t ||
                                 
t.DeriveFrom(mCalled.ParentType))
                           
select mCalled
where virtualMethodsCalled.Count() > 0

select new { ctor , 
             
virtualMethodsCalled, 
             
// If there is no derived type, it might be 
             // an opportunity to mark t as sealed.
             t.DerivedTypes }

3 methods matched

methodsvirtualMethodsCalledDerivedTypesFull Name
.ctor()1 method0 typeRowan.TfsWorkingOn.WorkingItemConfiguration..ctor()
.ctor(WorkItemStore,String)2 methods0 typeRowan.TfsWorkingOn.WinForm.FormSearchWorkItems..ctor(WorkItemStore ,String)
.ctor(WorkItem)1 method0 typeRowan.TfsWorkingOn.WinForm.FormWorkItem..ctor(WorkItem)

Statistics

Stat   virtualMethodsCalled   DerivedTypes
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00
warningCritical    Rule warning: Avoid the Singleton pattern
//<Name>Avoid the Singleton pattern</Name>
warnif count > 0
from t in Application.Types
where !t.IsStatic && !t.IsAbstract && (t.IsClass || t.IsStructure)

// All ctors of a singleton are private
where t.Constructors.Where(ctor => !ctor.IsPrivate).Count() == 0

// A singleton contains one static field of its parent type, to reference the unique instance
let staticFieldInstances = t.StaticFields.WithFieldType(t)
where staticFieldInstances.Count() == 1
select new { t, staticFieldInstance = staticFieldInstances.First() }

// The Singleton pattern consists in syntactically enforcing that a class 
// has just one unique instance.
// At first glance, this pattern looks appealing and it is widely used.
// However, we discourage you from using singleton classes because experience
// shows that singletons often result in less testable and less maintainable code.
// More details available in these discussions:
//  http://codebetter.com/patricksmacchia/2011/05/04/back-to-basics-usage-of-static-members/
//  http://adamschepis.com/blog/2011/05/02/im-adam-and-im-a-recovering-singleton-addict/

1 types matched

typestaticFieldInstanceFull Name
Connection_connectionRowan.TfsWorkingOn.Connection

Statistics

Stat   staticFieldInstance
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Don't assign static fields from instance methods
// <Name>Don't assign static fields from instance methods</Name>
// Assigning static fields from instance methods leads to
// poorly maintainable and non thread-safe code.
// It is advised to assign static fields inline or from class constructor.
warnif count > 0
from f in Application.Fields where 
  
f.IsStatic &&
 
!f.IsLiteral &&
 
!f.IsInitOnly &&
 
!f.IsGeneratedByCompiler &&
  
// Contract API define such a insideContractEvaluation static field
  f.Name != "insideContractEvaluation"
let assignedBy = f.MethodsAssigningMe.Where(m => !m.IsStatic)
where assignedBy .Count() > 0
select new { f, assignedBy }

3 fields matched

fieldsassignedByFull Name
_formSearchWorkItems1 methodRowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems
_formItemConfiguration1 methodRowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration
_userActivityTriggeredCurrentlyProcessing1 methodRowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing

Statistics

Stat   assignedBy
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0

1130
Design  

warningCritical    Rule warning: Avoid custom delegates
// <Name>Avoid custom delegates</Name>

// Prefer using one of the standard generic delegate type in
// Predicate<T> Func<T0,T1,..,TResult> Action<T0,T1,..> 
// instead of creating your own delegate type.
// Not only the code using these custom delegates will become clearer,
// but you'll be relieved from the maintenance of these delegate types.
//
// Notice that delegate that are consumed by DllImport extern methods
// must not be converted, else this could provoke marshalling issues.

warnif count > 0 
from t in Application.Types where t.IsDelegate

let invokeMethod = (from m in t.Methods where m.SimpleName == "Invoke" select m).Single()
let signature1 = invokeMethod.Name.Substring(invokeMethod.SimpleName.Length, invokeMethod.Name.Length - invokeMethod.SimpleName.Length)

// 'ref' and 'out' parameters canot be supported
where !signature1.Contains("&")

let signature2 = signature1.Replace("(","<").Replace(")",">")
let signature3 = signature2 == "<>" ? "" : signature2
let resultTypeName = invokeMethod.ReturnType == null ? "????" :
                     
invokeMethod.ReturnType.FullName == "System.Void" ? "" :
                     
invokeMethod.ReturnType.Name
let replaceWith = resultTypeName == "Boolean" ?
      
"Predicate" + signature3 : resultTypeName == "" ?
      
"Action" + signature3  :
      
"Func" + signature3.Replace(">", "," + resultTypeName + ">")
             

select new { t, replaceWith }

8 types matched

typesreplaceWithFull Name
GetWarehouseStatusCompletedEventHandlerAction<Object,GetWarehouseStatusCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse .GetWarehouseStatusCompletedEventHandler
BlockCompletedEventHandlerAction<Object,BlockCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.BlockCompletedEventHandler
UnblockCompletedEventHandlerAction<Object,UnblockCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.UnblockCompletedEventHandler
ReinitializeCompletedEventHandlerAction<Object,AsyncCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.ReinitializeCompletedEventHandler
ChangeSettingCompletedEventHandlerAction<Object,ChangeSettingCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.ChangeSettingCompletedEventHandler
RunCompletedEventHandlerAction<Object,RunCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.RunCompletedEventHandler
NotifyCompletedEventHandlerAction<Object,AsyncCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.NotifyCompletedEventHandler
GetNextIntervalCompletedEventHandlerAction<Object,GetNextIntervalCompletedEventArgs>Rowan.TfsWorkingOn.TfsWarehouse.GetNextIntervalCompletedEventHandler

Statistics

Stat   replaceWith
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Avoid namespaces with few types
// <Name>Avoid namespaces with few types</Name>
warnif count > 0 from n in JustMyCode.Namespaces 
let types = n.ChildTypes.Where(t => !t.IsGeneratedByCompiler)
where 
  
types.Count() < 5 
  
orderby types.Count() ascending
select new { n, types } 

// Make sure that there is a logical organization 
// to each of your namespaces, and that there is a 
// valid reason for putting types in a sparsely 
// populated namespace. Namespaces should contain 
// types that are used together in most scenarios. 
// When their applications are mutually exclusive, 
// types should be located in separate namespaces

3 namespaces matched

namespacestypesFull Name
Rowan.TfsWorkingOn.WinForm.Properties1 typeRowan.TfsWorkingOn.WinForm.Properties
Rowan.TfsWorkingOn.Properties2 typesRowan.TfsWorkingOn.Properties
Rowan.TfsWorkingOn.UserHistory3 typesRowan.TfsWorkingOn.UserHistory

Statistics

Stat   types
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Instances size shouldn't be too big
// <Name>Instances size shouldn't be too big</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
t.SizeOfInst > 64 
  
orderby t.SizeOfInst descending
select new { t, t.SizeOfInst, t.InstanceFields }

// Types where SizeOfInst > 64 might degrade performance 
// (depending on the number of instances created at runtime) 
// and might be hard to maintain. However it is not a rule 
// since sometime there is no alternative (the size of 
// instances of the System.Net.NetworkInformation.SystemIcmpV6Statistics 
// standard class is 2064 bytes).
// Notice that a class with a large SizeOfInst value
// doesn't necessarily have a lot of instance fields.
// It might derive from a class with a large SizeOfInst value.
// See the definition of the SizeOfInst metric here 
// http://www.ndepend.com/Metrics.aspx#SizeOfInst

5 types matched

typesSize of instanceInstanceFieldsFull Name
FormWorkItemConfiguration49046 fieldsRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
FormNotificationTray40325 fieldsRowan.TfsWorkingOn.WinForm.FormNotificationTray
FormEstimates35412 fieldsRowan.TfsWorkingOn.WinForm.FormEstimates
FormWorkItem3317 fieldsRowan.TfsWorkingOn.WinForm.FormWorkItem
FormSearchWorkItems3306 fieldsRowan.TfsWorkingOn.WinForm.FormSearchWorkItems

Statistics

Stat   Size of instance   InstanceFields
Sum:1 9080
Average:381.60
Minimum:3300
Maximum:4900
Standard deviation:60.320
Variance:3 6380

720
Architecture and Layering  

warningCritical    Critical Rule warning: Avoid namespaces mutually dependent
// <Name>Avoid namespaces mutually dependent</Name>
warnif count > 0
// Foreach pair of namespace mutually dependent, this rule lists pairs.
// The pair { first, second } is formatted to show first namespace shouldn't use the second namespace.
// The first/second order is inferred from the number of types used by each other.
// The first namespace is using fewer types of the second.
// It means the first namespace is certainly at a lower level in the architecture than the second.
//
// To explore the coupling between two namespaces mutually dependent:
//  1) export the first namespace to the vertical header of the dependency matrix
//  2) export the second namespace to the horizontal header of the dependency matrix
//  3) double-click the black cell
//  4) in the matrix command bar, click the button: Remove empty Row(s) en Column(s)
// At this point, the dependency matrix shows types involved into the coupling.
//
// Following this rule is useful to avoid namespaces dependency cycles.
// More on this in our white books relative to partitioning code.
// http://www.ndepend.com/WhiteBooks.aspx


// Optimization: restraint application assemblies set
// If some namespaces are mutually dependent
//  - They must be declared in the same assembly
//  - The parent assembly must ContainsNamespaceDependencyCycle
from assembly in Application.Assemblies.Where(a => a.ContainsNamespaceDependencyCycle != null && a.ContainsNamespaceDependencyCycle.Value)

// hashset is used to avoid reporting both A <-> B and B <-> A
let hashset = new HashSet<INamespace>()

// Optimization: restraint namespaces set
// If a namespace doesn't have a Level value, it must be in a dependency cycle
// or it must be using directly or indirectly a dependency cycle.
let namespacesSuspect = assembly.ChildNamespaces.Where(n => n.Level == null)

from nA in namespacesSuspect

// Select namespaces mutually dependent with nA
let unused = hashset.Add(nA) // Populate hashset
let namespacesMutuallyDependentWith_nA = nA.NamespacesUsed.Using(nA)
          
.Except(hashset) // <-- avoid reporting both A <-> B and B <-> A 
where namespacesMutuallyDependentWith_nA.Count() > 0

from nB in namespacesMutuallyDependentWith_nA

// nA and nB are mutually dependent
// First select the one that shouldn't use the other.
// The first namespace is inferred from the fact that it is using less types of the second.
let typesOfBUsedByA = nB.ChildTypes.UsedBy(nA)
let typesOfAUsedByB = nA.ChildTypes.UsedBy(nB)
let first = (typesOfBUsedByA.Count() > typesOfAUsedByB.Count()) ? nB : nA
let second = (first == nA) ? nB : nA
let typesOfFirstUsedBySecond = (first == nA) ? typesOfAUsedByB : typesOfBUsedByA
let typesOfSecondUsedByFirst = (first == nA) ? typesOfBUsedByA : typesOfAUsedByB
select new { first, shouldntUse = second, typesOfFirstUsedBySecond, typesOfSecondUsedByFirst }

1 namespaces matched

namespaceshouldntUsetypesOfFirstUsedBySecondtypesOfSecondUsedByFirstFull Name
Rowan.TfsWorkingOn.MonitorRowan.TfsWorkingOn2 types1 typeRowan.TfsWorkingOn.Monitor

Statistics

Stat   shouldntUse   typesOfFirstUsedBySecond   typesOfSecondUsedByFirst
Sum:000
Average:000
Minimum:000
Maximum:000
Standard deviation:000
Variance:000
warningCritical    Rule warning: Avoid namespaces dependency cycles
// <Name>Avoid namespaces dependency cycles</Name>
warnif count > 0
// This query lists all application namespace dependency cycles.
// Each row shows a different cycle, prefixed with a namespace entangled in the cycle.
//
// To browse a cycle on the dependency graph or the dependency matrix, right click
// a cycle cell and export the matched namespaces to the dependency graph or matrix!
//
// In the matrix, dependency cycles are represented with red squares and black cells.
// To easily browse dependency cycles, the Matrix comes with an option:
//   --> Display Direct and Indirect Dependencies
//
// Read our white books relative to partitioning code, 
// to know more about namespaces dependency cycles, and why avoiding them 
// is a simple but efficient solution to architecture for your code base.
// http://www.ndepend.com/WhiteBooks.aspx


// Optimization: restraint application assemblies set
// If some namespaces are mutually dependent
//  - They must be declared in the same assembly
//  - The parent assembly must ContainsNamespaceDependencyCycle
from assembly in Application.Assemblies
                 
.Where(a => a.ContainsNamespaceDependencyCycle != null && 
                             
a.ContainsNamespaceDependencyCycle.Value)

// Optimization: restraint namespaces set
// A namespace involved in a cycle necessarily have a null Level.
let namespacesSuspect = assembly.ChildNamespaces.Where(n => n.Level == null)

// hashset is used to avoid iterating again on namespaces already caught in a cycle.
let hashset = new HashSet<INamespace>()


from suspect in namespacesSuspect
   
// By commenting in this line, the query matches all namespaces involved in a cycle.
   where !hashset.Contains(suspect)

   
// Define 2 code metrics
   // - Namespaces depth of is using indirectly the suspect namespace.
   // - Namespaces depth of is used by the suspect namespace indirectly.
   // Note: for direct usage the depth is equal to 1.
   let namespacesUserDepth = namespacesSuspect.DepthOfIsUsing(suspect)
   
let namespacesUsedDepth = namespacesSuspect.DepthOfIsUsedBy(suspect)

   
// Select namespaces that are both using and used by namespaceSuspect
   let usersAndUsed = from n in namespacesSuspect where 
                         
namespacesUserDepth[n] > 0 && 
                         
namespacesUsedDepth[n] > 0 
                      
select n

   
where usersAndUsed.Count() > 0

   
// Here we've found namespace(s) both using and used by the suspect namespace.
   // A cycle involving the suspect namespace is found!
   let cycle = usersAndUsed.Append(suspect)

   
// Fill hashset with namespaces in the cycle.
   // .ToArray() is needed to force the iterating process.
   let unused1 = (from n in cycle let unused2 = hashset.Add(n) select n).ToArray()

select new { suspect, cycle }

1 namespaces matched

namespacecycleFull Name
Rowan.TfsWorkingOn2 namespacesRowan.TfsWorkingOn

Statistics

Stat   cycle
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0

310
Dead Code  

  • 3 validated Rule(s)
  • 1 Rule(s) violated
  • 0 Rules or Queries with Error (syntax error, exception thrown, time-out)
warningCritical    Critical Rule warning: Potentially dead Methods
// <Name>Potentially dead Methods</Name>
warnif count > 0
// Filter procedure for methods that should'nt be considered as dead
let canMethodBeConsideredAsDeadProc = new Func<IMethod, bool>(
    
m => !m.IsPubliclyVisible &&       // Public methods might be used by client applications of your assemblies.
         !m.IsEntryPoint &&            // Main() method is not used by-design.
         !m.IsExplicitInterfaceImpl && // The IL code never explicitely calls explicit interface methods implementation.
         !m.IsClassConstructor &&      // The IL code never explicitely calls class constructors.
         !m.IsFinalizer &&             // The IL code never explicitely calls finalizers.
         !m.IsVirtual &&               // Only check for non virtual method that are not seen as used in IL.
         !(m.IsConstructor &&          // Don't take account of protected ctor that might be call by a derived ctors.
           m.IsProtected) &&
         
!m.IsEventAdder &&            // The IL code never explicitely calls events adder/remover.
         !m.IsEventRemover &&
         
!m.IsGeneratedByCompiler &&
         
!m.ParentType.IsDelegate &&

         
// Methods tagged with these two attributes are called by the serialization infrastructure.
         !m.HasAttribute("System.Runtime.Serialization.OnSerializingAttribute".AllowNoMatch()) &&
         
!m.HasAttribute("System.Runtime.Serialization.OnDeserializedAttribute".AllowNoMatch()) &&

         
// If you don't want to link NDepend.API.dll, you can use your own IsNotDeadCodeAttribute and adapt this rule.
         !m.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()))

// Get methods unused
let methodsUnused = 
   
from m in JustMyCode.Methods where 
   
m.NbMethodsCallingMe == 0 && 
   
canMethodBeConsideredAsDeadProc(m)
   
select m

// Dead methods = methods used only by unused methods (recursive)
let deadMethodsMetric = methodsUnused.FillIterative(
   
methods => // Unique loop, just to let a chance to build the hashset.
              from o in (new object()).ToEnumerable()
              
// Use a hashet to make Intersect calls much faster!
              let hashset = methods.ToHashSet()
              
from m in codeBase.Application.Methods.UsedByAny(methods).Except(methods)
              
where canMethodBeConsideredAsDeadProc(m) &&
                    
// Select methods called only by methods already considered as dead
                    hashset.Intersect(m.MethodsCallingMe).Count() == m.NbMethodsCallingMe
              
select m)

from m in JustMyCode.Methods.Intersect(deadMethodsMetric.DefinitionDomain)
select new { m, m.MethodsCallingMe, depth = deadMethodsMetric[m] }

2 methods matched

methodsMethodsCallingMedepthFull Name
get_TeamProjectCollectionUri()0 method0Rowan.TfsWorkingOn.Connection.get_TeamProjectCollectionUri()
linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs)0 method0Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs)

Statistics

Stat   MethodsCallingMe   depth
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00

460
Visibility  

warningCritical    Rule warning: Methods that could have a lower visibility
// <Name>Methods that could have a lower visibility</Name>
warnif count > 0 from m in JustMyCode.Methods where 
  
m.Visibility != m.OptimalVisibility &&
  
!m.HasAttribute("NDepend.Attributes.CannotDecreaseVisibilityAttribute".AllowNoMatch()) &&
  
!m.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&
  
// If you don't want to link NDepend.API.dll, you can use your own attributes and adapt this rule.
  
  
// Eliminate default constructor from the result.
  // Whatever the visibility of the declaring class,
  // default constructors are public and introduce noise
  // in the current rule.
  !( m.IsConstructor && m.IsPublic && m.NbParameters == 0) &&

  
// Don't decrease the visibility of Main() methods.
  !m.IsEntryPoint

select new { m, 
             
m.Visibility , 
             
CouldBeDeclared = m.OptimalVisibility,
             
m.MethodsCallingMe }

68 methods matched

methodsVisibilityCouldBeDeclaredMethodsCallingMeFull Name
set_Duration(Double)PublicInternal2 methodsRowan.TfsWorkingOn.Estimates.set_Duration(Double)
get_RemainingTime()PublicInternal4 methodsRowan.TfsWorkingOn.Estimates.get_RemainingTime()
set_RemainingTime(Double)PublicInternal4 methodsRowan.TfsWorkingOn.Estimates.set_RemainingTime(Double)
set_ElapsedTime(Double)PublicInternal3 methodsRowan.TfsWorkingOn.Estimates.set_ElapsedTime(Double)
get_IsConnected()PublicPrivate0 methodRowan.TfsWorkingOn.Connection.get_IsConnected()
get_SettingsFolderPath()PublicInternal3 methodsRowan.TfsWorkingOn.Settings.get_SettingsFolderPath()
get_UserActivityIdleTimeoutMinutes()PublicPrivate0 methodRowan.TfsWorkingOn.Settings.get_UserActivityIdleTimeoutMinutes()
set_UserActivityIdleTimeoutMinutes(Int32)PublicPrivate0 methodRowan.TfsWorkingOn.Settings.set_UserActivityIdleTimeoutMinutes(Int32)
get_MonitorUserActivity()PublicPrivate0 methodRowan.TfsWorkingOn.Settings.get_MonitorUserActivity()
set_MonitorUserActivity(Boolean)PublicPrivate0 methodRowan.TfsWorkingOn.Settings.set_MonitorUserActivity(Boolean)
set_PromptOnResume(Boolean)PublicPrivate1 methodRowan.TfsWorkingOn.Settings.set_PromptOnResume(Boolean)
set_BalloonTipTimeoutSeconds(Int32)PublicPrivate0 methodRowan.TfsWorkingOn.Settings.set_BalloonTipTimeoutSeconds(Int32)
get_NagIntervalMinutes()PublicPrivate0 methodRowan.TfsWorkingOn.Settings.get_NagIntervalMinutes()
set_NagIntervalMinutes(Int32)PublicPrivate0 methodRowan.TfsWorkingOn.Settings.set_NagIntervalMinutes(Int32)
get_NagEnabled()PublicPrivate0 methodRowan.TfsWorkingOn.Settings.get_NagEnabled()
set_NagEnabled(Boolean)PublicPrivate0 methodRowan.TfsWorkingOn.Settings.set_NagEnabled(Boolean)
get_ProjectCollectionHistory()PublicPrivate3 methodsRowan.TfsWorkingOn.Settings.get_ProjectCollectionHistory()
set_ProjectCollectionHistory(BindingList<ProjectCollectionWorkedOn>)PublicPrivate0 methodRowan.TfsWorkingOn.Settings.set_ProjectCollectionHistory(BindingList <ProjectCollectionWorkedOn>)
OnPropertyChanged(PropertyChangedEventArgs)ProtectedPrivate8 methodsRowan.TfsWorkingOn.Settings.OnPropertyChanged(PropertyChangedEventArgs )
get_Connection()PublicPrivate0 methodRowan.TfsWorkingOn.WorkingItem.get_Connection()
get_StartTime()PublicPrivate1 methodRowan.TfsWorkingOn.WorkingItem.get_StartTime()
set_StartTime(DateTime)PublicPrivate2 methodsRowan.TfsWorkingOn.WorkingItem.set_StartTime(DateTime)
get_StopTime()PublicPrivate2 methodsRowan.TfsWorkingOn.WorkingItem.get_StopTime()
set_StopTime(Nullable<DateTime>)PublicPrivate4 methodsRowan.TfsWorkingOn.WorkingItem.set_StopTime(Nullable<DateTime>)
set_Estimates(Estimates)PublicPrivate0 methodRowan.TfsWorkingOn.WorkingItem.set_Estimates(Estimates)
set_Started(Boolean)PublicPrivate2 methodsRowan.TfsWorkingOn.WorkingItem.set_Started(Boolean)
set_Paused(Boolean)PublicPrivate2 methodsRowan.TfsWorkingOn.WorkingItem.set_Paused(Boolean)
UpdateEstimates()PublicPrivate1 methodRowan.TfsWorkingOn.WorkingItem.UpdateEstimates()
UpdateEstimates(String)PublicPrivate2 methodsRowan.TfsWorkingOn.WorkingItem.UpdateEstimates(String)
get_SelectedWorkItemTypeName()PublicPrivate0 methodRowan.TfsWorkingOn.WorkingItemConfiguration .get_SelectedWorkItemTypeName()
set_SelectedWorkItemTypeName(String)PublicPrivate1 methodRowan.TfsWorkingOn.WorkingItemConfiguration .set_SelectedWorkItemTypeName(String)
get_SelectedWorkItemType()PublicPrivate2 methodsRowan.TfsWorkingOn.WorkingItemConfiguration.get_SelectedWorkItemType()
set_SelectedWorkItemType(WorkItemType)PublicInternal1 methodRowan.TfsWorkingOn.WorkingItemConfiguration.set_SelectedWorkItemType (WorkItemType)
get_DurationField()PublicInternal4 methodsRowan.TfsWorkingOn.WorkingItemConfiguration.get_DurationField()
set_DurationField(String)PublicPrivate1 methodRowan.TfsWorkingOn.WorkingItemConfiguration.set_DurationField(String)
get_RemainingField()PublicInternal4 methodsRowan.TfsWorkingOn.WorkingItemConfiguration.get_RemainingField()
set_RemainingField(String)PublicPrivate1 methodRowan.TfsWorkingOn.WorkingItemConfiguration.set_RemainingField(String)
get_ElapsedField()PublicInternal4 methodsRowan.TfsWorkingOn.WorkingItemConfiguration.get_ElapsedField()
set_ElapsedField(String)PublicPrivate1 methodRowan.TfsWorkingOn.WorkingItemConfiguration.set_ElapsedField(String)
get_WarehouseController()PublicPrivate0 methodRowan.TfsWorkingOn.WorkingItemConfiguration.get_WarehouseController()
get_MonitorType()PublicInternal3 methodsRowan.TfsWorkingOn.Monitor.MonitorEventArgs.get_MonitorType()
set_MonitorType(Type)PublicInternal6 methodsRowan.TfsWorkingOn.Monitor.MonitorEventArgs.set_MonitorType(Type)
set_Reason(String)PublicInternal6 methodsRowan.TfsWorkingOn.Monitor.MonitorEventArgs.set_Reason(String)
get_Details()PublicPrivate0 methodRowan.TfsWorkingOn.Monitor.MonitorEventArgs.get_Details()
set_Details(String)PublicInternal6 methodsRowan.TfsWorkingOn.Monitor.MonitorEventArgs.set_Details(String)
.ctor(Int32)PublicPrivate1 methodRowan.TfsWorkingOn.Monitor.Nag..ctor(Int32)
get_Interval()PublicPrivate1 methodRowan.TfsWorkingOn.Monitor.Nag.get_Interval()
set_Interval(Int64)PublicPrivate2 methodsRowan.TfsWorkingOn.Monitor.Nag.set_Interval(Int64)
get_LastResetTime()PublicPrivate0 methodRowan.TfsWorkingOn.Monitor.UserActivity.get_LastResetTime()
get_IdleThreshold()PublicPrivate1 methodRowan.TfsWorkingOn.Monitor.UserActivity.get_IdleThreshold()
set_IdleThreshold(Int64)PublicPrivate2 methodsRowan.TfsWorkingOn.Monitor.UserActivity.set_IdleThreshold(Int64)
get_ActiveTimeMilliseconds()PublicPrivate0 methodRowan.TfsWorkingOn.Monitor.UserActivity.get_ActiveTimeMilliseconds()
get_ActiveTime()PublicPrivate0 methodRowan.TfsWorkingOn.Monitor.UserActivity.get_ActiveTime()
.ctor(Int64)PublicPrivate1 methodRowan.TfsWorkingOn.Monitor.UserActivity..ctor(Int64)
Reset()PublicPrivate0 methodRowan.TfsWorkingOn.Monitor.UserActivity.Reset()
get_LastAccessed()PublicInternal4 methodsRowan.TfsWorkingOn.UserHistory.UserWorkedOnItem.get_LastAccessed()
set_LastAccessed(DateTime)PublicInternal4 methodsRowan.TfsWorkingOn.UserHistory.UserWorkedOnItem.set_LastAccessed (DateTime)
.ctor(String)PublicInternal1 methodRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn..ctor(String)
set_TeamProjectCollectionAbsoluteUri(String)PublicPrivate1 methodRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .set_TeamProjectCollectionAbsoluteUri(String)
get_ProjectHistory()PublicPrivate3 methodsRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .get_ProjectHistory()
set_ProjectHistory(BindingList<ProjectWorkedOn>)PublicPrivate0 methodRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .set_ProjectHistory(BindingList<ProjectWorkedOn>)
.ctor(String)PublicInternal1 methodRowan.TfsWorkingOn.UserHistory.ProjectWorkedOn..ctor(String)
set_ProjectName(String)PublicPrivate1 methodRowan.TfsWorkingOn.UserHistory.ProjectWorkedOn.set_ProjectName(String)
.ctor(WorkingItem)PublicInternal2 methodsRowan.TfsWorkingOn.WinForm.FormEstimates..ctor(WorkingItem)
get_WorkingItem()PublicInternal2 methodsRowan.TfsWorkingOn.WinForm.FormSearchWorkItems.get_WorkingItem()
.ctor(WorkItemStore,String)PublicInternal1 methodRowan.TfsWorkingOn.WinForm.FormSearchWorkItems..ctor(WorkItemStore ,String)
.ctor(WorkItem)PublicInternal3 methodsRowan.TfsWorkingOn.WinForm.FormWorkItem..ctor(WorkItem)
QueryPickerControl_OnSelectedQueryItemChanged()ProtectedPrivate1 methodRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .QueryPickerControl_OnSelectedQueryItemChanged()

Statistics

Stat   Visibility   CouldBeDeclared   MethodsCallingMe
Sum:000
Average:000
Minimum:000
Maximum:000
Standard deviation:000
Variance:000
warningCritical    Rule warning: Types that could have a lower visibility
// <Name>Types that could have a lower visibility</Name>
warnif count > 0 from t in JustMyCode.Types where 

  
t.Visibility != t.OptimalVisibility &&

  
// If you don't want to link NDepend.API.dll, you can use your own attributes and adapt this rule.
 !t.HasAttribute("NDepend.Attributes.CannotDecreaseVisibilityAttribute".AllowNoMatch()) &&
 
!t.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&

  
// Static types that define only const fields cannot be seen as used in IL code.
  // They don't have to be tagged with CannotDecreaseVisibilityAttribute.
  !( t.IsStatic && 
    
!t.Methods.Any(m => !m.IsClassConstructor) && 
    
!t.Fields.Any(f => !f.IsLiteral && !(f.IsStatic && f.IsInitOnly))) &&

  
// A type used by an interface that has the same visibility
  // cannot have its visibility decreased, else a compilation error occurs!
  !t.TypesUsingMe.Any(tUser => 
        
tUser.IsInterface && 
        
tUser.Visibility == t.Visibility)

select new { t, t.Visibility , 
                
CouldBeDeclared = t.OptimalVisibility, 
                
t.TypesUsingMe }

5 types matched

typesVisibilityCouldBeDeclaredTypesUsingMeFull Name
FormEstimatesPublicInternal1 typeRowan.TfsWorkingOn.WinForm.FormEstimates
FormSearchWorkItemsPublicInternal1 typeRowan.TfsWorkingOn.WinForm.FormSearchWorkItems
FormWorkItemPublicInternal3 typesRowan.TfsWorkingOn.WinForm.FormWorkItem
FormWorkItemConfigurationPublicInternal1 typeRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
FormNotificationTrayPublicInternal1 typeRowan.TfsWorkingOn.WinForm.FormNotificationTray

Statistics

Stat   Visibility   CouldBeDeclared   TypesUsingMe
Sum:000
Average:000
Minimum:000
Maximum:000
Standard deviation:000
Variance:000
warningCritical    Rule warning: Fields that could have a lower visibility
// <Name>Fields that could have a lower visibility</Name>
warnif count > 0 from f in JustMyCode.Fields where 
  
f.Visibility != f.OptimalVisibility &&
 
!f.HasAttribute("NDepend.Attributes.CannotDecreaseVisibilityAttribute".AllowNoMatch()) &&
 
!f.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch())
  
// If you don't want to link NDepend.API.dll, you can use your own attributes and adapt this rule.
  
select new { f, 
             
f.Visibility , 
             
CouldBeDeclared = f.OptimalVisibility,
             
f.MethodsUsingMe }

6 fields matched

fieldsVisibilityCouldBeDeclaredMethodsUsingMeFull Name
cbSizePublicInternal1 methodRowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize
dwTimePublicInternal1 methodRowan.TfsWorkingOn.Monitor.LASTINPUTINFO.dwTime
pnlButtonsInternalPrivate1 methodRowan.TfsWorkingOn.WinForm.FormWorkItem.pnlButtons
btnCancelInternalPrivate1 methodRowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel
btnSaveInternalPrivate1 methodRowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave
pnlWICtlInternalPrivate1 methodRowan.TfsWorkingOn.WinForm.FormWorkItem.pnlWICtl

Statistics

Stat   Visibility   CouldBeDeclared   MethodsUsingMe
Sum:000
Average:000
Minimum:000
Maximum:000
Standard deviation:000
Variance:000
warningCritical    Rule warning: Avoid publicly visible constant fields
// <Name>Avoid publicly visible constant fields</Name>

// Match constant fields which are visible outside their parent assembly. 
// Such field, when used outside its parent assembly,
// has its constant value hard-coded into the client assembly.
// Changing the field's value requires to recompile all assemblies 
// that use the field. 

// Declare the field as static readonly instead. This way, the value can be 
// safely changed, without the need to recompile client assemblies.

warnif count > 0 
from f in Application.Fields
where f.IsLiteral && f.IsPubliclyVisible 
      
&& !f.IsEnumValue // This situation also applies to enumeration values
                        // but to avoid too many false positives, per default
                        // this rule doesn't match these particular fields.
select f

35 fields matched

fieldsFull Name
DurationPropertyNameRowan.TfsWorkingOn.Estimates.DurationPropertyName
RemainingTimePropertyNameRowan.TfsWorkingOn.Estimates.RemainingTimePropertyName
ElapsedTimePropertyNameRowan.TfsWorkingOn.Estimates.ElapsedTimePropertyName
TeamProjectCollectionAbsoluteUriPropertyNameRowan.TfsWorkingOn.Connection .TeamProjectCollectionAbsoluteUriPropertyName
SelectedProjectNamePropertyNameRowan.TfsWorkingOn.Connection.SelectedProjectNamePropertyName
MonitorUserActivityPropertyNameRowan.TfsWorkingOn.Settings.MonitorUserActivityPropertyName
NagEnabledPropertyNameRowan.TfsWorkingOn.Settings.NagEnabledPropertyName
NagIntervalMinutesPropertyNameRowan.TfsWorkingOn.Settings.NagIntervalMinutesPropertyName
PromptOnResumePropertyNameRowan.TfsWorkingOn.Settings.PromptOnResumePropertyName
UserActivityIdleTimeoutMinutesPropertyNameRowan.TfsWorkingOn.Settings.UserActivityIdleTimeoutMinutesPropertyName
ProjectCollectionHistoryPropertyNameRowan.TfsWorkingOn.Settings.ProjectCollectionHistoryPropertyName
DefaultBalloonTipTimeoutSecondsRowan.TfsWorkingOn.Settings.DefaultBalloonTipTimeoutSeconds
DefaultMonitorUserActivityRowan.TfsWorkingOn.Settings.DefaultMonitorUserActivity
DefaultNagEnabledRowan.TfsWorkingOn.Settings.DefaultNagEnabled
DefaultNagIntervalMinutesRowan.TfsWorkingOn.Settings.DefaultNagIntervalMinutes
DefaultPromptOnResumeRowan.TfsWorkingOn.Settings.DefaultPromptOnResume
DefaultSelectedProjectNameRowan.TfsWorkingOn.Settings.DefaultSelectedProjectName
DefaultTeamProjectCollectionAbsoluteUriRowan.TfsWorkingOn.Settings.DefaultTeamProjectCollectionAbsoluteUri
DefaultUserActivityIdleTimeoutMinutesRowan.TfsWorkingOn.Settings.DefaultUserActivityIdleTimeoutMinutes
IsDirtyPropertyNameRowan.TfsWorkingOn.Settings.IsDirtyPropertyName
ConfigurationsPathPropertyNameRowan.TfsWorkingOn.Settings.ConfigurationsPathPropertyName
WorkItemPropertyNameRowan.TfsWorkingOn.WorkingItem.WorkItemPropertyName
StartTimePropertyNameRowan.TfsWorkingOn.WorkingItem.StartTimePropertyName
StopTimePropertyNameRowan.TfsWorkingOn.WorkingItem.StopTimePropertyName
EstimatesPropertyNameRowan.TfsWorkingOn.WorkingItem.EstimatesPropertyName
StartedPropertyNameRowan.TfsWorkingOn.WorkingItem.StartedPropertyName
PausedPropertyNameRowan.TfsWorkingOn.WorkingItem.PausedPropertyName
SelectedWorkItemTypePropertyNameRowan.TfsWorkingOn.WorkingItemConfiguration .SelectedWorkItemTypePropertyName
DurationFieldPropertyNameRowan.TfsWorkingOn.WorkingItemConfiguration.DurationFieldPropertyName
RemainingFieldPropertyNameRowan.TfsWorkingOn.WorkingItemConfiguration.RemainingFieldPropertyName
ElapsedFieldPropertyNameRowan.TfsWorkingOn.WorkingItemConfiguration.ElapsedFieldPropertyName
QueryLastAccessedPropertyNameRowan.TfsWorkingOn.UserHistory.UserWorkedOnItem .QueryLastAccessedPropertyName
ProjectHistoryPropertyNameRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .ProjectHistoryPropertyName
TeamProjectCollectionAbsoluteUriPropertyNameRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .TeamProjectCollectionAbsoluteUriPropertyName
LastQueryWorkedOnFieldNameRowan.TfsWorkingOn.UserHistory.ProjectWorkedOn .LastQueryWorkedOnFieldName

Statistics

Stat
Sum:
Average:
Minimum:
Maximum:
Standard deviation:
Variance:
warningCritical    Rule warning: Fields should be declared as private
// <Name>Fields should be declared as private</Name>
warnif count > 0 from f in Application.Fields where 
 
!f.IsPrivate && 

 
// These conditions filter cases where fields 
 // doesn't represent state that should be encapsulated. 
 !f.IsGeneratedByCompiler && 
 
!f.IsSpecialName && 
 
!f.IsInitOnly && 
 
!f.IsLiteral && 
 
!f.IsEnumValue
select new { f, f.SizeOfInst }

6 fields matched

fieldsSize of instanceFull Name
cbSize4Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize
dwTime4Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.dwTime
pnlButtons4Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlButtons
btnCancel4Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel
btnSave4Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave
pnlWICtl4Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlWICtl

Statistics

Stat   Size of instance
Sum:24
Average:4
Minimum:4
Maximum:4
Standard deviation:0
Variance:0
warningCritical    Rule warning: Event handler methods should be declared private
// <Name>Event handler methods should be declared private</Name>
warnif count > 0
from m in Application.Methods where 
  
!m.IsPrivate &&

   
// A method is considered as event handler if...
   m.NbParameters==2 &&            // ...it has two parameters..
   m.Name.Contains("Object") &&    // ...of types Object...
   m.Name.Contains("EventArgs") && // ...and EventArgs
   
   
// Discard special cases
  !m.ParentType.IsDelegate &&
  
!m.IsGeneratedByCompiler

select new { m,m.Visibility }
// This rule implementation relies on the facts that:
// -> A method name contains the type of its parameters.
// -> All EventArgs derived types have the suffix "EventArgs".

1 methods matched

methodVisibilityFull Name
OnPropertyChanged(Object,PropertyChangedEventArgs)ProtectedRowan.TfsWorkingOn.UserHistory.UserWorkedOnItem.OnPropertyChanged (Object,PropertyChangedEventArgs)

Statistics

Stat   Visibility
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0

560
Purity - Immutability - Side-Effects  

warningCritical    Rule warning: Fields should be marked as ReadOnly when possible
// <Name>Fields should be marked as ReadOnly when possible</Name>
warnif count > 0 
from f in JustMyCode.Fields where 
   
f.IsImmutable && 
  
!f.IsInitOnly &&
  
!f.IsGeneratedByCompiler &&
  
!f.IsEventDelegateObject
select new { f, f.SizeOfInst } 

// A field that matches the condition IsImmutable 
// is a field that is assigned only by constructors 
// of its class.
// For an instance field, this means its value 
// will remain constant throught the lifetime 
// of the object.
// For a static field, this means its value will 
// remain constant throught the lifetime of the 
// program.
// In both cases, such field can safely be marked 
// with the C# readonly keyword 
// (ReadOnly in VB.NET).

// The condition IsInitOnly matches fields that 
// are marked with the C# readonly keyword 
// (ReadOnly in VB.NET).



7 fields matched

fieldsSize of instanceFull Name
_userActivity4Rowan.TfsWorkingOn.WorkingItem._userActivity
_nagIntervalTimer4Rowan.TfsWorkingOn.Monitor.Nag._nagIntervalTimer
_activityCheckerTimer4Rowan.TfsWorkingOn.Monitor.UserActivity._activityCheckerTimer
_activityStopWatch4Rowan.TfsWorkingOn.Monitor.UserActivity._activityStopWatch
_workingItem4Rowan.TfsWorkingOn.WinForm.FormEstimates._workingItem
pickWorkItemsControl4Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.pickWorkItemsControl
_workingItemConfiguration4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._workingItemConfiguration

Statistics

Stat   Size of instance
Sum:28
Average:4
Minimum:4
Maximum:4
Standard deviation:0
Variance:0
warningCritical    Rule warning: Structures should be immutable
// <Name>Structures should be immutable</Name>
warnif count > 0 from t in Application.Types where 
   
t.IsStructure && 
  
!t.IsImmutable

let mutableFields = t.Fields.Where(f => !f.IsImmutable)

select new { t, t.NbLinesOfCode, mutableFields }

// It is deemed as a good practice to make 
// your structure immutable.
// An object is immutable if its state doesn’t 
// change once the object has been created. 
// Consequently, a structure is immutable if 
// its instances are immutable.
// Immutable types naturally simplify code by 
// limiting side-effects.
// See some explanations on immutability and 
// how NDepend supports it here:
// http://codebetter.com/blogs/patricksmacchia/archive/2008/01/13/immutable-types-understand-them-and-use-them.aspx

1 types matched

type# lines of code (LOC)mutableFieldsFull Name
LASTINPUTINFO02 fieldsRowan.TfsWorkingOn.Monitor.LASTINPUTINFO

Statistics

Stat   # lines of code (LOC)   mutableFields
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00
warningCritical    Rule warning: Property Getters should be immutable
// <Name>Property Getters should be immutable</Name>
warnif count > 0 from m in Application.Methods where
  
m.IsPropertyGetter &&
  
( ( !m.IsStatic && m.ChangesObjectState) ||
    
(  m.IsStatic && m.ChangesTypeState) )

let fieldsAssigned = m.FieldsAssigned

select new { m, m.NbLinesOfCode, fieldsAssigned  }

// This rule might be violated in the case of object lazy initialized
// when the property getter is accessed the first time.
// But in general, the callers of a property 
// doesn't expect to change any state through the call.
    

8 methods matched

methods# lines of code (LOC)fieldsAssignedFull Name
get_SelectedProject()11 fieldRowan.TfsWorkingOn.Connection.get_SelectedProject()
get_SettingsFilePath()11 fieldRowan.TfsWorkingOn.Settings.get_SettingsFilePath()
get_ProjectCollectionHistory()11 fieldRowan.TfsWorkingOn.Settings.get_ProjectCollectionHistory()
get_Estimates()71 fieldRowan.TfsWorkingOn.WorkingItem.get_Estimates()
get_WarehouseController()51 fieldRowan.TfsWorkingOn.WorkingItemConfiguration.get_WarehouseController()
get_ResourceManager()41 fieldRowan.TfsWorkingOn.Properties.Resources.get_ResourceManager()
get_ProjectHistory()11 fieldRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .get_ProjectHistory()
get_ResourceManager()41 fieldRowan.TfsWorkingOn.WinForm.Properties.Resources.get_ResourceManager()

Statistics

Stat   # lines of code (LOC)   fieldsAssigned
Sum:240
Average:30
Minimum:10
Maximum:70
Standard deviation:2.180
Variance:4.750
warningCritical    Rule warning: Avoid static fields with a mutable field type
// <Name>Avoid static fields with a mutable field type</Name>
warnif count > 0
from f in Application.Fields
where f.IsStatic && !f.IsEnumValue && !f.IsGeneratedByCompiler && !f.IsLiteral
let fieldType = f.FieldType
where fieldType != null && 
     
!fieldType.IsThirdParty && 
     
!fieldType.IsInterface && 
     
!fieldType.IsImmutable
select new { f, 
             
mutableFieldType = fieldType , 
             
isFieldImmutable = f.IsImmutable, 
             
isFieldIsReadOnly = f.IsInitOnly }

// As explained in this blog post
// http://codebetter.com/patricksmacchia/2011/05/04/back-to-basics-usage-of-static-members
// static fields should be used to hold only constant and immutable states.

5 fields matched

fieldsmutableFieldTypeisFieldImmutableisFieldIsReadOnlyFull Name
_connectionConnectionFalseFalseRowan.TfsWorkingOn.Connection._connection
_defaultInstanceSettingsFalseFalseRowan.TfsWorkingOn.Settings._defaultInstance
defaultInstanceSettingsTrueFalseRowan.TfsWorkingOn.Properties.Settings.defaultInstance
_formSearchWorkItemsFormSearchWorkItemsFalseFalseRowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems
_formItemConfigurationFormWorkItemConfigurationFalseFalseRowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration

Statistics

Stat   mutableFieldType   isFieldImmutable   isFieldIsReadOnly
Sum:000
Average:000
Minimum:000
Maximum:000
Standard deviation:000
Variance:000
warningCritical    Rule warning: A field must not be assigned from outside its parent hierarchy types
// <Name>A field must not be assigned from outside its parent hierarchy types</Name>
warnif count > 0
from f in JustMyCode.Fields.Where(f => 
      
!f.IsPrivate && !f.IsGeneratedByCompiler && 
      
!f.IsImmutable && !f.IsEnumValue)

let methodsAssignerOutsideOfMyType = f.MethodsAssigningMe.Where(
        
m =>!m.IsGeneratedByCompiler &&
             
m.ParentType != f.ParentType && 
            
!m.ParentType.DeriveFrom(f.ParentType) )

where methodsAssignerOutsideOfMyType.Count() > 0
select new { f, methodsAssignerOutsideOfMyType }

1 fields matched

fieldmethodsAssignerOutsideOfMyTypeFull Name
cbSize1 methodRowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize

Statistics

Stat   methodsAssignerOutsideOfMyType
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Critical Rule warning: Don't assign a field from many methods
// <Name>Don't assign a field from many methods</Name>
warnif count > 0 
from f in JustMyCode.Fields where 
  
!f.IsEnumValue &&
  
!f.IsImmutable && 
  
!f.IsInitOnly &&
  
!f.IsGeneratedByCompiler &&
  
!f.IsEventDelegateObject &&
   
(f.IsPrivate || f.IsProtected)  // Don't match fields assigned outside their classes.

// The threshold 4 is arbitrary and it should avoid matching too many fields.
// Threshold is even lower for static fields because this reveals situations even more complex.
where f.MethodsAssigningMe.Count() >= (!f.IsStatic ? 4 : 2)
select new { f, 
             
f.MethodsAssigningMe, 
             
f.MethodsReadingMeButNotAssigningMe, 
             
f.MethodsUsingMe,
             
f.ParentType } 

// A field assigned from many methods is a symptom of bug-prone code.
// This situation makes harder to anticipate the field state during runtime.
// The code is then hard to read, hard to debug and hard to maintain.
// Hard-to-solve bugs due to corrupted state are often the consequence of fields anarchically assigned.
//
// The situation is even more complex if the field is static.
// Indeed, this potentially involves global random accesses from different parts of the application.
// This is why this rule provides a lower threshold for static fields.
// 
// If the object containing such field is meant to be used from multiple threads, 
// there are alarming chances that the code is unmaintainable and bugged.
// When multiple threads are involved, the rule of thumb is to use immutable objects.
//
// If the field type is a reference type (interfaces, classes, strings, delegates) 
// corrupted state might result in a NullReferenceException.
// If the field type is a value type (number, boolean, structure) 
// corrupted state might result in wrong result not even signaled by an exception sent.
//
// There is no straight advice to refactor the number of methods responsible for assigning a field.
// Solutions often involve rethinking and then rewriting a complex algorithm.
// Such field can sometime become just a variable accessed locally by a method or a closure.
// Sometime, just rethinking the life-time and the role of the parent object allows the field to become immutable 
// (i.e assigned only by the constructor).

2 fields matched

fieldsMethodsAssigningMeMethodsReadingMeButNotAssigningMeMethodsUsingMeParentTypeFull Name
_connection2 methods1 method3 methodsConnectionRowan.TfsWorkingOn.Connection._connection
_defaultInstance2 methods2 methods4 methodsSettingsRowan.TfsWorkingOn.Settings._defaultInstance

Statistics

Stat   MethodsAssigningMe   MethodsReadingMeButNotAssigningMe   MethodsUsingMe   ParentType
Sum:0000
Average:0000
Minimum:0000
Maximum:0000
Standard deviation:0000
Variance:0000

1160
Naming Conventions  

warningCritical    Rule warning: Instance fields should be prefixed with a 'm_'
// <Name>Instance fields should be prefixed with a 'm_'</Name>
warnif count > 0 from f in Application.Fields where 
  
!f.NameLike (@"^m_") && 
  
!f.IsStatic && 
  
!f.IsLiteral && 
  
!f.IsGeneratedByCompiler  && 
  
!f.IsSpecialName && 
  
!f.IsEventDelegateObject
select new { f, f.SizeOfInst } 

// This naming convention provokes debate.
// Don't hesitate to customize the regex of 
// NameLike to your preference.

151 fields matched

fieldsSize of instanceFull Name
_duration8Rowan.TfsWorkingOn.Estimates._duration
_remainingTime8Rowan.TfsWorkingOn.Estimates._remainingTime
_elapsedTime8Rowan.TfsWorkingOn.Estimates._elapsedTime
_tfsTeamProjectCollection4Rowan.TfsWorkingOn.Connection._tfsTeamProjectCollection
_teamProjectCollectionAbsoluteUri4Rowan.TfsWorkingOn.Connection._teamProjectCollectionAbsoluteUri
_workItemStore4Rowan.TfsWorkingOn.Connection._workItemStore
_selectedProjectName4Rowan.TfsWorkingOn.Connection._selectedProjectName
_selectedProject4Rowan.TfsWorkingOn.Connection._selectedProject
_balloonTipTimeoutSeconds4Rowan.TfsWorkingOn.Settings._balloonTipTimeoutSeconds
_monitorUserActivity1Rowan.TfsWorkingOn.Settings._monitorUserActivity
_nagEnabled1Rowan.TfsWorkingOn.Settings._nagEnabled
_nagIntervalMinutes4Rowan.TfsWorkingOn.Settings._nagIntervalMinutes
_promptOnResume1Rowan.TfsWorkingOn.Settings._promptOnResume
_userActivityIdleTimeoutMinutes4Rowan.TfsWorkingOn.Settings._userActivityIdleTimeoutMinutes
_isDirty1Rowan.TfsWorkingOn.Settings._isDirty
_configurationsPath4Rowan.TfsWorkingOn.Settings._configurationsPath
_projectCollectionHistory4Rowan.TfsWorkingOn.Settings._projectCollectionHistory
_workItem4Rowan.TfsWorkingOn.WorkingItem._workItem
_startTime8Rowan.TfsWorkingOn.WorkingItem._startTime
_stopTime5Rowan.TfsWorkingOn.WorkingItem._stopTime
_estimates4Rowan.TfsWorkingOn.WorkingItem._estimates
_started1Rowan.TfsWorkingOn.WorkingItem._started
_paused1Rowan.TfsWorkingOn.WorkingItem._paused
_userActivity4Rowan.TfsWorkingOn.WorkingItem._userActivity
_isDirty1Rowan.TfsWorkingOn.WorkingItemConfiguration._isDirty
_selectedWorkItemType4Rowan.TfsWorkingOn.WorkingItemConfiguration._selectedWorkItemType
_durationField4Rowan.TfsWorkingOn.WorkingItemConfiguration._durationField
_remainingField4Rowan.TfsWorkingOn.WorkingItemConfiguration._remainingField
_elapsedField4Rowan.TfsWorkingOn.WorkingItemConfiguration._elapsedField
_warehouseController4Rowan.TfsWorkingOn.WorkingItemConfiguration._warehouseController
_filename4Rowan.TfsWorkingOn.WorkingItemConfiguration._filename
_nagIntervalTimer4Rowan.TfsWorkingOn.Monitor.Nag._nagIntervalTimer
_lastInput8Rowan.TfsWorkingOn.Monitor.UserActivity._lastInput
_activityCheckerTimer4Rowan.TfsWorkingOn.Monitor.UserActivity._activityCheckerTimer
_activityStopWatch4Rowan.TfsWorkingOn.Monitor.UserActivity._activityStopWatch
cbSize4Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize
dwTime4Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.dwTime
_lastAccessed8Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem._lastAccessed
_teamProjectCollectionAbsoluteUri4Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn ._teamProjectCollectionAbsoluteUri
_projectHistory4Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn ._projectHistory
lastQueryWorkedOn5Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn.lastQueryWorkedOn
GetWarehouseStatusOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .GetWarehouseStatusOperationCompleted
BlockOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .BlockOperationCompleted
UnblockOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .UnblockOperationCompleted
ReinitializeOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .ReinitializeOperationCompleted
ChangeSettingOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .ChangeSettingOperationCompleted
RunOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .RunOperationCompleted
NotifyOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .NotifyOperationCompleted
GetNextIntervalOperationCompleted4Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .GetNextIntervalOperationCompleted
useDefaultCredentialsSetExplicitly1Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .useDefaultCredentialsSetExplicitly
results4Rowan.TfsWorkingOn.TfsWarehouse.GetWarehouseStatusCompletedEventArgs .results
results4Rowan.TfsWorkingOn.TfsWarehouse.BlockCompletedEventArgs.results
results4Rowan.TfsWorkingOn.TfsWarehouse.UnblockCompletedEventArgs.results
results4Rowan.TfsWorkingOn.TfsWarehouse.ChangeSettingCompletedEventArgs .results
results4Rowan.TfsWorkingOn.TfsWarehouse.RunCompletedEventArgs.results
results4Rowan.TfsWorkingOn.TfsWarehouse.GetNextIntervalCompletedEventArgs .results
_workingItem4Rowan.TfsWorkingOn.WinForm.FormEstimates._workingItem
components4Rowan.TfsWorkingOn.WinForm.FormEstimates.components
buttonViewWorkItem4Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonViewWorkItem
buttonSave4Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonSave
buttonCancel4Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonCancel
labelDuration4Rowan.TfsWorkingOn.WinForm.FormEstimates.labelDuration
labelElaspedTime4Rowan.TfsWorkingOn.WinForm.FormEstimates.labelElaspedTime
labelRemainingTime4Rowan.TfsWorkingOn.WinForm.FormEstimates.labelRemainingTime
textBoxDuration4Rowan.TfsWorkingOn.WinForm.FormEstimates.textBoxDuration
textBoxElapsedTime4Rowan.TfsWorkingOn.WinForm.FormEstimates.textBoxElapsedTime
textBoxRemainingTime4Rowan.TfsWorkingOn.WinForm.FormEstimates.textBoxRemainingTime
estimatesBindingSource4Rowan.TfsWorkingOn.WinForm.FormEstimates.estimatesBindingSource
pickWorkItemsControl4Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.pickWorkItemsControl
components4Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.components
workitemMenuStrip4Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.workitemMenuStrip
selectToolStripMenuItem4Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.selectToolStripMenuItem
viewToolStripMenuItem4Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.viewToolStripMenuItem
_isCanceled1Rowan.TfsWorkingOn.WinForm.FormWorkItem._isCanceled
components4Rowan.TfsWorkingOn.WinForm.FormWorkItem.components
pnlButtons4Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlButtons
btnCancel4Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel
btnSave4Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave
pnlWICtl4Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlWICtl
witControl4Rowan.TfsWorkingOn.WinForm.FormWorkItem.witControl
_workingItemConfiguration4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._workingItemConfiguration
_queryPickerControl4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._queryPickerControl
_queryPickerControlType4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._queryPickerControlType
components4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.components
folderBrowserDialog4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .folderBrowserDialog
workingItemConfigurationBindingSource4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .workingItemConfigurationBindingSource
selectedWorkItemTypeBindingSource4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .selectedWorkItemTypeBindingSource
fieldDefinitionsDurationBindingSource4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsDurationBindingSource
fieldDefinitionsRemainingBindingSource4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsRemainingBindingSource
fieldDefinitionsElapsedBindingSource4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsElapsedBindingSource
settingsBindingSource4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .settingsBindingSource
toolTipHelp4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.toolTipHelp
tabPageMappings4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.tabPageMappings
tabPageOptions4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.tabPageOptions
pictureBoxHelpMenuQuery4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .pictureBoxHelpMenuQuery
labelMenuQuery4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.labelMenuQuery
pictureBoxHelpPromptOnResume4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .pictureBoxHelpPromptOnResume
checkBoxPromptOnResume4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .checkBoxPromptOnResume
pictureBoxHelpNag4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.pictureBoxHelpNag
pictureBoxHelpUserActivity4Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .pictureBoxHelpUserActivity

Statistics

Stat   Size of instance
Sum:600
Average:3.97
Minimum:1
Maximum:8
Standard deviation:1.12
Variance:1.24
warningCritical    Rule warning: Static fields should be prefixed with a 's_'
// <Name>Static fields should be prefixed with a 's_'</Name>
warnif count > 0 from f in Application.Fields where 
  
!f.NameLike (@"^s_") && 
   
f.IsStatic && 
  
!f.IsLiteral && 
  
!f.IsGeneratedByCompiler && 
  
!f.IsSpecialName && 
  
!f.IsEventDelegateObject
select new { f, f.SizeOfInst }  

// This naming convention provokes debate.
// Don't hesitate to customize the regex of 
// NameLike to your preference.

14 fields matched

fieldsSize of instanceFull Name
_connectionN/ARowan.TfsWorkingOn.Connection._connection
_defaultInstanceN/ARowan.TfsWorkingOn.Settings._defaultInstance
_settingsFilePathN/ARowan.TfsWorkingOn.Settings._settingsFilePath
DefaultConfigurationsPathN/ARowan.TfsWorkingOn.Settings.DefaultConfigurationsPath
resourceManN/ARowan.TfsWorkingOn.Properties.Resources.resourceMan
resourceCultureN/ARowan.TfsWorkingOn.Properties.Resources.resourceCulture
defaultInstanceN/ARowan.TfsWorkingOn.Properties.Settings.defaultInstance
ProjectPickerN/ARowan.TfsWorkingOn.WinForm.FormNotificationTray.ProjectPicker
_formSearchWorkItemsN/ARowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems
_formItemConfigurationN/ARowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration
_userActivityMutexN/ARowan.TfsWorkingOn.WinForm.FormNotificationTray._userActivityMutex
_userActivityTriggeredCurrentlyProcessingN/ARowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing
resourceManN/ARowan.TfsWorkingOn.WinForm.Properties.Resources.resourceMan
resourceCultureN/ARowan.TfsWorkingOn.WinForm.Properties.Resources.resourceCulture

Statistics

Stat   Size of instance
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Methods name should begin with an Upper character
// <Name>Methods name should begin with an Upper character</Name>
warnif count > 0 from m in JustMyCode.Methods where 
  
!m.NameLike (@"^[A-Z]") && 
  
!m.IsSpecialName && 
  
!m.IsGeneratedByCompiler
select m

// The name of a regular method should 
// begin with an Upper letter.

33 methods matched

methodsFull Name
_defaultInstance_PropertyChanged(Object,PropertyChangedEventArgs)Rowan.TfsWorkingOn.Settings._defaultInstance_PropertyChanged(Object ,PropertyChangedEventArgs)
buttonViewWorkItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonViewWorkItem_Click (Object,EventArgs)
buttonSave_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonSave_Click(Object ,EventArgs)
buttonCancel_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonCancel_Click(Object ,EventArgs)
pickWorkItemsControl_PickWorkItemsListViewDoubleClicked(Object ,EventArgs)Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems .pickWorkItemsControl_PickWorkItemsListViewDoubleClicked(Object ,EventArgs)
selectToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems .selectToolStripMenuItem_Click(Object,EventArgs)
viewToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems .viewToolStripMenuItem_Click(Object,EventArgs)
btnSave_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave_Click(Object,EventArgs )
btnCancel_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel_Click(Object ,EventArgs)
buttonOK_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.buttonOK_Click (Object,EventArgs)
buttonSave_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.buttonSave_Click (Object,EventArgs)
buttonSetDirectory_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .buttonSetDirectory_Click(Object,EventArgs)
buttonCancel_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .buttonCancel_Click(Object,EventArgs)
linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs)
tabControlConfiguration_Selecting(Object,TabControlCancelEventArgs)Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .tabControlConfiguration_Selecting(Object,TabControlCancelEventArgs)
_userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs)
_nag_MonitorTriggeredEvent(Object,MonitorEventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._nag_MonitorTriggeredEvent(Object,MonitorEventArgs)
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)
notifyMenu_Closing(Object,ToolStripDropDownClosingEventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray.notifyMenu_Closing (Object,ToolStripDropDownClosingEventArgs)
refreshingWorkItemsWorker_DoWork(Object,DoWorkEventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .refreshingWorkItemsWorker_DoWork(Object,DoWorkEventArgs)
refreshingWorkItemsWorker_RunWorkerCompleted(Object ,RunWorkerCompletedEventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .refreshingWorkItemsWorker_RunWorkerCompleted(Object ,RunWorkerCompletedEventArgs)
toolStripConnect_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray.toolStripConnect_Click (Object,EventArgs)
selectWorkItemToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .selectWorkItemToolStripMenuItem_Click(Object,EventArgs)
workItemsToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .workItemsToolStripMenuItem_Click(Object,EventArgs)
queryListToolStripMenuItem_DropDownOpening(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItem_DropDownOpening(Object,EventArgs)
refreshQueryToolStripItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .refreshQueryToolStripItem_Click(Object,EventArgs)
exitToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .exitToolStripMenuItem_Click(Object,EventArgs)
viewToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .viewToolStripMenuItem_Click(Object,EventArgs)
startToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .startToolStripMenuItem_Click(Object,EventArgs)
notifyIcon_DoubleClick(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray.notifyIcon_DoubleClick (Object,EventArgs)
configureToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .configureToolStripMenuItem_Click(Object,EventArgs)
modifyEstimatesToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .modifyEstimatesToolStripMenuItem_Click(Object,EventArgs)
cancelToolStripMenuItem_Click(Object,EventArgs)Rowan.TfsWorkingOn.WinForm.FormNotificationTray .cancelToolStripMenuItem_Click(Object,EventArgs)

Statistics

Stat
Sum:
Average:
Minimum:
Maximum:
Standard deviation:
Variance:
warningCritical    Rule warning: Avoid types with name too long
// <Name>Avoid types with name too long</Name>
warnif count > 0 from t in Application.Types 
where !t.IsGeneratedByCompiler

where t.SimpleName.Length > 35 
select new { t, t.SimpleName }

      

3 types matched

typesSimpleNameFull Name
GetWarehouseStatusCompletedEventHandlerGetWarehouseStatusCompletedEventHandlerRowan.TfsWorkingOn.TfsWarehouse .GetWarehouseStatusCompletedEventHandler
GetWarehouseStatusCompletedEventArgsGetWarehouseStatusCompletedEventArgsRowan.TfsWorkingOn.TfsWarehouse.GetWarehouseStatusCompletedEventArgs
GetNextIntervalCompletedEventHandlerGetNextIntervalCompletedEventHandlerRowan.TfsWorkingOn.TfsWarehouse.GetNextIntervalCompletedEventHandler

Statistics

Stat   SimpleName
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Avoid methods with name too long
// <Name>Avoid methods with name too long</Name>
warnif count > 0 from m in Application.Methods where 
 
!m.IsExplicitInterfaceImpl &&
 
!m.IsGeneratedByCompiler &&
 
((!m.IsSpecialName && m.SimpleName.Length > 35) ||
   
// Property getter/setter are prefixed with "get_" "set_" of length 4.
  ( m.IsSpecialName && m.SimpleName.Length - 4 > 35))

select new { m, m.SimpleName }

// The regex matches methods with name longer 
// than 35 characters.
// Method Name doesn't contain the type and namespace 
// prefix, FullName does.
// The regex computes the method name length from 
// the beginning until the first open parenthesis 
// or first lower than (for generic methods).
// Explicit Interface Implementation methods are 
// discarded because their names are prefixed 
// with the interface name.
      

17 methods matched

methodsSimpleNameFull Name
ProjectCollectionHistory_ListChanged(Object,ListChangedEventArgs)ProjectCollectionHistory_ListChangedRowan.TfsWorkingOn.Settings.ProjectCollectionHistory_ListChanged (Object,ListChangedEventArgs)
WorkingItemConfiguration_PropertyChanged(Object ,PropertyChangedEventArgs)WorkingItemConfiguration_PropertyChangedRowan.TfsWorkingOn.WorkingItemConfiguration .WorkingItemConfiguration_PropertyChanged(Object ,PropertyChangedEventArgs)
get_AutomaticWorkspaceToManageWorkItemFieldMappings()get_AutomaticWorkspaceToManageWorkItemFieldMappingsRowan.TfsWorkingOn.Properties.Resources .get_AutomaticWorkspaceToManageWorkItemFieldMappings()
get_UserActivityMonitorStartedEventReason()get_UserActivityMonitorStartedEventReasonRowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorStartedEventReason()
get_UserActivityMonitorStoppedEventReason()get_UserActivityMonitorStoppedEventReasonRowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorStoppedEventReason()
get_UserActivityMonitorTriggeredEventActiveReason()get_UserActivityMonitorTriggeredEventActiveReasonRowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorTriggeredEventActiveReason()
get_UserActivityMonitorTriggeredEventIdleReason()get_UserActivityMonitorTriggeredEventIdleReasonRowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorTriggeredEventIdleReason()
get_Rowan_TfsWorkingOn_TfsWarehouse_ControllerService()get_Rowan_TfsWorkingOn_TfsWarehouse_ControllerServiceRowan.TfsWorkingOn.Properties.Settings .get_Rowan_TfsWorkingOn_TfsWarehouse_ControllerService()
OnGetWarehouseStatusOperationCompleted(Object)OnGetWarehouseStatusOperationCompletedRowan.TfsWorkingOn.TfsWarehouse.ControllerService .OnGetWarehouseStatusOperationCompleted(Object)
pickWorkItemsControl_PickWorkItemsListViewDoubleClicked(Object ,EventArgs)pickWorkItemsControl_PickWorkItemsListViewDoubleClickedRowan.TfsWorkingOn.WinForm.FormSearchWorkItems .pickWorkItemsControl_PickWorkItemsListViewDoubleClicked(Object ,EventArgs)
QueryPickerControl_OnSelectedQueryItemChanged()QueryPickerControl_OnSelectedQueryItemChangedRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .QueryPickerControl_OnSelectedQueryItemChanged()
FormWorkItemConfiguration_FormClosing(Object,FormClosingEventArgs)FormWorkItemConfiguration_FormClosingRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .FormWorkItemConfiguration_FormClosing(Object,FormClosingEventArgs)
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)queryListToolStripMenuItemDropDown_ClosingRowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)
refreshingWorkItemsWorker_RunWorkerCompleted(Object ,RunWorkerCompletedEventArgs)refreshingWorkItemsWorker_RunWorkerCompletedRowan.TfsWorkingOn.WinForm.FormNotificationTray .refreshingWorkItemsWorker_RunWorkerCompleted(Object ,RunWorkerCompletedEventArgs)
selectWorkItemToolStripMenuItem_Click(Object,EventArgs)selectWorkItemToolStripMenuItem_ClickRowan.TfsWorkingOn.WinForm.FormNotificationTray .selectWorkItemToolStripMenuItem_Click(Object,EventArgs)
queryListToolStripMenuItem_DropDownOpening(Object,EventArgs)queryListToolStripMenuItem_DropDownOpeningRowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItem_DropDownOpening(Object,EventArgs)
modifyEstimatesToolStripMenuItem_Click(Object,EventArgs)modifyEstimatesToolStripMenuItem_ClickRowan.TfsWorkingOn.WinForm.FormNotificationTray .modifyEstimatesToolStripMenuItem_Click(Object,EventArgs)

Statistics

Stat   SimpleName
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
warningCritical    Rule warning: Avoid fields with name too long
// <Name>Avoid fields with name too long</Name>
warnif count > 0 from f in Application.Fields where
 
!f.IsGeneratedByCompiler &&
  
f.Name.Length > 35
select f

// The regex matches fields with name longer 
// than 35 characters.
// Field Name doesn't contain the type and 
// namespace prefix, FullName does.
      

12 fields matched

fieldsFull Name
TeamProjectCollectionAbsoluteUriPropertyNameRowan.TfsWorkingOn.Connection .TeamProjectCollectionAbsoluteUriPropertyName
UserActivityIdleTimeoutMinutesPropertyNameRowan.TfsWorkingOn.Settings.UserActivityIdleTimeoutMinutesPropertyName
ProjectCollectionHistoryPropertyNameRowan.TfsWorkingOn.Settings.ProjectCollectionHistoryPropertyName
DefaultTeamProjectCollectionAbsoluteUriRowan.TfsWorkingOn.Settings.DefaultTeamProjectCollectionAbsoluteUri
DefaultUserActivityIdleTimeoutMinutesRowan.TfsWorkingOn.Settings.DefaultUserActivityIdleTimeoutMinutes
TeamProjectCollectionAbsoluteUriPropertyNameRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .TeamProjectCollectionAbsoluteUriPropertyName
GetWarehouseStatusOperationCompletedRowan.TfsWorkingOn.TfsWarehouse.ControllerService .GetWarehouseStatusOperationCompleted
workingItemConfigurationBindingSourceRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .workingItemConfigurationBindingSource
fieldDefinitionsDurationBindingSourceRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsDurationBindingSource
fieldDefinitionsRemainingBindingSourceRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsRemainingBindingSource
fieldDefinitionsElapsedBindingSourceRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsElapsedBindingSource
_userActivityTriggeredCurrentlyProcessingRowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing

Statistics

Stat
Sum:
Average:
Minimum:
Maximum:
Standard deviation:
Variance:

420
Source Files Organization  

warningCritical    Rule warning: Avoid defining multiple types in a source file
// <Name>Avoid defining multiple types in a source file</Name>
warnif count > 0 

// Build a lookup indexed by source files, values being a sequence of types defined in the source file.
let lookup = Application.Types.Where(t => 
                                
t.SourceFileDeclAvailable && 
                               
// except nested types and types generated by compilers!
                               !t.IsGeneratedByCompiler &&                               
                               
!t.IsNested)                                
                         
// It could make sense to not apply this rule for enumerations.
                         // && !t.IsEnumeration)

            
// We use multi-key, since a type can be declared in multiple source files.
           .ToMultiKeyLookup(t => t.SourceDecls.Select(d => d.SourceFile))
 
from @group in lookup where @group.Count() > 1
   
let sourceFile = @group.Key

   
// CQLinq doesn't let indexing result with sourceFile 
   // so we choose a typeIndex in types, 
   // preferably the type that has the file name.
   let typeWithSourceFileName = @group.FirstOrDefault(t => t.SimpleName == sourceFile.FileNameWithoutExtension)
   
let typeIndex = typeWithSourceFileName ?? @group.First()

select new { typeIndex, 
             
types = @group as IEnumerable<IType>, 
             
sourceFile.FilePathString }

3 types matched

typestypesFilePathStringFull Name
MonitorBase2 typesc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\MonitorBase.csRowan.TfsWorkingOn.Monitor.MonitorBase
UserActivity4 typesc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.csRowan.TfsWorkingOn.Monitor.UserActivity
ControllerService8 typesc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Web References\TfsWarehouse\Reference.csRowan.TfsWorkingOn.TfsWarehouse.ControllerService

Statistics

Stat   types   FilePathString
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00
warningCritical    Rule warning: Namespace name should correspond to file location
// <Name>Namespace name should correspond to file location</Name>

// For a good code organization, 
// do mirror the namespaces hierarchy and the source files directories tree.

warnif count > 0
from n in Application.Namespaces 

// Replace dots by spaces in namespace name
let dirCorresponding = n.Name.Replace('.', ' ')

// Look at source file decl of JustMyCode type's declared in n
from t in n.ChildTypes
where JustMyCode.Contains(t) && t.SourceFileDeclAvailable
from decl in t.SourceDecls
let sourceFilePath = decl.SourceFile.FilePath.ToString()

// Replace dots and path separators by spaces in source files names
where !sourceFilePath.Replace('.',' ').Replace('\\',' ').Contains(dirCorresponding)

select new { t, dirCorresponding , sourceFilePath  } 

25 types matched

typesdirCorrespondingsourceFilePathFull Name
EstimatesRowan TfsWorkingOnc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Estimates.csRowan.TfsWorkingOn.Estimates
ConnectionRowan TfsWorkingOnc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Connection.csRowan.TfsWorkingOn.Connection
SettingsRowan TfsWorkingOnc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Settings.csRowan.TfsWorkingOn.Settings
WorkingItemConfigurationRowan TfsWorkingOnc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\WorkingItemConfiguration.csRowan.TfsWorkingOn.WorkingItemConfiguration
MonitorBaseRowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\MonitorBase.csRowan.TfsWorkingOn.Monitor.MonitorBase
MonitorEventArgsRowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\MonitorBase.csRowan.TfsWorkingOn.Monitor.MonitorEventArgs
NagRowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\Nag.csRowan.TfsWorkingOn.Monitor.Nag
UserActivityRowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.csRowan.TfsWorkingOn.Monitor.UserActivity
UserActivityStateRowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.csRowan.TfsWorkingOn.Monitor.UserActivityState
LASTINPUTINFORowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.csRowan.TfsWorkingOn.Monitor.LASTINPUTINFO
SafeNativeMethodsRowan TfsWorkingOn Monitorc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.csRowan.TfsWorkingOn.Monitor.SafeNativeMethods
UserWorkedOnItemRowan TfsWorkingOn UserHistoryc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\UserHistory\UserWorkedOnItem.csRowan.TfsWorkingOn.UserHistory.UserWorkedOnItem
ProjectCollectionWorkedOnRowan TfsWorkingOn UserHistoryc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\UserHistory\ProjectCollectionWorkedOn.csRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn
ProjectWorkedOnRowan TfsWorkingOn UserHistoryc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\UserHistory\ProjectWorkedOn.csRowan.TfsWorkingOn.UserHistory.ProjectWorkedOn
FormEstimatesRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormEstimates.csRowan.TfsWorkingOn.WinForm.FormEstimates
FormEstimatesRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormEstimates.Designer.csRowan.TfsWorkingOn.WinForm.FormEstimates
FormSearchWorkItemsRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormSearchWorkItems.csRowan.TfsWorkingOn.WinForm.FormSearchWorkItems
FormSearchWorkItemsRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormSearchWorkItems.Designer.csRowan.TfsWorkingOn.WinForm.FormSearchWorkItems
FormWorkItemRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItem.csRowan.TfsWorkingOn.WinForm.FormWorkItem
FormWorkItemRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItem.Designer.csRowan.TfsWorkingOn.WinForm.FormWorkItem
FormWorkItemConfigurationRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItemConfiguration.csRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
FormWorkItemConfigurationRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItemConfiguration.Designer.csRowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
ProgramRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\Program.csRowan.TfsWorkingOn.WinForm.Program
FormNotificationTrayRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormNotificationTray.csRowan.TfsWorkingOn.WinForm.FormNotificationTray
FormNotificationTrayRowan TfsWorkingOn WinFormc:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormNotificationTray.Designer.csRowan.TfsWorkingOn.WinForm.FormNotificationTray

Statistics

Stat   dirCorresponding   sourceFilePath
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00

000
.NET Framework Usage  

  • 0 validated Rule(s)
  • 0 Rule(s) violated
  • 0 Rules or Queries with Error (syntax error, exception thrown, time-out)

1210
System  

warningCritical    Rule warning: Uri fields should be of type System.Uri
// <Name>Uri fields should be of type System.Uri</Name>
warnif count > 0 from f in Application.Fields where 
  
(f.NameLike (@"Uri$") || 
   
f.NameLike (@"Url$")) && 
  
!f.FieldTypeIs ("System.Uri".AllowNoMatch())
select new { f, f.FieldType }

// A field which name end with 'Uri' is deemed 
// as representing a uri. Such field should be of 
// type System.Uri.

3 fields matched

fieldsFieldTypeFull Name
_teamProjectCollectionAbsoluteUriStringRowan.TfsWorkingOn.Connection._teamProjectCollectionAbsoluteUri
DefaultTeamProjectCollectionAbsoluteUriStringRowan.TfsWorkingOn.Settings.DefaultTeamProjectCollectionAbsoluteUri
_teamProjectCollectionAbsoluteUriStringRowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn ._teamProjectCollectionAbsoluteUri

Statistics

Stat   FieldType
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0

210
System.Runtime.InteropServices  

warningCritical    Rule warning: Move P/Invokes to NativeMethods class
// <Name>Move P/Invokes to NativeMethods class</Name>
warnif count > 0 from m in Application.Methods where
   
m.HasAttribute ("System.Runtime.InteropServices.DllImportAttribute".AllowNoMatch()) &&
   
m.ParentType.Name != "NativeMethods"
select m

// Platform Invocation methods, such as those marked 
// with the System.Runtime.InteropServices.DllImportAttribute 
// attribute, or methods defined by using the Declare 
// keyword in Visual Basic, access unmanaged code. 
// These methods should be in one of the following classes:
//
//   - NativeMethods - This class does not suppress stack 
//     walks for unmanaged code permission. 
//     (System.Security.SuppressUnmanagedCodeSecurityAttribute 
//     must not be applied to this class.) 
//     This class is for methods that can be used 
//     anywhere because a stack walk will be performed.
//
//   - SafeNativeMethods - This class suppresses 
//     stack walks for unmanaged code permission. 
//     (System.Security.SuppressUnmanagedCodeSecurityAttribute 
//     is applied to this class.) 
//     This class is for methods that are safe 
//     for anyone to call. Callers of these methods 
//     are not required to do a full security review 
//     to ensure that the usage is secure because 
//     the methods are harmless for any caller.
//
//   - UnsafeNativeMethods - This class suppresses 
//     stack walks for unmanaged code permission. 
//     (System.Security.SuppressUnmanagedCodeSecurityAttribute 
//     is applied to this class.) This class is for 
//     methods that are potentially dangerous. Any 
//     caller of these methods must do a full security 
//     review to ensure that the usage is secure because 
//     no stack walk will be performed.

1 methods matched

methodFull Name
GetLastInputInfo(LASTINPUTINFO&)Rowan.TfsWorkingOn.Monitor.SafeNativeMethods.GetLastInputInfo (LASTINPUTINFO&)

Statistics

Stat
Sum:
Average:
Minimum:
Maximum:
Standard deviation:
Variance:

Object Oriented Design

Base class should not use derivatives
// <Name>Base class should not use derivatives</Name>
warnif count > 0 
from baseClass in JustMyCode.Types
where baseClass.IsClass && baseClass.NbChildren > 0 // <-- for optimization!
let derivedClassesUsed = baseClass.DerivedTypes.UsedBy(baseClass)
where derivedClassesUsed.Count() > 0
select new { baseClass, derivedClassesUsed }

No types matched

Class shouldn't be too deep in inheritance tree
// <Name>Class shouldn't be too deep in inheritance tree</Name>
warnif count > 0 from t in JustMyCode.Types 
where t.IsClass
let baseClasses = t.BaseClasses.ExceptThirdParty()

// Warn for classes with 3 or more base classes.
// Notice that we don't count third-party classes 
// because this rule concerns your code design,
// not third-party libraries consumed design.
where baseClasses.Count() >= 3

select new { t, baseClasses, 
                
// The metric value DepthOfInheritance takes account
                // of third-party base classes
                t.DepthOfInheritance } 

// Branches too long in the derivation should be avoided.
// See the definition of the DepthOfInheritance metric here 
// http://www.ndepend.com/Metrics.aspx#DIT

No types matched

Class with no descendant should be sealed if possible
// <Name>Class with no descendant should be sealed if possible</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
t.IsClass && 
  
t.NbChildren ==0 && 
 
!t.IsSealed && 
 
!t.IsStatic 
  
// && !t.IsPublic <-- You might want to add this condition 
  //                    if you are developing a framework
  //                    with classes that are intended to be 
  //                    sub-classed by your clients.
  orderby t.NbLinesOfCode descending
select new { t, t.NbLinesOfCode }

15 types matched

types# lines of code (LOC)Full Name
FormWorkItemConfiguration473Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration
FormNotificationTray378Rowan.TfsWorkingOn.WinForm.FormNotificationTray
FormWorkItem119Rowan.TfsWorkingOn.WinForm.FormWorkItem
FormEstimates106Rowan.TfsWorkingOn.WinForm.FormEstimates
WorkingItem95Rowan.TfsWorkingOn.WorkingItem
WorkingItemConfiguration89Rowan.TfsWorkingOn.WorkingItemConfiguration
Settings77Rowan.TfsWorkingOn.Settings
FormSearchWorkItems62Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems
UserActivity50Rowan.TfsWorkingOn.Monitor.UserActivity
Connection42Rowan.TfsWorkingOn.Connection
Estimates30Rowan.TfsWorkingOn.Estimates
Nag29Rowan.TfsWorkingOn.Monitor.Nag
ProjectCollectionWorkedOn24Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn
ProjectWorkedOn8Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn
MonitorEventArgs0Rowan.TfsWorkingOn.Monitor.MonitorEventArgs

Statistics

Stat   # lines of code (LOC)
Sum:1 582
Average:105.47
Minimum:0
Maximum:473
Standard deviation:131.28
Variance:17 235
Overrides of Method() should call base.Method()
// <Name>Overrides of Method() should call base.Method()</Name>
// Overrides of Method() should refine the behavior of base.Method().
// If base.Method() is not called, the base behavior is not refined but it is replaced.
// Violations of this rule are a sign of design flaw,
// especially if the design provides valid reasons 
// that advocates that the base behavior must be replaced and not refined.
//
// Discussions on this topic are available here:
//  http://stackoverflow.com/questions/1107022/should-i-call-the-base-class-implementation-when-overriding-a-method-in-c-sharp
//  http://stackoverflow.com/questions/2945147/make-sure-base-method-gets-called-in-c-sharp

warnif count > 0
from t in Types  // Take account of third-party types too

// Bother only classes with descendant
where t.IsClass && t.NbChildren > 0

from mBase in t.InstanceMethods
where  mBase.IsVirtual &&
      
!mBase.IsThirdParty &&
      
!mBase.IsAbstract && 
      
!mBase.IsExplicitInterfaceImpl
from mOverride in mBase.OverridesDirectDerived
where !mOverride.IsUsing(mBase)
select new { mOverride, shouldCall = mBase, definedInBaseClass = mBase.ParentType }

No methods matched

Do not hide base class methods
// <Name>Do not hide base class methods</Name>
// To fix a violation of this rule, remove or rename the method, or change the parameter signature 
// so that the method does not hide the base method.

// More on hiding vs. virtual usefulness here:
//  http://www.artima.com/intv/nonvirtual.html
//  http://blogs.msdn.com/b/ericlippert/archive/2008/05/21/method-hiding-apologia.aspx

warnif count > 0

// Define a lookup table indexing methods by their name including parameters signature.
let lookup = Methods.Where(m => !m.IsConstructor && !m.IsStatic && !m.IsGeneratedByCompiler)
                    
.ToLookup(m1 => m1.Name)

from t in Application.Types
where !t.IsStatic && t.IsClass &&
   
// Discard classes deriving directly from System.Object
   t.DepthOfInheritance > 1 
where t.BaseClasses.Any()

// For each methods not overriding any methods (new slot), 
// let's check if it hides by name some methods defined in base classe.
from m in t.InstanceMethods
where m.IsNewSlot && !m.IsExplicitInterfaceImpl && !m.IsGeneratedByCompiler

// Notice how lookup is used to quickly retrieve methods with same name as m.
// This makes the query 10 times faster than iterating each base methods to check their name.
let baseMethodsHidden = lookup[m.Name].Where(m1 => m1 != m && t.DeriveFrom(m1.ParentType))

where baseMethodsHidden.Count() > 0
select new { m, baseMethodsHidden }

No methods matched

A stateless class or structure might be turned into a static type
// <Name>A stateless class or structure might be turned into a static type</Name>
// This rule indicates stateless types that might 
// eventually be turned into static classes.
warnif count > 0 from t in JustMyCode.Types where
  
!t.IsStatic &&                  
  
!t.IsGeneric &&
   
t.InstanceFields.Count() == 0 &&

   
// Don't match:
   // --> types that implement some interfaces.
   t.NbInterfacesImplemented == 0 &&

   
// --> or classes that have sub-classes children.                            
   t.NbChildren == 0 &&

   
// --> or classes that have a base class
   ((t.IsClass && t.DepthOfDeriveFrom("System.Object".AllowNoMatch()) == 1) ||
     
t.IsStructure) 

   
select t  

No types matched

Non-static classes should be instantiated or turned to static
// <Name>Non-static classes should be instantiated or turned to static</Name>
// Notice that classes only instantiated through reflection, like plug-in root classes
// are matched by this rules.
warnif count > 0
from t in JustMyCode.Types
where  t.IsClass &&
    
//!t.IsPublic &&   // if you are developing a framework, 
                       // you might not want to match public classes
      !t.IsStatic && 
      
!t.IsAttributeClass && // Attributes class are never seen as instantiated
      !t.DeriveFrom("System.MarshalByRefObject".AllowNoMatch()) // Types instantiated through remoting infrastructure
       
// find the first constructor of t called
let ctorCalled = t.Constructors.FirstOrDefault(ctor => ctor.NbMethodsCallingMe > 0)

// match t if none of its constructors is called.
where ctorCalled == null
select new { t, t.Visibility }

No types matched

Methods should be declared static if possible
// <Name>Methods should be declared static if possible</Name>
warnif count > 0

// When an instance method can be safely declared as static you should declare it as static.
// Since it doesn't use any instance data and method of its type and base-types,
// you should consider if such a method could be moved to a static utility class
// or if it is strongly related enough to its current declaring type to stay in it.
//
// Turning an instance method into a static method is a micro performance optimization
// since a static method is a bit cheaper to invoke than an instance method.

from t in JustMyCode.Types.Where(t =>
   
!t.IsStatic && !t.IsInterface &&
   
!t.IsEnumeration && !t.IsDelegate &&
   
!t.IsGeneratedByCompiler)

let methodsThatCanBeMadeStatic = 
   
from m in t.InstanceMethods

   
// An instance method can be turned to static if it is not virtual, 
   // not using the this reference and also, not using
   // any of its class or base classes instance fields or instance methods.
   where !m.IsAbstract && !m.IsVirtual &&
         
!m.AccessThis && !m.IsExplicitInterfaceImpl &&

          
// Optimization: Using FirstOrDefault() avoid to check all members, 
          //               as soon as one member is found
          //               we know the method m cannot be made static.
          m.MembersUsed.FirstOrDefault(
              
mUsed => !mUsed.IsStatic && 
                       
(mUsed.ParentType == t || 
                        
t.DeriveFrom(mUsed.ParentType))
          
) == null 
   
select m

from m in methodsThatCanBeMadeStatic
let staticFieldsUsed = m.ParentType.StaticFields.UsedBy(m).Where(f => !f.IsGeneratedByCompiler)
select new { m, staticFieldsUsed }

3 methods matched

methodsstaticFieldsUsedFull Name
get_WorkItemTypes()0 fieldRowan.TfsWorkingOn.WorkingItemConfiguration.get_WorkItemTypes()
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)0 fieldRowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs)
notifyMenu_Closing(Object,ToolStripDropDownClosingEventArgs)0 fieldRowan.TfsWorkingOn.WinForm.FormNotificationTray.notifyMenu_Closing (Object,ToolStripDropDownClosingEventArgs)

Statistics

Stat   staticFieldsUsed
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
Constructor should not call a virtual methods
// <Name>Constructor should not call a virtual methods</Name>

// Returns constructor of a non-sealed type calling virtual methods.
// In such a situation, if a derived class overrides the method,
// then the override method will be called before the derived constructor.
// This makes the class fragile to derive from.
//
// Violations reported can be solved by re-designing object initialisation
// or by marking the parent class as sealed, if possible.

warnif count > 0
from t in Application.Types where 
   
t.IsClass &&
  
!t.IsGeneratedByCompiler &&
  
!t.IsSealed

from ctor in t.Constructors 
let virtualMethodsCalled = from mCalled in ctor.MethodsCalled
                           
where mCalled.IsVirtual &&
                                
(mCalled.ParentType == t ||
                                 
t.DeriveFrom(mCalled.ParentType))
                           
select mCalled
where virtualMethodsCalled.Count() > 0

select new { ctor , 
             
virtualMethodsCalled, 
             
// If there is no derived type, it might be 
             // an opportunity to mark t as sealed.
             t.DerivedTypes }

3 methods matched

methodsvirtualMethodsCalledDerivedTypesFull Name
.ctor()1 method0 typeRowan.TfsWorkingOn.WorkingItemConfiguration..ctor()
.ctor(WorkItemStore,String)2 methods0 typeRowan.TfsWorkingOn.WinForm.FormSearchWorkItems..ctor(WorkItemStore ,String)
.ctor(WorkItem)1 method0 typeRowan.TfsWorkingOn.WinForm.FormWorkItem..ctor(WorkItem)

Statistics

Stat   virtualMethodsCalled   DerivedTypes
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00
Avoid the Singleton pattern
//<Name>Avoid the Singleton pattern</Name>
warnif count > 0
from t in Application.Types
where !t.IsStatic && !t.IsAbstract && (t.IsClass || t.IsStructure)

// All ctors of a singleton are private
where t.Constructors.Where(ctor => !ctor.IsPrivate).Count() == 0

// A singleton contains one static field of its parent type, to reference the unique instance
let staticFieldInstances = t.StaticFields.WithFieldType(t)
where staticFieldInstances.Count() == 1
select new { t, staticFieldInstance = staticFieldInstances.First() }

// The Singleton pattern consists in syntactically enforcing that a class 
// has just one unique instance.
// At first glance, this pattern looks appealing and it is widely used.
// However, we discourage you from using singleton classes because experience
// shows that singletons often result in less testable and less maintainable code.
// More details available in these discussions:
//  http://codebetter.com/patricksmacchia/2011/05/04/back-to-basics-usage-of-static-members/
//  http://adamschepis.com/blog/2011/05/02/im-adam-and-im-a-recovering-singleton-addict/

1 types matched

typestaticFieldInstanceFull Name
Connection_connectionRowan.TfsWorkingOn.Connection

Statistics

Stat   staticFieldInstance
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
Don't assign static fields from instance methods
// <Name>Don't assign static fields from instance methods</Name>
// Assigning static fields from instance methods leads to
// poorly maintainable and non thread-safe code.
// It is advised to assign static fields inline or from class constructor.
warnif count > 0
from f in Application.Fields where 
  
f.IsStatic &&
 
!f.IsLiteral &&
 
!f.IsInitOnly &&
 
!f.IsGeneratedByCompiler &&
  
// Contract API define such a insideContractEvaluation static field
  f.Name != "insideContractEvaluation"
let assignedBy = f.MethodsAssigningMe.Where(m => !m.IsStatic)
where assignedBy .Count() > 0
select new { f, assignedBy }

3 fields matched

fieldsassignedByFull Name
_formSearchWorkItems1 methodRowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems
_formItemConfiguration1 methodRowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration
_userActivityTriggeredCurrentlyProcessing1 methodRowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing

Statistics

Stat   assignedBy
Sum:0
Average:0
Minimum:0
Maximum:0
Standard deviation:0
Variance:0
Avoid empty interfaces
// <Name>Avoid empty interfaces</Name>
warnif count > 0 from t in JustMyCode.Types where 
  
t.IsInterface && 
  
t.NbMethods == 0
select new { t, t.TypesThatImplementMe }

// Interfaces define members that provide a behavior 
// or usage contract. The functionality described by 
// the interface can be adopted by any type, 
// regardless of where the type appears in the 
// inheritance hierarchy. A type implements an 
// interface by providing implementations for the 
// interface's members. An empty interface does not 
// define any members, and as such, does not define 
// a contract that can be implemented.

// If your design includes empty interfaces that 
// types are expected to implement, you are probably 
// using an interface as a marker, or a way of 
// identifying a group of types. If this identification 
// will occur at runtime, the correct way to accomplish
// this is to use a custom attribute. Use the presence 
// or absence of the attribute, or the attribute's 
// properties, to identify the target types. If the 
// identification must occurs at compile time, then using 
// an empty interface is acceptable.

No types matched

Avoid types initialization cycles
// <Name>Avoid types initialization cycles</Name>
warnif count > 0

// The class constructor (also called static constructor, and named cctor in IL code)
// of a type, if any, is executed by the CLR at runtime, the first time the type is used.
// A cctor doesn't need to be explicitely declared in C# or VB.NET, to exist in compiled IL code.
// Having a static field inline initialization is enought to have 
// the cctor implicitely declared in the parent class or structure.
//
// If the cctor of a type t1 is using the type t2 and if the cctor of t2 is using t1,
// some type initialization unexpected and hard-to-diagnose buggy behavior can occur.
// Such a cyclic chain of initialization is not necessarily limited to two types
// and can embrace N types in the general case.
// More information on types initialization cycles can be found here:
// http://msmvps.com/blogs/jon_skeet/archive/2012/04/07/1808561.aspx
 
// The present code rule enumerates types initialization cycles.
// Some false positives can appear if some lambda expressions are defined 
// in cctors or in methods called by cctors. In such situation, this rule
// considers these lambda expressions as executed at type initialization time, 
// while it is not necessarily the case.
 
// Types initialization cycle can only happen between types of an assembly.
from assembly in Application.Assemblies
                
let cctorSuspects = assembly.ChildMethods.Where(
  
m => m.IsClassConstructor &&
       
// Optimization: types involved in a type cycle necessarily don't have type level.
       m.ParentType.Level == null)

where cctorSuspects.Count() > 1
let typesSuspects = cctorSuspects.ParentTypes().ToHashSet()

//
// dicoTmp associates to each type suspect T, a set of types from typesSuspects
// that contains at least a method or a field used directly or indirectly by the cctor of T.
//
let dicoTmp = cctorSuspects.ToDictionary(
    
cctor => cctor.ParentType,
    
cctor => ((IMember)cctor).ToEnumerable().FillIterative(
              
members => from m in members 
                         
from mUsed in (m is IMethod) ? (m as IMethod).MembersUsed : new IMember[0]
                         
where mUsed.ParentAssembly == assembly 
                         
select mUsed)
              
.DefinitionDomain
              
.Select(m => m.ParentType) // Don't need .Distinct() here, because of ToHashSet() below.
              .Except(cctor.ParentType)
              
.Intersect(typesSuspects)
              
.ToHashSet()
) 

//
// dico associates to each type suspect T, the set of types initialized (directly or indirectly)
// by the initialization of T. This second step is needed, because if a cctor of a type T1 
// calls a member of a type T2, not only the cctor of T1 triggers the initialization of T2,
// but also it triggers the initialization of all types that are initialized by T2 initialization.
//
let dico = typesSuspects.Where(t => dicoTmp[t].Count() > 0).ToDictionary(
   
typeSuspect => typeSuspect,
   
typeSuspect => typeSuspect.ToEnumerable().FillIterative(
                         
types => from t in types
                                  
from tUsed in dicoTmp[t]
                                  
select tUsed)
                   
.DefinitionDomain
                   
.Except(typeSuspect)
                   
.ToHashSet()
)


//
// Now that dico is prepared, detect the cctor cycles
//
from t in dico.Keys

   
// Thanks to the work done to build dico, it is now pretty easy
   // to spot types involved in an initialization cyle with t! 
   let usersAndUseds = from tTmp in dico[t]
                       
where dico.ContainsKey(tTmp) && dico[tTmp].Contains(t)
                       
select tTmp
   
where usersAndUseds.Count() > 0
 
   
// Here we've found type(s) both using and used by the suspect type.
   // A cycle involving the type t is found!
   let typeInitCycle = usersAndUseds.Append(t)


   
// Compute methodsCalled and fieldsUsed, useful to explore
   // how a cctor involved in a type initialization cycle, triggers other type initialization.
   let methodsCalledDepth = assembly.ChildMethods.DepthOfIsUsedBy(t.ClassConstructor)
   
let fieldsUsedDepth = assembly.ChildFields.DepthOfIsUsedBy(t.ClassConstructor)

   
let methodsCalled = methodsCalledDepth.DefinitionDomain.OrderBy(m => methodsCalledDepth[m]).ToArray()
   
let fieldsUsed = fieldsUsedDepth.DefinitionDomain.OrderBy(f => fieldsUsedDepth[f]).ToArray()

// Use the tick box to: Group cctors methods By parent types
select new { t.ClassConstructor, 
             
cctorsCycle= typeInitCycle.Select(tTmp => tTmp.ClassConstructor),

             
// methodsCalled and fieldsUsed are members used directly and indirectly by the cctor.
             // Export these members to the dependency graph (right click the cell Export/Append ... to the Graph)
             // and see how the cctor trigger the initialization of other types
             methodsCalled,
             
fieldsUsed 
}

No methods matched

API Breaking Changes

API Breaking Changes: Types
// <Name>API Breaking Changes: Types</Name>
// This rule warns if a publicly visible type is 
// not publicly visible anymore or if it has been removed.
// Such type can break the code of your clients.

warnif count > 0 from t in codeBase.OlderVersion().Application.Types
where t.IsPubliclyVisible && 

     
// The type has been removed and its parent assembly hasn't been removed ...
     ( (t.WasRemoved() && !t.ParentAssembly.WasRemoved()) ||

     
// ... or the type is not publicly visible anymore
       !t.WasRemoved() && !t.NewerVersion().IsPubliclyVisible)

select new { t,
             
NewVisibility = (t.WasRemoved() ? " " : t.NewerVersion().Visibility.ToString()) }

No types matched

API Breaking Changes: Methods
// <Name>API Breaking Changes: Methods</Name>
// This rule warns if a publicly visible method is 
// not publicly visible anymore or if it has been removed.
// Such method can break the code of your clients.

warnif count > 0 from m in codeBase.OlderVersion().Application.Methods
where m.IsPubliclyVisible && 

     
// The method has been removed and its parent type hasn't been removed ...
     ( (m.WasRemoved() && !m.ParentType.WasRemoved()) ||

     
// ... or the method is not publicly visible anymore
       !m.WasRemoved() && !m.NewerVersion().IsPubliclyVisible)

select new { m,
             
NewVisibility = (m.WasRemoved() ? " " : m.NewerVersion().Visibility.ToString()) }

No methods matched

API Breaking Changes: Fields
// <Name>API Breaking Changes: Fields</Name>
// This rule warns if a publicly visible field is 
// not publicly visible anymore or if it has been removed.
// Such field can break the code of your clients.

warnif count > 0 from f in codeBase.OlderVersion().Application.Fields
where f.IsPubliclyVisible &&

     
// The field has been removed and its parent type hasn't been removed ...
     ( (f.WasRemoved() && !f.ParentType.WasRemoved()) ||

     
// ... or the field is not publicly visible anymore
       !f.WasRemoved() && !f.NewerVersion().IsPubliclyVisible)

select new { f,
             
NewVisibility = (f.WasRemoved() ? " " : f.NewerVersion().Visibility.ToString()) }

No fields matched

API Breaking Changes: Interfaces and Abstract Classes
// <Name>API Breaking Changes: Interfaces and Abstract Classes</Name>
// This rule warns if a publicly visible interface or abstract class 
// has been changed and contains new abstract methods or 
// if some abstract methods have been removed.
// This can break the code of clients 
// that implement such interface or derive from such abstract class.

warnif count > 0 from tNewer in Application.Types where 
 
(tNewer.IsInterface || tNewer.IsClass && tNewer.IsAbstract) && 
  
tNewer.IsPubliclyVisible && 
  
tNewer.IsPresentInBothBuilds()

let tOlder = tNewer.OlderVersion() where tOlder.IsPubliclyVisible

let methodsRemoved = tOlder.Methods.Where(m => m.IsAbstract && m.WasRemoved())
let methodsAdded = tNewer.Methods.Where(m => m.IsAbstract && m.WasAdded())

where methodsAdded.Count() > 0 || methodsRemoved.Count() > 0
select new { tNewer, methodsAdded, methodsRemoved }

No types matched

Broken serializable types
// <Name>Broken serializable types</Name>
// Find breaking changes in types marked with SerializableAttribute.
warnif count > 0

from t in Application.Types where

  
// Collect types tagged with SerializableAttribute
  t.HasAttribute("System.SerializableAttribute".AllowNoMatch())  && 
 
!t.IsDelegate &&
  
t.IsPresentInBothBuilds() &&
  
t.HasAttribute(t)

  
// Find newer and older versions of NonSerializedAttribute
  let newNonSerializedAttribute = ThirdParty.Types.WithFullName("System.NonSerializedAttribute").SingleOrDefault()
  
let oldNonSerializedAttribute = newNonSerializedAttribute == null ? null : newNonSerializedAttribute.OlderVersion()

  
// Find added or removed fields not marked with NonSerializedAttribute
  let addedInstanceField = from f in t.InstanceFields where 
                             
f.WasAdded() && 
                             
(newNonSerializedAttribute == null || !f.HasAttribute(newNonSerializedAttribute))
                           
select f
  
let removedInstanceField = from f in t.OlderVersion().InstanceFields where 
                             
f.WasRemoved() && 
                             
(oldNonSerializedAttribute == null || !f.HasAttribute(oldNonSerializedAttribute))
                           
select f
  
where addedInstanceField.Count() > 0 || removedInstanceField.Count() > 0

select new { t, addedInstanceField, removedInstanceField }

// From http://msdn.microsoft.com/library/system.serializableattribute.aspx :
//   All the public and private fields in a type that are marked by the 
//   SerializableAttribute  are serialized by default, unless the type 
//   implements the ISerializable interface to  override the serialization process. 
//   The default serialization process excludes fields that are marked 
//   with the NonSerializedAttribute attribute.

No types matched

Avoid transforming immutable types into mutable types
// <Name>Avoid transforming immutable types into mutable types</Name>

// Immutability is a strong property on a type.
// Breaking immutability can result in serious problem for an algorithm consummer
// that has been written taking account of the type immutability.

// To visualize changes in code, right-click a matched type and select:
//  - Compare older and newer versions of source file
//  - Compare older and newer versions disassembled with Reflector

warnif count > 0 
from t in Application.Types where
  
t.IsPresentInBothBuilds() &&
 
!t.IsStatic &&
 
!t.IsImmutable && 
  
t.OlderVersion().IsImmutable

let mutableFields = from f in t.InstanceFields where !f.IsImmutable select f

select new { t, mutableFields }

No types matched

Avoid changing enumerations Flags status
// <Name>Avoid changing enumerations Flags status</Name>

// Being tagged with the Flags attribute is a strong property for an enumeration.
// Changing the Flags status of an enumeration has significant impact for its client.
warnif count > 0 

let oldFlags = codeBase.OlderVersion().ThirdParty.Types.WithFullName("System.FlagsAttribute").SingleOrDefault()
let newFlags = ThirdParty.Types.WithFullName("System.FlagsAttribute").SingleOrDefault()
where oldFlags != null && newFlags != null

from t in Application.Types where
  
t.IsEnumeration &&
  
t.IsPresentInBothBuilds() 
let isFlags = t.HasAttribute(newFlags)
let wasFlags = t.OlderVersion().HasAttribute(oldFlags) 
where isFlags != wasFlags
select new { t, isFlags, wasFlags }

No types matched

API: New publicly visible types
// <Name>API: New publicly visible types</Name>
// List types that are new in the public surface of your assemblies

from t in Application.Types
where t.IsPubliclyVisible && 

     
// The type has been removed and its parent assembly hasn't been removed ...
     ( (t.WasAdded() && !t.ParentAssembly.WasAdded()) ||

     
// ... or the type existed but was not publicly visible
       !t.WasAdded() && !t.OlderVersion().IsPubliclyVisible)

select new { t,
             
OldVisibility = (t.WasAdded() ? " " : t.OlderVersion().Visibility.ToString()) }

No types matched

API: New publicly visible methods
// <Name>API: New publicly visible methods</Name>
// List methods that are new in the public surface of your assemblies

from m in Application.Methods
where m.IsPubliclyVisible && 

     
// The method has been removed and its parent assembly hasn'm been removed ...
     ( (m.WasAdded() && !m.ParentType.WasAdded()) ||

     
// ... or the t existed but was not publicly visible
       !m.WasAdded() && !m.OlderVersion().IsPubliclyVisible)

select new { m,
             
OldVisibility = (m.WasAdded() ? " " : m.OlderVersion().Visibility.ToString()) }

No methods matched

API: New publicly visible fields
// <Name>API: New publicly visible fields</Name>
// List fields that are new in the public surface of your assemblies

from f in Application.Fields
where f.IsPubliclyVisible && 

     
// The method has been removed and its parent assembly hasn'f been removed ...
     ( (f.WasAdded() && !f.ParentType.WasAdded()) ||

     
// ... or the t existed but was not publicly visible
       !f.WasAdded() && !f.OlderVersion().IsPubliclyVisible)

select new { f,
             
OldVisibility = (f.WasAdded() ? " " : f.OlderVersion().Visibility.ToString()) }

No fields matched

Code Diff Summary

New assemblies
// <Name>New assemblies</Name>
from a in Application.Assemblies where a.WasAdded()
select new { a, a.NbLinesOfCode }

No assemblies matched

Assemblies removed
// <Name>Assemblies removed</Name>
from a in codeBase.OlderVersion().Application.Assemblies where a.WasRemoved()
select new { a, a.NbLinesOfCode }

No assemblies matched

Assemblies where code was changed
// <Name>Assemblies where code was changed</Name>
from a in Application.Assemblies where a.CodeWasChanged()
select new { a, a.NbLinesOfCode, 
             
oldNbLinesOfCode = a.OlderVersion().NbLinesOfCode.GetValueOrDefault() ,
             
delta = (int) a.NbLinesOfCode.GetValueOrDefault() - a.OlderVersion().NbLinesOfCode.GetValueOrDefault() }

No assemblies matched

New namespaces
// <Name>New namespaces</Name>
from n in Application.Namespaces where 
 
!n.ParentAssembly.WasAdded() &&
  
n.WasAdded()
select new { n, n.NbLinesOfCode }

No namespaces matched

Namespaces removed
// <Name>Namespaces removed</Name>
from n in codeBase.OlderVersion().Application.Namespaces where 
 
!n.ParentAssembly.WasRemoved() &&
  
n.WasRemoved()
select new { n, n.NbLinesOfCode }

No namespaces matched

Namespaces where code was changed
// <Name>Namespaces where code was changed</Name>
from n in Application.Namespaces where n.CodeWasChanged()
select new { n, n.NbLinesOfCode, 
             
oldNbLinesOfCode = n.OlderVersion().NbLinesOfCode.GetValueOrDefault() ,
             
delta = (int) n.NbLinesOfCode.GetValueOrDefault() - n.OlderVersion().NbLinesOfCode.GetValueOrDefault() }

No namespaces matched

New types
// <Name>New types</Name>
from t in Application.Types where 
 
!t.ParentNamespace.WasAdded() &&
  
t.WasAdded()
select new { t, t.NbLinesOfCode }

No types matched

Types removed
// <Name>Types removed</Name>
from t in codeBase.OlderVersion().Application.Types where 
 
!t.ParentNamespace.WasRemoved() &&
  
t.WasRemoved()
select new { t, t.NbLinesOfCode }

No types matched

Types where code was changed
// <Name>Types where code was changed</Name>
// To visualize changes in code, right-click a matched type and select:
//  - Compare older and newer versions of source file
//  - Compare older and newer versions disassembled with Reflector

from t in Application.Types where t.CodeWasChanged() 
//select new { t, t.NbLinesOfCode }
select new { t, t.NbLinesOfCode, 
             
oldNbLinesOfCode = t.OlderVersion().NbLinesOfCode ,
             
delta = (int?) t.NbLinesOfCode - t.OlderVersion().NbLinesOfCode } 
/*from t in Application.Types where t.CodeWasChanged() && t.IsPresentInBothBuild
select new { t, t.NbLinesOfCode, 
             oldNbLinesOfCode = t.OlderVersion().NbLinesOfCode ,
             delta = (int) t.NbLinesOfCode - t.OlderVersion().NbLinesOfCode }*/

No types matched

Heuristic to find types moved from one namespace or assembly to another
// <Name>Heuristic to find types moved from one namespace or assembly to another</Name>
let typesRemoved = codeBase.OlderVersion().Types.Where(t => t.WasRemoved())
let typesAdded = Types.Where(t => t.WasAdded())

from tMoved in typesAdded.Join(
   
typesRemoved,
   
t => t.Name,
   
t => t.Name,
   
(tNewer, tOlder) => new { tNewer, 
                             
OlderParentNamespace = tOlder.ParentNamespace,
                             
OlderParentAssembly = tOlder.ParentAssembly  } ) 
select tMoved

No types matched

Types directly using one or several types changed
// <Name>Types directly using one or several types changed</Name>
let typesChanged = Application.Types.Where(t => t.CodeWasChanged()).ToHashSet()

from t in JustMyCode.Types.UsingAny(typesChanged) where
  
!t.CodeWasChanged() && 
  
!t.WasAdded()
let typesChangedUsed = t.TypesUsed.Intersect(typesChanged) 
select new { t, typesChangedUsed }

No types matched

Types indirectly using one or several types changed
// <Name>Types indirectly using one or several types changed</Name>
let typesChanged = Application.Types.Where(t => t.CodeWasChanged()).ToHashSet()

// 'depth' represents a code metric defined on types using
// directly or indirectly any type where code was changed.
let depth = JustMyCode.Types.DepthOfIsUsingAny(typesChanged) 

from t in depth.DefinitionDomain where
  
!t.CodeWasChanged() && 
  
!t.WasAdded()

let typesChangedDirectlyUsed = t.TypesUsed.Intersect(typesChanged) 
let depthOfUsingTypesChanged = depth[t]
orderby depthOfUsingTypesChanged 

select new { t, depthOfUsingTypesChanged, typesChangedDirectlyUsed }

No types matched

New methods
// <Name>New methods</Name>
from m in Application.Methods where 
 
!m.ParentType.WasAdded() &&
  
m.WasAdded()
select new { m, m.NbLinesOfCode }

No methods matched

Methods removed
// <Name>Methods removed</Name>
from m in codeBase.OlderVersion().Application.Methods where 
 
!m.ParentType.WasRemoved() &&
  
m.WasRemoved()
select new { m, m.NbLinesOfCode }

No methods matched

Methods where code was changed
// <Name>Methods where code was changed</Name>
// To visualize changes in code, right-click a matched method and select:
//  - Compare older and newer versions of source file
//  - Compare older and newer versions disassembled with Reflector

from m in Application.Methods where m.CodeWasChanged()
select new { m, m.NbLinesOfCode, 
             
oldNbLinesOfCode = m.OlderVersion().NbLinesOfCode ,
             
delta = (int?) m.NbLinesOfCode - m.OlderVersion().NbLinesOfCode }

No methods matched

Methods directly calling one or several methods changed
// <Name>Methods directly calling one or several methods changed</Name>
let methodsChanged = Application.Methods.Where(m => m.CodeWasChanged()).ToHashSet()

from m in JustMyCode.Methods.UsingAny(methodsChanged ) where
  
!m.CodeWasChanged() && 
  
!m.WasAdded()
let methodsChangedCalled = m.MethodsCalled.Intersect(methodsChanged) 
select new { m, methodsChangedCalled }

No methods matched

Methods indirectly calling one or several methods changed
// <Name>Methods indirectly calling one or several methods changed</Name>
let methodsChanged = Application.Methods.Where(m => m.CodeWasChanged()).ToHashSet()

// 'depth' represents a code metric defined on methods using
// directly or indirectly any method where code was changed.
let depth = JustMyCode.Methods.DepthOfIsUsingAny(methodsChanged) 

from m in depth.DefinitionDomain where
  
!m.CodeWasChanged() && 
  
!m.WasAdded()

let methodsChangedDirectlyUsed = m.MethodsCalled.Intersect(methodsChanged) 
let depthOfUsingMethodsChanged = depth[m]
orderby depthOfUsingMethodsChanged 

select new { m, depthOfUsingMethodsChanged, methodsChangedDirectlyUsed }

No methods matched

New fields
// <Name>New fields</Name>
from f in Application.Fields where 
 
!f.ParentType.WasAdded() &&
  
f.WasAdded()
select new { f }

No fields matched

Fields removed
// <Name>Fields removed</Name>
from f in codeBase.OlderVersion().Application.Fields where 
 
!f.ParentType.WasRemoved() &&
  
f.WasRemoved()
select new { f }

No fields matched

Third party types that were not used and that are now used
// <Name>Third party types that were not used and that are now used</Name>
from t in ThirdParty.Types where t.IsUsedRecently()
select new { t, t.Methods, t.Fields, t.TypesUsingMe }

No types matched

Third party types that were used and that are not used anymore
// <Name>Third party types that were used and that are not used anymore</Name>
from t in codeBase.OlderVersion().Types where t.IsNotUsedAnymore()
select new { t, t.Methods, t.Fields, TypesThatUsedMe = t.TypesUsingMe }

No types matched

Third party methods that were not used and that are now used
// <Name>Third party methods that were not used and that are now used</Name>
from m in ThirdParty.Methods where 
  
m.IsUsedRecently() &&
 
!m.ParentType.IsUsedRecently()
select new { m, m.MethodsCallingMe }

No methods matched

Third party methods that were used and that are not used anymore
// <Name>Third party methods that were used and that are not used anymore</Name>
from m in codeBase.OlderVersion().Methods where 
  
m.IsNotUsedAnymore() &&
 
!m.ParentType.IsNotUsedAnymore()
select new { m, MethodsThatCalledMe = m.MethodsCallingMe}

No methods matched

Third party fields that were not used and that are now used
// <Name>Third party fields that were not used and that are now used</Name>
from f in ThirdParty.Fields where 
  
f.IsUsedRecently() &&
 
!f.ParentType.IsUsedRecently()
select new { f, f.MethodsUsingMe }

No fields matched

Third party fields that were used and that are not used anymore
// <Name>Third party fields that were used and that are not used anymore</Name>
from f in codeBase.OlderVersion().Fields where 
  
f.IsNotUsedAnymore() &&
 
!f.ParentType.IsNotUsedAnymore()
select new { f, MethodsThatUsedMe = f.MethodsUsingMe }

No fields matched

Test and Code Coverage

C.R.A.P method code metric
// <Name>C.R.A.P method code metric</Name>
// Change Risk Analyzer and Predictor (i.e. CRAP) code metric
// This code metric helps in pinpointing overly complex and untested code.
// Reference: http://www.artima.com/weblogs/viewpost.jsp?thread=215899
// Formula:   CRAP(m) = comp(m)^2 * (1 – cov(m)/100)^3 + comp(m)
warnif count > 0
from m in JustMyCode.Methods

// Don't match too short methods
where m.NbLinesOfCode > 10

let CC = m.CyclomaticComplexity
let uncov = (100 - m.PercentageCoverage) / 100f
let CRAP = (CC * CC * uncov * uncov * uncov) + CC
where CRAP != null && CRAP > 30
orderby CRAP descending, m.NbLinesOfCode descending
select new { m, CRAP, CC, uncoveredPercentage = uncov*100, m.NbLinesOfCode }

No methods matched

Complex methods partially covered by tests should be 100% covered
// <Name>Complex methods partially covered by tests should be 100% covered</Name>
warnif count > 0 from m in JustMyCode.Methods 
 
where 
     
// These metrics' definitions are available here: 
     // http://www.ndepend.com/Metrics.aspx#MetricsOnMethods
     (  m.NbLinesOfCode > 30 || 
        
m.ILCyclomaticComplexity > 50 || 
        
m.ILNestingDepth > 4 || 
        
m.NbVariables > 8) && 

     
// Take care only of complex methods 
     // already partially covered, but not completely covered.
     m.PercentageCoverage > 0 &&
     
m.PercentageCoverage < 100

  
orderby m.NbLinesOfCodeNotCovered ascending,
          
m.NbLinesOfCode descending
select new { m, m.PercentageCoverage, m.NbLinesOfCode, 
             
m.NbLinesOfCodeCovered, m.NbLinesOfCodeNotCovered, 
             
m.ILCyclomaticComplexity, m.ILNestingDepth, m.NbVariables }  

No methods matched

Method changed poorly covered
// <Name>Method changed poorly covered</Name>
from m in Application.Methods where 
  
m.PercentageCoverage < 30 && 
  
m.CodeWasChanged() 
  
orderby m.NbLinesOfCode descending, 
           
m.NbLinesOfCodeNotCovered ,
           
m.PercentageCoverage
select new { m, m.PercentageCoverage, m.NbLinesOfCode, 
             
m.NbLinesOfCodeNotCovered }  

No methods matched

Method added poorly covered
// <Name>Method added poorly covered</Name>
from m in Application.Methods where
  
m.NbLinesOfCode > 0 &&
  
m.PercentageCoverage < 30 && 
  
m.WasAdded() 
  
orderby m.NbLinesOfCode descending, 
           
m.NbLinesOfCodeNotCovered ,
           
m.PercentageCoverage
select new { m, m.PercentageCoverage, m.NbLinesOfCode, 
             
m.NbLinesOfCodeNotCovered } 

No methods matched

Types 95% to 99% covered
// <Name>Types 95% to 99% covered</Name>
from t in Application.Types where 
  
t.PercentageCoverage >= 95 && 
  
t.PercentageCoverage <= 99 &&
 
!t.IsGeneratedByCompiler

  
let methodsCulprit = t.Methods.Where(m => m.PercentageCoverage < 100)

  
orderby t.NbLinesOfCode descending , 
           
t.NbLinesOfCodeNotCovered ,
           
t.PercentageCoverage
select new { t, t.PercentageCoverage, t.NbLinesOfCode, 
             
t.NbLinesOfCodeNotCovered, methodsCulprit } 

// Having types 100% covered by tests is a good idea because 
// the small portion of code hard to cover, is also the 
// portion of code that is the most likely to contain bugs.

No types matched

Namespaces 95% to 99% covered
// <Name>Namespaces 95% to 99% covered</Name>
from n in Application.Namespaces where 
  
n.PercentageCoverage >= 95 && 
  
n.PercentageCoverage <= 99 

  
let methodsCulprit = n.ChildMethods.Where(m => m.PercentageCoverage < 100)

  
orderby n.NbLinesOfCode descending , 
           
n.NbLinesOfCodeNotCovered ,
           
n.PercentageCoverage
select new { n, n.PercentageCoverage, n.NbLinesOfCode, 
             
n.NbLinesOfCodeNotCovered, methodsCulprit  } 

// Having types 100% covered by tests is a good idea because 
// the small portion of code hard to cover, is also the 
// portion of code that is the most likely to contain bugs.

No namespaces matched

Types tagged with FullCoveredAttribute should be 100% covered
// <Name>Types tagged with FullCoveredAttribute should be 100% covered</Name>
warnif count > 0 
from t in Application.Types where
  
t.HasAttribute ("NDepend.Attributes.FullCoveredAttribute".AllowNoMatch()) &&
  
t.PercentageCoverage < 100

let notFullCoveredMethods = t.Methods.Where(
                               
m =>  m.NbLinesOfCode> 0 && 
                                     
m.PercentageCoverage < 100 &&
                                    
!m.HasAttribute("NDepend.Attributes.UncoverableByTestAttribute".AllowNoMatch()))

orderby t.NbLinesOfCodeNotCovered descending 

select new { t, t.PercentageCoverage, t.NbLinesOfCodeNotCovered, notFullCoveredMethods,
                
t.NbLinesOfCode, t.NbLinesOfCodeCovered }

// By using a FullCoveredAttribute, you can signify to developers
// that a class is, and must remain in the future, 100% covered by tests.
// If you don't want to link NDepend.API.dll, 
// you can use your own attribute and adapt this rule.

// Having types 100% covered by tests is a good idea because 
// the small portion of code hard to cover, is also the 
// portion of code that is the most likely to contain bugs.

No types matched

Types 100% covered should be tagged with FullCoveredAttribute
// <Name>Types 100% covered should be tagged with FullCoveredAttribute</Name>
warnif count > 0 from t in JustMyCode.Types where
 
!t.HasAttribute ("NDepend.Attributes.FullCoveredAttribute".AllowNoMatch()) &&
  
t.PercentageCoverage == 100 &&
 
!t.IsGeneratedByCompiler
select new { t, t.NbLinesOfCode }

// By using a FullCoveredAttribute, you can signify to developers
// that a class is, and must remain in the future, 100% covered by tests.
// If you don't want to link NDepend.API.dll, you can use your own attribute and adapt this rule.

// Having types 100% covered by tests is a good idea because 
// the small portion of code hard to cover, is also the 
// portion of code that is the most likely to contain bugs.

No types matched

Types not covered at all
// <Name>Types not covered at all</Name>
from t in Application.Types where 
  
t.PercentageCoverage == 0
  
orderby t.NbLinesOfCode descending
select new { t, t.NbLinesOfCode } 

No types matched

Namespaces not covered at all
// <Name>Namespaces not covered at all</Name>
from n in Application.Namespaces where 
  
n.PercentageCoverage == 0
  
orderby n.NbLinesOfCode descending
select new { n, n.NbLinesOfCode} 

No namespaces matched

Test Methods
// <Name>Test Methods</Name>

// We advise to not include test assemblies in code analyzed by NDepend.
// But if you wish the current query to run properly, 
// you'll need to consider test assemblies in your list of application assemblies analyzed by NDepend..

let testAttr = ThirdParty.Types.WithNameIn("TestAttribute", "TestCaseAttribute")
let testMethods = Methods.TaggedWithAnyAttributes(testAttr)
from m in testMethods 
select m

No methods matched

Methods directly called by test Methods
// <Name>Methods directly called by test Methods</Name>

// Lists all methods directly called by tests methods.
// Overrides of virtual and absract methods, called through polymorphism, are not listed.
// Methods solely invoked through a delegate are not listed.
// Methods solely invoked through reflection are not listed.

// We advise to not include test assemblies in code analyzed by NDepend.
// But if you wish the current query to run properly, 
// you'll need to consider test assemblies in your list of application assemblies analyzed by NDepend..

let testAttr = ThirdParty.Types.WithNameIn("TestAttribute", "TestCaseAttribute")
let testMethods = Methods.TaggedWithAnyAttributes(testAttr).ToHashSet()

// --- Uncomment this line if your test methods are in dedicated test assemblies ---
//let testAssemblies = testMethods.ParentAssemblies().ToHashSet()

from m in Application.Methods.UsedByAny(testMethods)

// --- Uncomment this line if your test methods are in dedicated test assemblies ---
//where !testAssemblies.Contains(m.ParentAssembly)

select new { m , 
             
calledByTests = m.MethodsCallingMe.Intersect(testMethods ),
             
// --- Uncomment this line if your project import some coverage data ---
             // m.PercentageCoverage 
}

No methods matched

Methods directly and indirectly called by test Methods
// <Name>Methods directly and indirectly called by test Methods</Name>

// Lists all methods called directly or indirectly by tests methods.
// Overrides of virtual and absract methods, called through polymorphism, are not listed.
// Methods solely invoked through a delegate are not listed.
// Methods solely invoked through reflection are not listed.

// We advise to not include test assemblies in code analyzed by NDepend.
// But if you wish the current query to run properly, 
// you'll need to consider test assemblies in your list of application assemblies analyzed by NDepend.

let testAttr = from t in ThirdParty.Types.WithNameIn("TestAttribute", "TestCaseAttribute") select t
let testMethods = Methods.TaggedWithAnyAttributes(testAttr)

// --- Uncomment this line if your test methods are in dedicated test assemblies ---
// let testAssemblies = testMethods.ParentAssemblies().ToHashSet()

let depthOfCalledByTest = Application.Methods.DepthOfIsUsedByAny(testMethods)
from pair in depthOfCalledByTest
where pair.Value > 0 
orderby pair.Value ascending
// --- Uncomment this line if your test methods are in dedicated test assemblies ---
//&& !testAssemblies.Contains(pair.CodeElement.ParentAssembly)

select new { 
  
method = pair.CodeElement, 
  
// (depthOfCalledByTests == 1) means that the method is directly called by tests
  // (depthOfCalledByTests == 2) means that the method is directly called by a method directly called by tests
  // ...
  depthOfCalledByTests = pair.Value,
  
// --- Uncomment this line if your project import some coverage data ---
  // m.PercentageCoverage
}

No methods matched

Dead Code

Potentially dead Types
// <Name>Potentially dead Types</Name>
warnif count > 0
// Filter procedure for types that should'nt be considered as dead
let canTypeBeConsideredAsDeadProc = new Func<IType, bool>(
   
t => !t.IsPublic && //   Public types might be used by client applications of your assemblies.
         t.Name != "Program" && 
        
!t.IsGeneratedByCompiler &&

         
// If you don't want to link NDepend.API.dll, you can use your own IsNotDeadCodeAttribute and adapt this rule.
        !t.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&

        
// Exclude static types that define only const fields
        // because they cannot be seen as used in IL code.
        !(t.IsStatic && t.NbMethods == 0 && !t.Fields.Where(f => !f.IsLiteral).Any()))


// Select types unused
let typesUnused = 
   
from t in JustMyCode.Types where
   
t.NbTypesUsingMe == 0 && canTypeBeConsideredAsDeadProc(t)
   
select t

// Dead types = types used only by unused types (recursive)
let deadTypesMetric = typesUnused.FillIterative(
types => from t in codeBase.Application.Types.UsedByAny(types).Except(types)
         
where canTypeBeConsideredAsDeadProc(t) &&
               
t.TypesUsingMe.Intersect(types).Count() == t.NbTypesUsingMe
         
select t)

from t in deadTypesMetric.DefinitionDomain
select new { t, t.TypesUsingMe, depth = deadTypesMetric[t] }

No types matched

Potentially dead Methods
// <Name>Potentially dead Methods</Name>
warnif count > 0
// Filter procedure for methods that should'nt be considered as dead
let canMethodBeConsideredAsDeadProc = new Func<IMethod, bool>(
    
m => !m.IsPubliclyVisible &&       // Public methods might be used by client applications of your assemblies.
         !m.IsEntryPoint &&            // Main() method is not used by-design.
         !m.IsExplicitInterfaceImpl && // The IL code never explicitely calls explicit interface methods implementation.
         !m.IsClassConstructor &&      // The IL code never explicitely calls class constructors.
         !m.IsFinalizer &&             // The IL code never explicitely calls finalizers.
         !m.IsVirtual &&               // Only check for non virtual method that are not seen as used in IL.
         !(m.IsConstructor &&          // Don't take account of protected ctor that might be call by a derived ctors.
           m.IsProtected) &&
         
!m.IsEventAdder &&            // The IL code never explicitely calls events adder/remover.
         !m.IsEventRemover &&
         
!m.IsGeneratedByCompiler &&
         
!m.ParentType.IsDelegate &&

         
// Methods tagged with these two attributes are called by the serialization infrastructure.
         !m.HasAttribute("System.Runtime.Serialization.OnSerializingAttribute".AllowNoMatch()) &&
         
!m.HasAttribute("System.Runtime.Serialization.OnDeserializedAttribute".AllowNoMatch()) &&

         
// If you don't want to link NDepend.API.dll, you can use your own IsNotDeadCodeAttribute and adapt this rule.
         !m.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()))

// Get methods unused
let methodsUnused = 
   
from m in JustMyCode.Methods where 
   
m.NbMethodsCallingMe == 0 && 
   
canMethodBeConsideredAsDeadProc(m)
   
select m

// Dead methods = methods used only by unused methods (recursive)
let deadMethodsMetric = methodsUnused.FillIterative(
   
methods => // Unique loop, just to let a chance to build the hashset.
              from o in (new object()).ToEnumerable()
              
// Use a hashet to make Intersect calls much faster!
              let hashset = methods.ToHashSet()
              
from m in codeBase.Application.Methods.UsedByAny(methods).Except(methods)
              
where canMethodBeConsideredAsDeadProc(m) &&
                    
// Select methods called only by methods already considered as dead
                    hashset.Intersect(m.MethodsCallingMe).Count() == m.NbMethodsCallingMe
              
select m)

from m in JustMyCode.Methods.Intersect(deadMethodsMetric.DefinitionDomain)
select new { m, m.MethodsCallingMe, depth = deadMethodsMetric[m] }

2 methods matched

methodsMethodsCallingMedepthFull Name
get_TeamProjectCollectionUri()0 method0Rowan.TfsWorkingOn.Connection.get_TeamProjectCollectionUri()
linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs)0 method0Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs)

Statistics

Stat   MethodsCallingMe   depth
Sum:00
Average:00
Minimum:00
Maximum:00
Standard deviation:00
Variance:00
Potentially dead Fields
// <Name>Potentially dead Fields</Name>
warnif count > 0
from f in JustMyCode.Fields where
   
f.NbMethodsUsingMe == 0 && 
   
!f.IsPublic &&     // Although not recommended, public fields might be used by client applications of your assemblies.
   !f.IsLiteral &&    // The IL code never explicitely uses literal fields.
   !f.IsEnumValue &&  // The IL code never explicitely uses enumeration value.
   f.Name !=  "value__"  && // Field named 'value__' are relative to enumerations and the IL code never explicitely uses them.
   !f.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&
   
!f.IsGeneratedByCompiler
   
// If you don't want to link NDepend.API.dll, you can use your own IsNotDeadCodeAttribute and adapt this rule.
select f

No fields matched

Wrong usage of IsNotDeadCodeAttribute
// <Name>Wrong usage of IsNotDeadCodeAttribute</Name>

// This IsNotDeadCodeAttribute can be used to signify that 
// despite a member could be removed without provoking any syntax error 
// (we also say it is dead code), your intention is to not remove this member.
// Default 'Dead Code' code rules take account of this attribute.
// IsNotDeadCodeAttribute is defined in NDepend.API.dll
// If you don't want to link NDepend.API.dll, you can use 
// your own IsNotDeadCodeAttribute and adapt this rule.
warnif count == 1

let tAttr = Types.WithFullName("NDepend.Attributes.IsNotDeadCodeAttribute").FirstOrDefault()
where tAttr != null

// Get types that do a wrong usage of IsNotDeadCodeAttribute
let types = from t in Application.Types where 
   
t.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&

   
( // types used don't need to be tagged with IsNotDeadCodeAttribute!
     t.NbTypesUsingMe > 0  ||
   
     
// Static types that define only const fields cannot be seen as used in IL code.
     // They don't need to be tagged with IsNotDeadCodeAttribute.
     (t.IsStatic && t.NbMethods == 0 && !t.Fields.Where(f => !f.IsLiteral).Any())
   
)
   
select t

// Get methods that do a wrong usage of IsNotDeadCodeAttribute
let methods = from m in Application.Methods where 
   
m.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&
   
m.NbMethodsCallingMe > 0
   
select m

// Get fields that do a wrong usage of IsNotDeadCodeAttribute
let fields = from f in Application.Fields where 
   
f.HasAttribute("NDepend.Attributes.IsNotDeadCodeAttribute".AllowNoMatch()) &&
   
f.NbMethodsUsingMe > 0
   
select f

where types.Count() > 0 || methods.Count() > 0 || fields.Count() > 0
select new { tAttr, types , methods, fields }

No types matched

Trend Charts

Unfortunately, Google Terms of Service prohibit saving the Chart API on your machine for offline use as stated at https://developers.google.com/chart/interactive/faq#localdownload

We could not connect to https://www.google.com/jsapi to retrieve the script. We will display chart data in a table instead.

Please connect to the internet and reload the page to display the chart.

No Trend Data has been logged for this project.
If it is the first time that you analyze this project, please re-analyze it a second time and rebuild the report.

Assemblies Dependencies

Assembly Depends on Is referenced by
Rowan.TfsWorkingOn v1.3.5029.15445mscorlib v4.0.0.0 ; System v4.0.0.0 ; System.Web.Services v4.0.0.0 ; System.Xml v4.0.0.0 ; System.Core v4.0.0.0 ; TfsWorkingOn v1.3.5029.15447 ;
TfsWorkingOn v1.3.5029.15447System.Windows.Forms v4.0.0.0 ; mscorlib v4.0.0.0 ; Rowan.TfsWorkingOn v1.3.5029.15445 ; System v4.0.0.0 ; System.Drawing v4.0.0.0 ; System.Core v4.0.0.0 ; Microsoft.CSharp v4.0.0.0 ; -

Assemblies Build Order

  1. Rowan.TfsWorkingOn
  2. TfsWorkingOn

Assemblies Build Order

  1. Rowan.TfsWorkingOn
  2. TfsWorkingOn

Analysis Log : Information and Warnings

Here are Logs emitted during NDepend analysis.
The Warnings can reveal potential flaws concerning the health of the build process.
A particular warn can be disabled through the NDepend interactive UI, panel Error List, tick the checkbox Disabled corresponding to the warn to disable.


Kind Message
Info11/05/2013 15:02:37 Begin full analysis with NDepend v5.0.0.8085
InfoNo Baseline for Comparison loaded.
WarningCan't load the assembly {Microsoft.TeamFoundation.Client}: Can't find the .NET assembly {Microsoft.TeamFoundation.Client} in specified folders. Has it been compiled properly? Is the NDepend project missing the containing folder of the .NET assembly?
WarningCan't load the assembly {Microsoft.TeamFoundation.WorkItemTracking.Client}: Can't find the .NET assembly {Microsoft.TeamFoundation.WorkItemTracking.Client} in specified folders. Has it been compiled properly? Is the NDepend project missing the containing folder of the .NET assembly?
WarningCan't load the assembly {Microsoft.TeamFoundation.VersionControl.Client}: Can't find the .NET assembly {Microsoft.TeamFoundation.VersionControl.Client} in specified folders. Has it been compiled properly? Is the NDepend project missing the containing folder of the .NET assembly?
WarningCan't load the assembly {Microsoft.TeamFoundation.WorkItemTracking.Controls}: Can't find the .NET assembly {Microsoft.TeamFoundation.WorkItemTracking.Controls} in specified folders. Has it been compiled properly? Is the NDepend project missing the containing folder of the .NET assembly?
InfoConcurrent mode
Info.NET Assembly loaded from {C:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\bin\Debug} Rowan.TfsWorkingOn.dll v1.3.5029.15445
Info.NET Assembly loaded from {C:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\bin\Debug} TfsWorkingOn.exe v1.3.5029.15447
Info.NET Assemblies loaded from {C:\Windows\Microsoft.NET\Framework\v4.0.30319} mscorlib.dll v4.0.0.0 System.dll v4.0.0.0 System.Web.Services.dll v4.0.0.0 System.Xml.dll v4.0.0.0 System.Core.dll v4.0.0.0 System.Windows.Forms.dll v4.0.0.0 System.Drawing.dll v4.0.0.0 Microsoft.CSharp.dll v4.0.0.0
WarningNo application or third party assembly found in folder {C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF}
WarningAssembly {Microsoft.TeamFoundation.WorkItemTracking.Controls} is referenced by {TfsWorkingOn} but is not found.
WarningAssembly {Microsoft.TeamFoundation.WorkItemTracking.Client} is referenced by {TfsWorkingOn} but is not found.
WarningAssembly {Microsoft.TeamFoundation.Client} is referenced by {TfsWorkingOn} but is not found.
WarningAssembly {Microsoft.TeamFoundation.Client} is referenced by {Rowan.TfsWorkingOn} but is not found.
WarningAssembly {Microsoft.TeamFoundation.WorkItemTracking.Client} is referenced by {Rowan.TfsWorkingOn} but is not found.
WarningAssembly {Microsoft.TeamFoundation.VersionControl.Client} is referenced by {Rowan.TfsWorkingOn} but is not found.
WarningThe source file {c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItemConfiguration.cs} (last modified 8/10/2013 9:11:55 AM) and the PDB file of the assembly {TfsWorkingOn} (last modified 8/10/2013 8:34:55 AM) are not in-sync.
WarningThe source file {c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItemConfiguration.Designer.cs} (last modified 8/10/2013 9:11:55 AM) and the PDB file of the assembly {TfsWorkingOn} (last modified 8/10/2013 8:34:55 AM) are not in-sync.
WarningThe source file {c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\SolutionInfo.cs} (last modified 8/10/2013 9:00:15 AM) and the PDB file of the assembly {TfsWorkingOn} (last modified 8/10/2013 8:34:55 AM) are not in-sync.
WarningThe source file {c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\WorkingItem.cs} (last modified 8/10/2013 9:24:28 AM) and the PDB file of the assembly {Rowan.TfsWorkingOn} (last modified 8/10/2013 8:34:51 AM) are not in-sync.
WarningThe source file {c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\SolutionInfo.cs} (last modified 8/10/2013 9:00:15 AM) and the PDB file of the assembly {Rowan.TfsWorkingOn} (last modified 8/10/2013 8:34:51 AM) are not in-sync.
Info30 source files parsed ; all source files found ; 5 source files not in-sync with PDB
Info0 code rule has been extracted from code.
InfoNo dependency cycle detected in assemblies referencement graph.
Info11/05/2013 15:02:37 Analyse dependencies of your application.
Info11/05/2013 15:02:38 Building the report (standard).
Warning3 critical rules are violated. - Avoid namespaces mutually dependent - Potentially dead Methods - Don't assign a field from many methods
Info11/05/2013 15:02:40 Log trend metrics values.