It is recommended to use the NDepend interactive UI capabilities
to make the most of NDepend by mastering all aspects of your code.
Diagrams
Application Metrics
Note: Further Application Statistics are available.
|
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

development-time, from within Visual
Studio. Online documentation.

existing code base? Use the option
Recent Violations Only!

can be used to break the build process if
violated. Online documentation.
Application Statistics
Stat | # Occurences | Avg | StdDev | Max |
---|---|---|---|---|
Properties on interfaces | interfaces | 0 | 0 | -1 properties on |
Methods on interfaces | interfaces | 0 | 0 | -1 methods on |
Arguments on methods on interfaces | methods | 0 | 0 | -1 arguments on |
Public properties on classes | 41 Classes | 1.61 | 2.62 | 12 public properties on Rowan.TfsWorkingOn.Settings |
Public methods on classes | 41 classes | 6.07 | 8.96 | 46 public methods on Rowan.TfsWorkingOn.TfsWarehouse.ControllerService |
Arguments on public methods on classes | 249 methods | 0.75 | 0.89 | 4 arguments on Rowan.TfsWorkingOn.TfsWarehouse.GetWarehouseStatusCompletedEventHandler.BeginInvoke(Object,GetWarehouseStatusCompletedEventArgs,AsyncCallback,Object) |
IL instructions in non-abstract methods | 469 methods | 29.05 | 118.04 | 2321 IL instructions in Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.InitializeComponent() |
Cyclomatic complexity on non abstract Methods | 469 Methods | 1.75 | 1.8 | CC = 14 for Rowan.TfsWorkingOn.WinForm.FormNotificationTray._userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs) |
Assemblies Metrics
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 | % Coverage | Afferent Coupling | Efferent Coupling | Relational Cohesion | Instability | Abstractness | Distance |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Rowan.TfsWorkingOn v1.3.5029.15445 | 611 | 5656 | 35 | 1 | 290 | 32 | - | 4 | 95 | 1.66 | 0.96 | 0.03 | 0.01 |
TfsWorkingOn v1.3.5029.15447 | 1202 | 7967 | 9 | 0 | 592 | 32 | - | 0 | 192 | 1.56 | 1 | 0 | 0 |
Types Metrics : Code Quality
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 | % Comment | Cyclomatic Complexity | IL Cyclomatic Complexity | % Coverage | Afferent Coupling | Efferent Coupling | Type Namespace |
---|---|---|---|---|---|---|---|---|---|---|---|
LASTINPUTINFO | 2.19 | 0 | 0 | 0 | - | 0 | 0 | - | 2 | 3 | Rowan.TfsWorkingOn.Monitor |
ProjectWorkedOn | 1.46 | 8 | 78 | 12 | 60 | 5 | 11 | - | 4 | 13 | Rowan.TfsWorkingOn.UserHistory |
Resources | 1.39 | 27 | 220 | 67 | 71.28 | 25 | 25 | - | 6 | 14 | Rowan.TfsWorkingOn.Properties |
ProjectCollectionWorkedOn | 1.3 | 24 | 190 | 0 | 0 | 16 | 21 | - | 4 | 24 | Rowan.TfsWorkingOn.UserHistory |
UserWorkedOnItem | 1.1 | 9 | 105 | 0 | 0 | 6 | 12 | - | 4 | 10 | Rowan.TfsWorkingOn.UserHistory |
FormNotificationTray | 1.05 | 378 | 2695 | 121 | 24.25 | 108 | 148 | - | 1 | 109 | Rowan.TfsWorkingOn.WinForm |
MonitorEventArgs | 1.01 | 0 | 33 | 9 | 100 | 0 | 7 | - | 4 | 6 | Rowan.TfsWorkingOn.Monitor |
GetNextIntervalCompletedEventArgs | 0.9 | 4 | 25 | 1 | 20 | 2 | 2 | - | 2 | 11 | Rowan.TfsWorkingOn.TfsWarehouse |
UnblockCompletedEventArgs | 0.9 | 4 | 25 | 1 | 20 | 2 | 2 | - | 2 | 10 | Rowan.TfsWorkingOn.TfsWarehouse |
BlockCompletedEventArgs | 0.9 | 4 | 25 | 1 | 20 | 2 | 2 | - | 2 | 10 | Rowan.TfsWorkingOn.TfsWarehouse |
GetWarehouseStatusCompletedEventArgs | 0.9 | 4 | 25 | 1 | 20 | 2 | 2 | - | 2 | 11 | Rowan.TfsWorkingOn.TfsWarehouse |
ChangeSettingCompletedEventArgs | 0.9 | 4 | 25 | 1 | 20 | 2 | 2 | - | 2 | 11 | Rowan.TfsWorkingOn.TfsWarehouse |
RunCompletedEventArgs | 0.9 | 4 | 25 | 1 | 20 | 2 | 2 | - | 2 | 10 | Rowan.TfsWorkingOn.TfsWarehouse |
WarehouseStatus | 0.83 | - | - | 4 | 100 | 0 | - | - | 2 | 7 | Rowan.TfsWorkingOn.TfsWarehouse |
MonitorBase | 0.81 | 12 | 287 | 0 | 0 | 6 | 23 | - | 4 | 15 | Rowan.TfsWorkingOn.Monitor |
Settings | 0.78 | 77 | 576 | 1 | 1.28 | 49 | 63 | - | 5 | 46 | Rowan.TfsWorkingOn |
Connection | 0.67 | 42 | 295 | 4 | 8.7 | 23 | 28 | - | 5 | 19 | Rowan.TfsWorkingOn |
Estimates | 0.54 | 30 | 270 | 0 | 0 | 14 | 23 | - | 3 | 28 | Rowan.TfsWorkingOn |
Resources | 0.45 | 60 | 481 | 169 | 73.8 | 52 | 52 | - | 4 | 16 | Rowan.TfsWorkingOn.WinForm.Properties |
FormWorkItem | 0.43 | 119 | 725 | 34 | 22.22 | 30 | 39 | - | 3 | 55 | Rowan.TfsWorkingOn.WinForm |
WorkingItem | 0.43 | 95 | 759 | - | - | - | 57 | - | 3 | 28 | Rowan.TfsWorkingOn |
ProjectCollectionWorkedOn+<>c__DisplayClass5 | 0.42 | 1 | 12 | - | - | - | 2 | - | 1 | 6 | Rowan.TfsWorkingOn.UserHistory |
UserActivity | 0.41 | 50 | 421 | 40 | 44.44 | 24 | 33 | - | 2 | 31 | Rowan.TfsWorkingOn.Monitor |
WorkingItemConfiguration | 0.4 | 89 | 733 | 10 | 10.1 | 47 | 66 | - | 2 | 44 | Rowan.TfsWorkingOn |
UserActivityState | 0.39 | - | - | 0 | - | 0 | - | - | 2 | 4 | Rowan.TfsWorkingOn.Monitor |
SafeNativeMethods | 0.33 | 0 | 0 | 0 | - | 0 | 0 | - | 1 | 3 | Rowan.TfsWorkingOn.Monitor |
ChangeSettingCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
RunCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
GetWarehouseStatusCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
NotifyCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
BlockCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
GetNextIntervalCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
UnblockCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
Settings | 0.28 | 3 | 23 | 0 | 0 | 3 | 4 | - | 1 | 12 | Rowan.TfsWorkingOn.Properties |
ReinitializeCompletedEventHandler | 0.28 | - | - | - | - | - | - | - | 1 | 9 | Rowan.TfsWorkingOn.TfsWarehouse |
Settings+<>c__DisplayClass5 | 0.28 | 1 | 12 | - | - | - | 2 | - | 1 | 6 | Rowan.TfsWorkingOn |
ControllerService | 0.28 | 90 | 1191 | 34 | 27.42 | 63 | 99 | - | 1 | 42 | Rowan.TfsWorkingOn.TfsWarehouse |
Nag | 0.21 | 29 | 301 | 23 | 44.23 | 16 | 26 | - | 1 | 25 | Rowan.TfsWorkingOn.Monitor |
FormWorkItemConfiguration | 0.21 | 473 | 3072 | 152 | 24.32 | 25 | 40 | - | 1 | 126 | Rowan.TfsWorkingOn.WinForm |
FormSearchWorkItems | 0.21 | 62 | 408 | 29 | 31.87 | 16 | 20 | - | 1 | 58 | Rowan.TfsWorkingOn.WinForm |
FormEstimates | 0.21 | 106 | 575 | 44 | 29.33 | 8 | 9 | - | 1 | 43 | Rowan.TfsWorkingOn.WinForm |
FormWorkItemConfiguration+<QueryPickerControl_OnSelectedQueryItemChanged>o__SiteContainerb | 0.19 | 0 | 0 | - | - | - | 0 | - | 1 | 9 | Rowan.TfsWorkingOn.WinForm |
FormWorkItemConfiguration+<FormWorkItemConfiguration_Load>o__SiteContainer0 | 0.19 | 0 | 0 | - | - | - | 0 | - | 1 | 19 | Rowan.TfsWorkingOn.WinForm |
Program | 0.15 | 4 | 11 | 3 | 42.86 | 1 | 1 | - | 0 | 6 | Rowan.TfsWorkingOn.WinForm |
Types Metrics : Code Members and Inheritance
Type Name | # Instance Methods | Nb Static Methods | Nb Properties | # Fields | # Children Classes | Depth Of Inheritance Tree | Type Namespace |
---|---|---|---|---|---|---|---|
LASTINPUTINFO | 0 | 0 | 0 | 2 | - | - | Rowan.TfsWorkingOn.Monitor |
ProjectWorkedOn | 6 | 0 | 2 | 3 | 0 | 2 | Rowan.TfsWorkingOn.UserHistory |
Resources | 1 | 23 | 22 | 2 | 0 | 1 | Rowan.TfsWorkingOn.Properties |
ProjectCollectionWorkedOn | 9 | 2 | 3 | 7 | 0 | 2 | Rowan.TfsWorkingOn.UserHistory |
UserWorkedOnItem | 7 | 0 | 1 | 3 | 2 | 1 | Rowan.TfsWorkingOn.UserHistory |
FormNotificationTray | 43 | 4 | 0 | 31 | 0 | 7 | Rowan.TfsWorkingOn.WinForm |
MonitorEventArgs | 7 | 0 | 3 | 3 | 0 | 2 | Rowan.TfsWorkingOn.Monitor |
GetNextIntervalCompletedEventArgs | 2 | 0 | 1 | 1 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
UnblockCompletedEventArgs | 2 | 0 | 1 | 1 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
BlockCompletedEventArgs | 2 | 0 | 1 | 1 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
GetWarehouseStatusCompletedEventArgs | 2 | 0 | 1 | 1 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
ChangeSettingCompletedEventArgs | 2 | 0 | 1 | 1 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
RunCompletedEventArgs | 2 | 0 | 1 | 1 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
WarehouseStatus | - | - | - | - | - | - | Rowan.TfsWorkingOn.TfsWarehouse |
MonitorBase | 16 | 0 | 2 | 5 | 2 | 1 | Rowan.TfsWorkingOn.Monitor |
Settings | 26 | 9 | 13 | 32 | 0 | 1 | Rowan.TfsWorkingOn |
Connection | 14 | 3 | 7 | 9 | 0 | 1 | Rowan.TfsWorkingOn |
Estimates | 12 | 1 | 3 | 7 | 0 | 1 | Rowan.TfsWorkingOn |
Resources | 1 | 50 | 49 | 2 | 0 | 1 | Rowan.TfsWorkingOn.WinForm.Properties |
FormWorkItem | 8 | 0 | 0 | 7 | 0 | 7 | Rowan.TfsWorkingOn.WinForm |
WorkingItem | 30 | 0 | 8 | 15 | 0 | 1 | Rowan.TfsWorkingOn |
ProjectCollectionWorkedOn+<>c__DisplayClass5 | 2 | 0 | 0 | 1 | 0 | 1 | Rowan.TfsWorkingOn.UserHistory |
UserActivity | 17 | 0 | 5 | 6 | 0 | 2 | Rowan.TfsWorkingOn.Monitor |
WorkingItemConfiguration | 28 | 0 | 8 | 14 | 0 | 1 | Rowan.TfsWorkingOn |
UserActivityState | - | - | - | - | - | - | Rowan.TfsWorkingOn.Monitor |
SafeNativeMethods | 0 | 1 | 0 | 0 | 0 | 1 | Rowan.TfsWorkingOn.Monitor |
ChangeSettingCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
RunCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
GetWarehouseStatusCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
NotifyCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
BlockCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
GetNextIntervalCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
UnblockCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
Settings | 2 | 2 | 2 | 1 | 0 | 3 | Rowan.TfsWorkingOn.Properties |
ReinitializeCompletedEventHandler | 4 | 0 | 0 | 0 | 0 | 3 | Rowan.TfsWorkingOn.TfsWarehouse |
Settings+<>c__DisplayClass5 | 2 | 0 | 0 | 1 | 0 | 1 | Rowan.TfsWorkingOn |
ControllerService | 55 | 0 | 2 | 17 | 0 | 6 | Rowan.TfsWorkingOn.TfsWarehouse |
Nag | 14 | 0 | 2 | 4 | 0 | 2 | Rowan.TfsWorkingOn.Monitor |
FormWorkItemConfiguration | 12 | 2 | 0 | 47 | 0 | 7 | Rowan.TfsWorkingOn.WinForm |
FormSearchWorkItems | 11 | 0 | 1 | 6 | 0 | 7 | Rowan.TfsWorkingOn.WinForm |
FormEstimates | 6 | 0 | 0 | 12 | 0 | 7 | Rowan.TfsWorkingOn.WinForm |
FormWorkItemConfiguration+<QueryPickerControl_OnSelectedQueryItemChanged>o__SiteContainerb | 0 | 0 | 0 | 2 | 0 | 1 | Rowan.TfsWorkingOn.WinForm |
FormWorkItemConfiguration+<FormWorkItemConfiguration_Load>o__SiteContainer0 | 0 | 0 | 0 | 8 | 0 | 1 | Rowan.TfsWorkingOn.WinForm |
Program | 0 | 1 | 0 | 0 | 0 | 1 | Rowan.TfsWorkingOn.WinForm |
Types Metrics : Lack Of Cohesion Of Methods and Association Between Classes
Type Name | Lack Of Cohesion Of Methods | Lack Of Cohesion Of Methods HS | Association Between Classes | Type Namespace |
---|---|---|---|---|
LASTINPUTINFO | 0 | 0 | 0 | Rowan.TfsWorkingOn.Monitor |
ProjectWorkedOn | 0.67 | 0.8 | 8 | Rowan.TfsWorkingOn.UserHistory |
Resources | 0 | 0 | 6 | Rowan.TfsWorkingOn.Properties |
ProjectCollectionWorkedOn | 0.72 | 0.81 | 24 | Rowan.TfsWorkingOn.UserHistory |
UserWorkedOnItem | 0.64 | 0.75 | 7 | Rowan.TfsWorkingOn.UserHistory |
FormNotificationTray | 0.92 | 0.94 | 224 | Rowan.TfsWorkingOn.WinForm |
MonitorEventArgs | 0 | 0 | 1 | Rowan.TfsWorkingOn.Monitor |
GetNextIntervalCompletedEventArgs | 0 | 0 | 1 | Rowan.TfsWorkingOn.TfsWarehouse |
UnblockCompletedEventArgs | 0 | 0 | 1 | Rowan.TfsWorkingOn.TfsWarehouse |
BlockCompletedEventArgs | 0 | 0 | 1 | Rowan.TfsWorkingOn.TfsWarehouse |
GetWarehouseStatusCompletedEventArgs | 0 | 0 | 2 | Rowan.TfsWorkingOn.TfsWarehouse |
ChangeSettingCompletedEventArgs | 0 | 0 | 1 | Rowan.TfsWorkingOn.TfsWarehouse |
RunCompletedEventArgs | 0 | 0 | 1 | Rowan.TfsWorkingOn.TfsWarehouse |
WarehouseStatus | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
MonitorBase | 0.79 | 0.85 | 10 | Rowan.TfsWorkingOn.Monitor |
Settings | 0.92 | 0.95 | 49 | Rowan.TfsWorkingOn |
Connection | 0.83 | 0.89 | 16 | Rowan.TfsWorkingOn |
Estimates | 0.83 | 0.9 | 24 | Rowan.TfsWorkingOn |
Resources | 0 | 0 | 7 | Rowan.TfsWorkingOn.WinForm.Properties |
FormWorkItem | 0.77 | 0.88 | 63 | Rowan.TfsWorkingOn.WinForm |
WorkingItem | 0.92 | 0.95 | 48 | Rowan.TfsWorkingOn |
ProjectCollectionWorkedOn+<>c__DisplayClass5 | 0 | 0 | 3 | Rowan.TfsWorkingOn.UserHistory |
UserActivity | 0.75 | 0.79 | 44 | Rowan.TfsWorkingOn.Monitor |
WorkingItemConfiguration | 0.91 | 0.94 | 55 | Rowan.TfsWorkingOn |
UserActivityState | - | - | 0 | Rowan.TfsWorkingOn.Monitor |
SafeNativeMethods | 0 | 0 | 0 | Rowan.TfsWorkingOn.Monitor |
ChangeSettingCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
RunCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
GetWarehouseStatusCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
NotifyCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
BlockCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
GetNextIntervalCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
UnblockCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
Settings | 0 | 0 | 2 | Rowan.TfsWorkingOn.Properties |
ReinitializeCompletedEventHandler | - | - | 0 | Rowan.TfsWorkingOn.TfsWarehouse |
Settings+<>c__DisplayClass5 | 0 | 0 | 3 | Rowan.TfsWorkingOn |
ControllerService | 0.96 | 0.98 | 38 | Rowan.TfsWorkingOn.TfsWarehouse |
Nag | 0.75 | 0.81 | 35 | Rowan.TfsWorkingOn.Monitor |
FormWorkItemConfiguration | 0.89 | 0.96 | 198 | Rowan.TfsWorkingOn.WinForm |
FormSearchWorkItems | 0.8 | 0.88 | 61 | Rowan.TfsWorkingOn.WinForm |
FormEstimates | 0.76 | 0.92 | 51 | Rowan.TfsWorkingOn.WinForm |
FormWorkItemConfiguration+<QueryPickerControl_OnSelectedQueryItemChanged>o__SiteContainerb | 0 | 0 | 0 | Rowan.TfsWorkingOn.WinForm |
FormWorkItemConfiguration+<FormWorkItemConfiguration_Load>o__SiteContainer0 | 0 | 0 | 0 | Rowan.TfsWorkingOn.WinForm |
Program | 0 | 0 | 4 | Rowan.TfsWorkingOn.WinForm |
Namespaces Metrics
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 | % Coverage | Afferent Coupling | Efferent Coupling |
---|---|---|---|---|---|---|---|---|
Rowan.TfsWorkingOn | 334 | 2645 | 6 | 15 | 4 | - | 2 | 18 |
Rowan.TfsWorkingOn.Monitor | 91 | 1042 | 7 | 75 | 45 | - | 2 | 10 |
Rowan.TfsWorkingOn.Properties | 30 | 243 | 2 | 74 | 71 | - | 3 | 10 |
Rowan.TfsWorkingOn.UserHistory | 42 | 385 | 4 | 12 | 22 | - | 2 | 8 |
Rowan.TfsWorkingOn.TfsWarehouse | 114 | 1341 | 16 | 60 | 34 | - | 1 | 10 |
Rowan.TfsWorkingOn.WinForm | 1142 | 7486 | 8 | 383 | 25 | - | 0 | 27 |
Rowan.TfsWorkingOn.WinForm.Properties | 60 | 481 | 1 | 176 | 74 | - | 1 | 10 |
Code Quality | 940 |
|
![]() | Rule warning: Methods potentially poorly commented |
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
methods | Percentage Comment | # lines of code (LOC) | # lines of comment | Full Name |
---|---|---|---|---|
_userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs) | 0 | 29 | 0 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivity_MonitorTriggeredEvent(Object,MonitorEventArgs) |
CreateNewMenuQueryItems() | 4 | 24 | 1 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .CreateNewMenuQueryItems() |
Save() | 8 | 22 | 2 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.Save() |
.ctor() | 12 | 29 | 4 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray..ctor() |
FormWorkItemConfiguration_Load(Object,EventArgs) | 17 | 24 | 5 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .FormWorkItemConfiguration_Load(Object,EventArgs) |
Statistics
Stat | Percentage Comment | # lines of code (LOC) | # lines of comment |
---|---|---|---|
Sum: | 41 | 128 | 12 |
Average: | 8.2 | 25.6 | 2.4 |
Minimum: | 0 | 22 | 0 |
Maximum: | 17 | 29 | 5 |
Standard deviation: | 5.95 | 2.87 | 1.85 |
Variance: | 35.36 | 8.24 | 3.44 |
![]() | Rule warning: Types with too many methods |
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
types | InstanceMethods | StaticMethods | Full Name |
---|---|---|---|
FormNotificationTray | 42 methods | 3 methods | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
Settings | 25 methods | 8 methods | Rowan.TfsWorkingOn.Settings |
WorkingItem | 29 methods | 0 method | Rowan.TfsWorkingOn.WorkingItem |
WorkingItemConfiguration | 27 methods | 0 method | Rowan.TfsWorkingOn.WorkingItemConfiguration |
Statistics
Stat | InstanceMethods | StaticMethods |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
![]() | Rule warning: Types with too many fields |
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
types | InstanceFields | StaticFields | Size of instance | Full Name |
---|---|---|---|---|
FormWorkItemConfiguration | 46 fields | 1 field | 490 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
Settings | 10 fields | 22 fields | 28 | Rowan.TfsWorkingOn.Settings |
FormNotificationTray | 25 fields | 6 fields | 403 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
Statistics
Stat | InstanceFields | StaticFields | Size of instance |
---|---|---|---|
Sum: | 0 | 0 | 921 |
Average: | 0 | 0 | 307 |
Minimum: | 0 | 0 | 28 |
Maximum: | 0 | 0 | 490 |
Standard deviation: | 0 | 0 | 200.45 |
Variance: | 0 | 0 | 40 182 |
![]() | Rule warning: Types with poor cohesion |
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
types | Lack of Cohesion Of Methods (LCOM) | LCOM Henderson-Sellers (LCOMHS) | # Methods | # Fields | Full Name |
---|---|---|---|---|---|
FormNotificationTray | 0.92 | 0.94 | 47 | 31 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
Settings | 0.92 | 0.95 | 35 | 32 | Rowan.TfsWorkingOn.Settings |
WorkingItem | 0.92 | 0.95 | 30 | 15 | Rowan.TfsWorkingOn.WorkingItem |
WorkingItemConfiguration | 0.91 | 0.94 | 28 | 14 | Rowan.TfsWorkingOn.WorkingItemConfiguration |
FormWorkItemConfiguration | 0.89 | 0.96 | 14 | 47 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
Statistics
Stat | Lack of Cohesion Of Methods (LCOM) | LCOM Henderson-Sellers (LCOMHS) | # Methods | # Fields |
---|---|---|---|---|
Sum: | 4.55 | 4.74 | 154 | 139 |
Average: | 0.91 | 0.95 | 30.8 | 27.8 |
Minimum: | 0.89 | 0.94 | 14 | 14 |
Maximum: | 0.92 | 0.96 | 47 | 47 |
Standard deviation: | 0.013 | 0.0067 | 10.68 | 12.25 |
Variance: | 0.00017 | 4.550459E-05 | 114.16 | 150.16 |
Object Oriented Design | 850 |
|
![]() | Rule warning: Class with no descendant should be sealed if possible |
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 |
---|---|---|
FormWorkItemConfiguration | 473 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
FormNotificationTray | 378 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
FormWorkItem | 119 | Rowan.TfsWorkingOn.WinForm.FormWorkItem |
FormEstimates | 106 | Rowan.TfsWorkingOn.WinForm.FormEstimates |
WorkingItem | 95 | Rowan.TfsWorkingOn.WorkingItem |
WorkingItemConfiguration | 89 | Rowan.TfsWorkingOn.WorkingItemConfiguration |
Settings | 77 | Rowan.TfsWorkingOn.Settings |
FormSearchWorkItems | 62 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems |
UserActivity | 50 | Rowan.TfsWorkingOn.Monitor.UserActivity |
Connection | 42 | Rowan.TfsWorkingOn.Connection |
Estimates | 30 | Rowan.TfsWorkingOn.Estimates |
Nag | 29 | Rowan.TfsWorkingOn.Monitor.Nag |
ProjectCollectionWorkedOn | 24 | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn |
ProjectWorkedOn | 8 | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn |
MonitorEventArgs | 0 | Rowan.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 |
![]() | Rule warning: Methods should be declared static if possible |
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
methods | staticFieldsUsed | Full Name |
---|---|---|
get_WorkItemTypes() | 0 field | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_WorkItemTypes() |
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs) | 0 field | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs) |
notifyMenu_Closing(Object,ToolStripDropDownClosingEventArgs) | 0 field | Rowan.TfsWorkingOn.WinForm.FormNotificationTray.notifyMenu_Closing (Object,ToolStripDropDownClosingEventArgs) |
Statistics
Stat | staticFieldsUsed |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Constructor should not call a virtual methods |
// 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
methods | virtualMethodsCalled | DerivedTypes | Full Name |
---|---|---|---|
.ctor() | 1 method | 0 type | Rowan.TfsWorkingOn.WorkingItemConfiguration..ctor() |
.ctor(WorkItemStore,String) | 2 methods | 0 type | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems..ctor(WorkItemStore ,String) |
.ctor(WorkItem) | 1 method | 0 type | Rowan.TfsWorkingOn.WinForm.FormWorkItem..ctor(WorkItem) |
Statistics
Stat | virtualMethodsCalled | DerivedTypes |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
![]() | Rule warning: Avoid the Singleton pattern |
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
type | staticFieldInstance | Full Name |
---|---|---|
Connection | _connection | Rowan.TfsWorkingOn.Connection |
Statistics
Stat | staticFieldInstance |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Don't assign static fields from instance methods |
// 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
fields | assignedBy | Full Name |
---|---|---|
_formSearchWorkItems | 1 method | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems |
_formItemConfiguration | 1 method | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration |
_userActivityTriggeredCurrentlyProcessing | 1 method | Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing |
Statistics
Stat | assignedBy |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
Design | 1130 |
|
![]() | Rule warning: Avoid custom delegates |
// 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
types | replaceWith | Full Name |
---|---|---|
GetWarehouseStatusCompletedEventHandler | Action<Object,GetWarehouseStatusCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse .GetWarehouseStatusCompletedEventHandler |
BlockCompletedEventHandler | Action<Object,BlockCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.BlockCompletedEventHandler |
UnblockCompletedEventHandler | Action<Object,UnblockCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.UnblockCompletedEventHandler |
ReinitializeCompletedEventHandler | Action<Object,AsyncCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.ReinitializeCompletedEventHandler |
ChangeSettingCompletedEventHandler | Action<Object,ChangeSettingCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.ChangeSettingCompletedEventHandler |
RunCompletedEventHandler | Action<Object,RunCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.RunCompletedEventHandler |
NotifyCompletedEventHandler | Action<Object,AsyncCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.NotifyCompletedEventHandler |
GetNextIntervalCompletedEventHandler | Action<Object,GetNextIntervalCompletedEventArgs> | Rowan.TfsWorkingOn.TfsWarehouse.GetNextIntervalCompletedEventHandler |
Statistics
Stat | replaceWith |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Avoid namespaces with few types |
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
namespaces | types | Full Name |
---|---|---|
Rowan.TfsWorkingOn.WinForm.Properties | 1 type | Rowan.TfsWorkingOn.WinForm.Properties |
Rowan.TfsWorkingOn.Properties | 2 types | Rowan.TfsWorkingOn.Properties |
Rowan.TfsWorkingOn.UserHistory | 3 types | Rowan.TfsWorkingOn.UserHistory |
Statistics
Stat | types |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Instances size shouldn't be too big |
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
types | Size of instance | InstanceFields | Full Name |
---|---|---|---|
FormWorkItemConfiguration | 490 | 46 fields | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
FormNotificationTray | 403 | 25 fields | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
FormEstimates | 354 | 12 fields | Rowan.TfsWorkingOn.WinForm.FormEstimates |
FormWorkItem | 331 | 7 fields | Rowan.TfsWorkingOn.WinForm.FormWorkItem |
FormSearchWorkItems | 330 | 6 fields | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems |
Statistics
Stat | Size of instance | InstanceFields |
---|---|---|
Sum: | 1 908 | 0 |
Average: | 381.6 | 0 |
Minimum: | 330 | 0 |
Maximum: | 490 | 0 |
Standard deviation: | 60.32 | 0 |
Variance: | 3 638 | 0 |
Architecture and Layering | 720 |
|
![]() | Critical Rule warning: Avoid namespaces mutually dependent |
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
namespace | shouldntUse | typesOfFirstUsedBySecond | typesOfSecondUsedByFirst | Full Name |
---|---|---|---|---|
Rowan.TfsWorkingOn.Monitor | Rowan.TfsWorkingOn | 2 types | 1 type | Rowan.TfsWorkingOn.Monitor |
Statistics
Stat | shouldntUse | typesOfFirstUsedBySecond | typesOfSecondUsedByFirst |
---|---|---|---|
Sum: | 0 | 0 | 0 |
Average: | 0 | 0 | 0 |
Minimum: | 0 | 0 | 0 |
Maximum: | 0 | 0 | 0 |
Standard deviation: | 0 | 0 | 0 |
Variance: | 0 | 0 | 0 |
![]() | Rule warning: Avoid namespaces dependency cycles |
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
namespace | cycle | Full Name |
---|---|---|
Rowan.TfsWorkingOn | 2 namespaces | Rowan.TfsWorkingOn |
Statistics
Stat | cycle |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
Dead Code | 310 |
|
![]() | Critical Rule warning: Potentially dead Methods |
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
methods | MethodsCallingMe | depth | Full Name |
---|---|---|---|
get_TeamProjectCollectionUri() | 0 method | 0 | Rowan.TfsWorkingOn.Connection.get_TeamProjectCollectionUri() |
linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs) | 0 method | 0 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs) |
Statistics
Stat | MethodsCallingMe | depth |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
Visibility | 460 |
|
![]() | Rule warning: Methods that could have a lower visibility |
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
methods | Visibility | CouldBeDeclared | MethodsCallingMe | Full Name |
---|---|---|---|---|
set_Duration(Double) | Public | Internal | 2 methods | Rowan.TfsWorkingOn.Estimates.set_Duration(Double) |
get_RemainingTime() | Public | Internal | 4 methods | Rowan.TfsWorkingOn.Estimates.get_RemainingTime() |
set_RemainingTime(Double) | Public | Internal | 4 methods | Rowan.TfsWorkingOn.Estimates.set_RemainingTime(Double) |
set_ElapsedTime(Double) | Public | Internal | 3 methods | Rowan.TfsWorkingOn.Estimates.set_ElapsedTime(Double) |
get_IsConnected() | Public | Private | 0 method | Rowan.TfsWorkingOn.Connection.get_IsConnected() |
get_SettingsFolderPath() | Public | Internal | 3 methods | Rowan.TfsWorkingOn.Settings.get_SettingsFolderPath() |
get_UserActivityIdleTimeoutMinutes() | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.get_UserActivityIdleTimeoutMinutes() |
set_UserActivityIdleTimeoutMinutes(Int32) | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.set_UserActivityIdleTimeoutMinutes(Int32) |
get_MonitorUserActivity() | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.get_MonitorUserActivity() |
set_MonitorUserActivity(Boolean) | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.set_MonitorUserActivity(Boolean) |
set_PromptOnResume(Boolean) | Public | Private | 1 method | Rowan.TfsWorkingOn.Settings.set_PromptOnResume(Boolean) |
set_BalloonTipTimeoutSeconds(Int32) | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.set_BalloonTipTimeoutSeconds(Int32) |
get_NagIntervalMinutes() | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.get_NagIntervalMinutes() |
set_NagIntervalMinutes(Int32) | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.set_NagIntervalMinutes(Int32) |
get_NagEnabled() | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.get_NagEnabled() |
set_NagEnabled(Boolean) | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.set_NagEnabled(Boolean) |
get_ProjectCollectionHistory() | Public | Private | 3 methods | Rowan.TfsWorkingOn.Settings.get_ProjectCollectionHistory() |
set_ProjectCollectionHistory(BindingList<ProjectCollectionWorkedOn>) | Public | Private | 0 method | Rowan.TfsWorkingOn.Settings.set_ProjectCollectionHistory(BindingList <ProjectCollectionWorkedOn>) |
OnPropertyChanged(PropertyChangedEventArgs) | Protected | Private | 8 methods | Rowan.TfsWorkingOn.Settings.OnPropertyChanged(PropertyChangedEventArgs ) |
get_Connection() | Public | Private | 0 method | Rowan.TfsWorkingOn.WorkingItem.get_Connection() |
get_StartTime() | Public | Private | 1 method | Rowan.TfsWorkingOn.WorkingItem.get_StartTime() |
set_StartTime(DateTime) | Public | Private | 2 methods | Rowan.TfsWorkingOn.WorkingItem.set_StartTime(DateTime) |
get_StopTime() | Public | Private | 2 methods | Rowan.TfsWorkingOn.WorkingItem.get_StopTime() |
set_StopTime(Nullable<DateTime>) | Public | Private | 4 methods | Rowan.TfsWorkingOn.WorkingItem.set_StopTime(Nullable<DateTime>) |
set_Estimates(Estimates) | Public | Private | 0 method | Rowan.TfsWorkingOn.WorkingItem.set_Estimates(Estimates) |
set_Started(Boolean) | Public | Private | 2 methods | Rowan.TfsWorkingOn.WorkingItem.set_Started(Boolean) |
set_Paused(Boolean) | Public | Private | 2 methods | Rowan.TfsWorkingOn.WorkingItem.set_Paused(Boolean) |
UpdateEstimates() | Public | Private | 1 method | Rowan.TfsWorkingOn.WorkingItem.UpdateEstimates() |
UpdateEstimates(String) | Public | Private | 2 methods | Rowan.TfsWorkingOn.WorkingItem.UpdateEstimates(String) |
get_SelectedWorkItemTypeName() | Public | Private | 0 method | Rowan.TfsWorkingOn.WorkingItemConfiguration .get_SelectedWorkItemTypeName() |
set_SelectedWorkItemTypeName(String) | Public | Private | 1 method | Rowan.TfsWorkingOn.WorkingItemConfiguration .set_SelectedWorkItemTypeName(String) |
get_SelectedWorkItemType() | Public | Private | 2 methods | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_SelectedWorkItemType() |
set_SelectedWorkItemType(WorkItemType) | Public | Internal | 1 method | Rowan.TfsWorkingOn.WorkingItemConfiguration.set_SelectedWorkItemType (WorkItemType) |
get_DurationField() | Public | Internal | 4 methods | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_DurationField() |
set_DurationField(String) | Public | Private | 1 method | Rowan.TfsWorkingOn.WorkingItemConfiguration.set_DurationField(String) |
get_RemainingField() | Public | Internal | 4 methods | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_RemainingField() |
set_RemainingField(String) | Public | Private | 1 method | Rowan.TfsWorkingOn.WorkingItemConfiguration.set_RemainingField(String) |
get_ElapsedField() | Public | Internal | 4 methods | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_ElapsedField() |
set_ElapsedField(String) | Public | Private | 1 method | Rowan.TfsWorkingOn.WorkingItemConfiguration.set_ElapsedField(String) |
get_WarehouseController() | Public | Private | 0 method | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_WarehouseController() |
get_MonitorType() | Public | Internal | 3 methods | Rowan.TfsWorkingOn.Monitor.MonitorEventArgs.get_MonitorType() |
set_MonitorType(Type) | Public | Internal | 6 methods | Rowan.TfsWorkingOn.Monitor.MonitorEventArgs.set_MonitorType(Type) |
set_Reason(String) | Public | Internal | 6 methods | Rowan.TfsWorkingOn.Monitor.MonitorEventArgs.set_Reason(String) |
get_Details() | Public | Private | 0 method | Rowan.TfsWorkingOn.Monitor.MonitorEventArgs.get_Details() |
set_Details(String) | Public | Internal | 6 methods | Rowan.TfsWorkingOn.Monitor.MonitorEventArgs.set_Details(String) |
.ctor(Int32) | Public | Private | 1 method | Rowan.TfsWorkingOn.Monitor.Nag..ctor(Int32) |
get_Interval() | Public | Private | 1 method | Rowan.TfsWorkingOn.Monitor.Nag.get_Interval() |
set_Interval(Int64) | Public | Private | 2 methods | Rowan.TfsWorkingOn.Monitor.Nag.set_Interval(Int64) |
get_LastResetTime() | Public | Private | 0 method | Rowan.TfsWorkingOn.Monitor.UserActivity.get_LastResetTime() |
get_IdleThreshold() | Public | Private | 1 method | Rowan.TfsWorkingOn.Monitor.UserActivity.get_IdleThreshold() |
set_IdleThreshold(Int64) | Public | Private | 2 methods | Rowan.TfsWorkingOn.Monitor.UserActivity.set_IdleThreshold(Int64) |
get_ActiveTimeMilliseconds() | Public | Private | 0 method | Rowan.TfsWorkingOn.Monitor.UserActivity.get_ActiveTimeMilliseconds() |
get_ActiveTime() | Public | Private | 0 method | Rowan.TfsWorkingOn.Monitor.UserActivity.get_ActiveTime() |
.ctor(Int64) | Public | Private | 1 method | Rowan.TfsWorkingOn.Monitor.UserActivity..ctor(Int64) |
Reset() | Public | Private | 0 method | Rowan.TfsWorkingOn.Monitor.UserActivity.Reset() |
get_LastAccessed() | Public | Internal | 4 methods | Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem.get_LastAccessed() |
set_LastAccessed(DateTime) | Public | Internal | 4 methods | Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem.set_LastAccessed (DateTime) |
.ctor(String) | Public | Internal | 1 method | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn..ctor(String) |
set_TeamProjectCollectionAbsoluteUri(String) | Public | Private | 1 method | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .set_TeamProjectCollectionAbsoluteUri(String) |
get_ProjectHistory() | Public | Private | 3 methods | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .get_ProjectHistory() |
set_ProjectHistory(BindingList<ProjectWorkedOn>) | Public | Private | 0 method | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .set_ProjectHistory(BindingList<ProjectWorkedOn>) |
.ctor(String) | Public | Internal | 1 method | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn..ctor(String) |
set_ProjectName(String) | Public | Private | 1 method | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn.set_ProjectName(String) |
.ctor(WorkingItem) | Public | Internal | 2 methods | Rowan.TfsWorkingOn.WinForm.FormEstimates..ctor(WorkingItem) |
get_WorkingItem() | Public | Internal | 2 methods | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.get_WorkingItem() |
.ctor(WorkItemStore,String) | Public | Internal | 1 method | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems..ctor(WorkItemStore ,String) |
.ctor(WorkItem) | Public | Internal | 3 methods | Rowan.TfsWorkingOn.WinForm.FormWorkItem..ctor(WorkItem) |
QueryPickerControl_OnSelectedQueryItemChanged() | Protected | Private | 1 method | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .QueryPickerControl_OnSelectedQueryItemChanged() |
Statistics
Stat | Visibility | CouldBeDeclared | MethodsCallingMe |
---|---|---|---|
Sum: | 0 | 0 | 0 |
Average: | 0 | 0 | 0 |
Minimum: | 0 | 0 | 0 |
Maximum: | 0 | 0 | 0 |
Standard deviation: | 0 | 0 | 0 |
Variance: | 0 | 0 | 0 |
![]() | Rule warning: Types that could have a lower visibility |
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
types | Visibility | CouldBeDeclared | TypesUsingMe | Full Name |
---|---|---|---|---|
FormEstimates | Public | Internal | 1 type | Rowan.TfsWorkingOn.WinForm.FormEstimates |
FormSearchWorkItems | Public | Internal | 1 type | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems |
FormWorkItem | Public | Internal | 3 types | Rowan.TfsWorkingOn.WinForm.FormWorkItem |
FormWorkItemConfiguration | Public | Internal | 1 type | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
FormNotificationTray | Public | Internal | 1 type | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
Statistics
Stat | Visibility | CouldBeDeclared | TypesUsingMe |
---|---|---|---|
Sum: | 0 | 0 | 0 |
Average: | 0 | 0 | 0 |
Minimum: | 0 | 0 | 0 |
Maximum: | 0 | 0 | 0 |
Standard deviation: | 0 | 0 | 0 |
Variance: | 0 | 0 | 0 |
![]() | Rule warning: Fields that could have a lower visibility |
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
fields | Visibility | CouldBeDeclared | MethodsUsingMe | Full Name |
---|---|---|---|---|
cbSize | Public | Internal | 1 method | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize |
dwTime | Public | Internal | 1 method | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.dwTime |
pnlButtons | Internal | Private | 1 method | Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlButtons |
btnCancel | Internal | Private | 1 method | Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel |
btnSave | Internal | Private | 1 method | Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave |
pnlWICtl | Internal | Private | 1 method | Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlWICtl |
Statistics
Stat | Visibility | CouldBeDeclared | MethodsUsingMe |
---|---|---|---|
Sum: | 0 | 0 | 0 |
Average: | 0 | 0 | 0 |
Minimum: | 0 | 0 | 0 |
Maximum: | 0 | 0 | 0 |
Standard deviation: | 0 | 0 | 0 |
Variance: | 0 | 0 | 0 |
![]() | Rule warning: Avoid publicly visible constant fields |
// 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
fields | Full Name |
---|---|
DurationPropertyName | Rowan.TfsWorkingOn.Estimates.DurationPropertyName |
RemainingTimePropertyName | Rowan.TfsWorkingOn.Estimates.RemainingTimePropertyName |
ElapsedTimePropertyName | Rowan.TfsWorkingOn.Estimates.ElapsedTimePropertyName |
TeamProjectCollectionAbsoluteUriPropertyName | Rowan.TfsWorkingOn.Connection .TeamProjectCollectionAbsoluteUriPropertyName |
SelectedProjectNamePropertyName | Rowan.TfsWorkingOn.Connection.SelectedProjectNamePropertyName |
MonitorUserActivityPropertyName | Rowan.TfsWorkingOn.Settings.MonitorUserActivityPropertyName |
NagEnabledPropertyName | Rowan.TfsWorkingOn.Settings.NagEnabledPropertyName |
NagIntervalMinutesPropertyName | Rowan.TfsWorkingOn.Settings.NagIntervalMinutesPropertyName |
PromptOnResumePropertyName | Rowan.TfsWorkingOn.Settings.PromptOnResumePropertyName |
UserActivityIdleTimeoutMinutesPropertyName | Rowan.TfsWorkingOn.Settings.UserActivityIdleTimeoutMinutesPropertyName |
ProjectCollectionHistoryPropertyName | Rowan.TfsWorkingOn.Settings.ProjectCollectionHistoryPropertyName |
DefaultBalloonTipTimeoutSeconds | Rowan.TfsWorkingOn.Settings.DefaultBalloonTipTimeoutSeconds |
DefaultMonitorUserActivity | Rowan.TfsWorkingOn.Settings.DefaultMonitorUserActivity |
DefaultNagEnabled | Rowan.TfsWorkingOn.Settings.DefaultNagEnabled |
DefaultNagIntervalMinutes | Rowan.TfsWorkingOn.Settings.DefaultNagIntervalMinutes |
DefaultPromptOnResume | Rowan.TfsWorkingOn.Settings.DefaultPromptOnResume |
DefaultSelectedProjectName | Rowan.TfsWorkingOn.Settings.DefaultSelectedProjectName |
DefaultTeamProjectCollectionAbsoluteUri | Rowan.TfsWorkingOn.Settings.DefaultTeamProjectCollectionAbsoluteUri |
DefaultUserActivityIdleTimeoutMinutes | Rowan.TfsWorkingOn.Settings.DefaultUserActivityIdleTimeoutMinutes |
IsDirtyPropertyName | Rowan.TfsWorkingOn.Settings.IsDirtyPropertyName |
ConfigurationsPathPropertyName | Rowan.TfsWorkingOn.Settings.ConfigurationsPathPropertyName |
WorkItemPropertyName | Rowan.TfsWorkingOn.WorkingItem.WorkItemPropertyName |
StartTimePropertyName | Rowan.TfsWorkingOn.WorkingItem.StartTimePropertyName |
StopTimePropertyName | Rowan.TfsWorkingOn.WorkingItem.StopTimePropertyName |
EstimatesPropertyName | Rowan.TfsWorkingOn.WorkingItem.EstimatesPropertyName |
StartedPropertyName | Rowan.TfsWorkingOn.WorkingItem.StartedPropertyName |
PausedPropertyName | Rowan.TfsWorkingOn.WorkingItem.PausedPropertyName |
SelectedWorkItemTypePropertyName | Rowan.TfsWorkingOn.WorkingItemConfiguration .SelectedWorkItemTypePropertyName |
DurationFieldPropertyName | Rowan.TfsWorkingOn.WorkingItemConfiguration.DurationFieldPropertyName |
RemainingFieldPropertyName | Rowan.TfsWorkingOn.WorkingItemConfiguration.RemainingFieldPropertyName |
ElapsedFieldPropertyName | Rowan.TfsWorkingOn.WorkingItemConfiguration.ElapsedFieldPropertyName |
QueryLastAccessedPropertyName | Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem .QueryLastAccessedPropertyName |
ProjectHistoryPropertyName | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .ProjectHistoryPropertyName |
TeamProjectCollectionAbsoluteUriPropertyName | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .TeamProjectCollectionAbsoluteUriPropertyName |
LastQueryWorkedOnFieldName | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn .LastQueryWorkedOnFieldName |
Statistics
Stat |
---|
Sum: |
Average: |
Minimum: |
Maximum: |
Standard deviation: |
Variance: |
![]() | Rule warning: Fields should be declared as private |
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
fields | Size of instance | Full Name |
---|---|---|
cbSize | 4 | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize |
dwTime | 4 | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.dwTime |
pnlButtons | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlButtons |
btnCancel | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel |
btnSave | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave |
pnlWICtl | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlWICtl |
Statistics
Stat | Size of instance |
---|---|
Sum: | 24 |
Average: | 4 |
Minimum: | 4 |
Maximum: | 4 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Event handler methods should be declared private |
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
method | Visibility | Full Name |
---|---|---|
OnPropertyChanged(Object,PropertyChangedEventArgs) | Protected | Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem.OnPropertyChanged (Object,PropertyChangedEventArgs) |
Statistics
Stat | Visibility |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
Purity - Immutability - Side-Effects | 560 |
|
![]() | Rule warning: Fields should be marked as ReadOnly when possible |
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
fields | Size of instance | Full Name |
---|---|---|
_userActivity | 4 | Rowan.TfsWorkingOn.WorkingItem._userActivity |
_nagIntervalTimer | 4 | Rowan.TfsWorkingOn.Monitor.Nag._nagIntervalTimer |
_activityCheckerTimer | 4 | Rowan.TfsWorkingOn.Monitor.UserActivity._activityCheckerTimer |
_activityStopWatch | 4 | Rowan.TfsWorkingOn.Monitor.UserActivity._activityStopWatch |
_workingItem | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates._workingItem |
pickWorkItemsControl | 4 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.pickWorkItemsControl |
_workingItemConfiguration | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._workingItemConfiguration |
Statistics
Stat | Size of instance |
---|---|
Sum: | 28 |
Average: | 4 |
Minimum: | 4 |
Maximum: | 4 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Structures should be immutable |
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) | mutableFields | Full Name |
---|---|---|---|
LASTINPUTINFO | 0 | 2 fields | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO |
Statistics
Stat | # lines of code (LOC) | mutableFields |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
![]() | Rule warning: Property Getters should be immutable |
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) | fieldsAssigned | Full Name |
---|---|---|---|
get_SelectedProject() | 1 | 1 field | Rowan.TfsWorkingOn.Connection.get_SelectedProject() |
get_SettingsFilePath() | 1 | 1 field | Rowan.TfsWorkingOn.Settings.get_SettingsFilePath() |
get_ProjectCollectionHistory() | 1 | 1 field | Rowan.TfsWorkingOn.Settings.get_ProjectCollectionHistory() |
get_Estimates() | 7 | 1 field | Rowan.TfsWorkingOn.WorkingItem.get_Estimates() |
get_WarehouseController() | 5 | 1 field | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_WarehouseController() |
get_ResourceManager() | 4 | 1 field | Rowan.TfsWorkingOn.Properties.Resources.get_ResourceManager() |
get_ProjectHistory() | 1 | 1 field | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .get_ProjectHistory() |
get_ResourceManager() | 4 | 1 field | Rowan.TfsWorkingOn.WinForm.Properties.Resources.get_ResourceManager() |
Statistics
Stat | # lines of code (LOC) | fieldsAssigned |
---|---|---|
Sum: | 24 | 0 |
Average: | 3 | 0 |
Minimum: | 1 | 0 |
Maximum: | 7 | 0 |
Standard deviation: | 2.18 | 0 |
Variance: | 4.75 | 0 |
![]() | Rule warning: Avoid static fields with a mutable field type |
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
fields | mutableFieldType | isFieldImmutable | isFieldIsReadOnly | Full Name |
---|---|---|---|---|
_connection | Connection | False | False | Rowan.TfsWorkingOn.Connection._connection |
_defaultInstance | Settings | False | False | Rowan.TfsWorkingOn.Settings._defaultInstance |
defaultInstance | Settings | True | False | Rowan.TfsWorkingOn.Properties.Settings.defaultInstance |
_formSearchWorkItems | FormSearchWorkItems | False | False | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems |
_formItemConfiguration | FormWorkItemConfiguration | False | False | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration |
Statistics
Stat | mutableFieldType | isFieldImmutable | isFieldIsReadOnly |
---|---|---|---|
Sum: | 0 | 0 | 0 |
Average: | 0 | 0 | 0 |
Minimum: | 0 | 0 | 0 |
Maximum: | 0 | 0 | 0 |
Standard deviation: | 0 | 0 | 0 |
Variance: | 0 | 0 | 0 |
![]() | Rule warning: A field must not be assigned from outside its parent hierarchy types |
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
field | methodsAssignerOutsideOfMyType | Full Name |
---|---|---|
cbSize | 1 method | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize |
Statistics
Stat | methodsAssignerOutsideOfMyType |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Critical Rule warning: Don't assign a field from many methods |
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
fields | MethodsAssigningMe | MethodsReadingMeButNotAssigningMe | MethodsUsingMe | ParentType | Full Name |
---|---|---|---|---|---|
_connection | 2 methods | 1 method | 3 methods | Connection | Rowan.TfsWorkingOn.Connection._connection |
_defaultInstance | 2 methods | 2 methods | 4 methods | Settings | Rowan.TfsWorkingOn.Settings._defaultInstance |
Statistics
Stat | MethodsAssigningMe | MethodsReadingMeButNotAssigningMe | MethodsUsingMe | ParentType |
---|---|---|---|---|
Sum: | 0 | 0 | 0 | 0 |
Average: | 0 | 0 | 0 | 0 |
Minimum: | 0 | 0 | 0 | 0 |
Maximum: | 0 | 0 | 0 | 0 |
Standard deviation: | 0 | 0 | 0 | 0 |
Variance: | 0 | 0 | 0 | 0 |
Naming Conventions | 1160 |
|
![]() | Rule warning: Instance fields should be prefixed with a 'm_' |
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
fields | Size of instance | Full Name |
---|---|---|
_duration | 8 | Rowan.TfsWorkingOn.Estimates._duration |
_remainingTime | 8 | Rowan.TfsWorkingOn.Estimates._remainingTime |
_elapsedTime | 8 | Rowan.TfsWorkingOn.Estimates._elapsedTime |
_tfsTeamProjectCollection | 4 | Rowan.TfsWorkingOn.Connection._tfsTeamProjectCollection |
_teamProjectCollectionAbsoluteUri | 4 | Rowan.TfsWorkingOn.Connection._teamProjectCollectionAbsoluteUri |
_workItemStore | 4 | Rowan.TfsWorkingOn.Connection._workItemStore |
_selectedProjectName | 4 | Rowan.TfsWorkingOn.Connection._selectedProjectName |
_selectedProject | 4 | Rowan.TfsWorkingOn.Connection._selectedProject |
_balloonTipTimeoutSeconds | 4 | Rowan.TfsWorkingOn.Settings._balloonTipTimeoutSeconds |
_monitorUserActivity | 1 | Rowan.TfsWorkingOn.Settings._monitorUserActivity |
_nagEnabled | 1 | Rowan.TfsWorkingOn.Settings._nagEnabled |
_nagIntervalMinutes | 4 | Rowan.TfsWorkingOn.Settings._nagIntervalMinutes |
_promptOnResume | 1 | Rowan.TfsWorkingOn.Settings._promptOnResume |
_userActivityIdleTimeoutMinutes | 4 | Rowan.TfsWorkingOn.Settings._userActivityIdleTimeoutMinutes |
_isDirty | 1 | Rowan.TfsWorkingOn.Settings._isDirty |
_configurationsPath | 4 | Rowan.TfsWorkingOn.Settings._configurationsPath |
_projectCollectionHistory | 4 | Rowan.TfsWorkingOn.Settings._projectCollectionHistory |
_workItem | 4 | Rowan.TfsWorkingOn.WorkingItem._workItem |
_startTime | 8 | Rowan.TfsWorkingOn.WorkingItem._startTime |
_stopTime | 5 | Rowan.TfsWorkingOn.WorkingItem._stopTime |
_estimates | 4 | Rowan.TfsWorkingOn.WorkingItem._estimates |
_started | 1 | Rowan.TfsWorkingOn.WorkingItem._started |
_paused | 1 | Rowan.TfsWorkingOn.WorkingItem._paused |
_userActivity | 4 | Rowan.TfsWorkingOn.WorkingItem._userActivity |
_isDirty | 1 | Rowan.TfsWorkingOn.WorkingItemConfiguration._isDirty |
_selectedWorkItemType | 4 | Rowan.TfsWorkingOn.WorkingItemConfiguration._selectedWorkItemType |
_durationField | 4 | Rowan.TfsWorkingOn.WorkingItemConfiguration._durationField |
_remainingField | 4 | Rowan.TfsWorkingOn.WorkingItemConfiguration._remainingField |
_elapsedField | 4 | Rowan.TfsWorkingOn.WorkingItemConfiguration._elapsedField |
_warehouseController | 4 | Rowan.TfsWorkingOn.WorkingItemConfiguration._warehouseController |
_filename | 4 | Rowan.TfsWorkingOn.WorkingItemConfiguration._filename |
_nagIntervalTimer | 4 | Rowan.TfsWorkingOn.Monitor.Nag._nagIntervalTimer |
_lastInput | 8 | Rowan.TfsWorkingOn.Monitor.UserActivity._lastInput |
_activityCheckerTimer | 4 | Rowan.TfsWorkingOn.Monitor.UserActivity._activityCheckerTimer |
_activityStopWatch | 4 | Rowan.TfsWorkingOn.Monitor.UserActivity._activityStopWatch |
cbSize | 4 | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.cbSize |
dwTime | 4 | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO.dwTime |
_lastAccessed | 8 | Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem._lastAccessed |
_teamProjectCollectionAbsoluteUri | 4 | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn ._teamProjectCollectionAbsoluteUri |
_projectHistory | 4 | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn ._projectHistory |
lastQueryWorkedOn | 5 | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn.lastQueryWorkedOn |
GetWarehouseStatusOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .GetWarehouseStatusOperationCompleted |
BlockOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .BlockOperationCompleted |
UnblockOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .UnblockOperationCompleted |
ReinitializeOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .ReinitializeOperationCompleted |
ChangeSettingOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .ChangeSettingOperationCompleted |
RunOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .RunOperationCompleted |
NotifyOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .NotifyOperationCompleted |
GetNextIntervalOperationCompleted | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .GetNextIntervalOperationCompleted |
useDefaultCredentialsSetExplicitly | 1 | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .useDefaultCredentialsSetExplicitly |
results | 4 | Rowan.TfsWorkingOn.TfsWarehouse.GetWarehouseStatusCompletedEventArgs .results |
results | 4 | Rowan.TfsWorkingOn.TfsWarehouse.BlockCompletedEventArgs.results |
results | 4 | Rowan.TfsWorkingOn.TfsWarehouse.UnblockCompletedEventArgs.results |
results | 4 | Rowan.TfsWorkingOn.TfsWarehouse.ChangeSettingCompletedEventArgs .results |
results | 4 | Rowan.TfsWorkingOn.TfsWarehouse.RunCompletedEventArgs.results |
results | 4 | Rowan.TfsWorkingOn.TfsWarehouse.GetNextIntervalCompletedEventArgs .results |
_workingItem | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates._workingItem |
components | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.components |
buttonViewWorkItem | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonViewWorkItem |
buttonSave | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonSave |
buttonCancel | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.buttonCancel |
labelDuration | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.labelDuration |
labelElaspedTime | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.labelElaspedTime |
labelRemainingTime | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.labelRemainingTime |
textBoxDuration | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.textBoxDuration |
textBoxElapsedTime | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.textBoxElapsedTime |
textBoxRemainingTime | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.textBoxRemainingTime |
estimatesBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormEstimates.estimatesBindingSource |
pickWorkItemsControl | 4 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.pickWorkItemsControl |
components | 4 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.components |
workitemMenuStrip | 4 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.workitemMenuStrip |
selectToolStripMenuItem | 4 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.selectToolStripMenuItem |
viewToolStripMenuItem | 4 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems.viewToolStripMenuItem |
_isCanceled | 1 | Rowan.TfsWorkingOn.WinForm.FormWorkItem._isCanceled |
components | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.components |
pnlButtons | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlButtons |
btnCancel | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnCancel |
btnSave | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.btnSave |
pnlWICtl | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.pnlWICtl |
witControl | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItem.witControl |
_workingItemConfiguration | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._workingItemConfiguration |
_queryPickerControl | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._queryPickerControl |
_queryPickerControlType | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration ._queryPickerControlType |
components | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.components |
folderBrowserDialog | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .folderBrowserDialog |
workingItemConfigurationBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .workingItemConfigurationBindingSource |
selectedWorkItemTypeBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .selectedWorkItemTypeBindingSource |
fieldDefinitionsDurationBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsDurationBindingSource |
fieldDefinitionsRemainingBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsRemainingBindingSource |
fieldDefinitionsElapsedBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsElapsedBindingSource |
settingsBindingSource | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .settingsBindingSource |
toolTipHelp | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.toolTipHelp |
tabPageMappings | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.tabPageMappings |
tabPageOptions | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.tabPageOptions |
pictureBoxHelpMenuQuery | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .pictureBoxHelpMenuQuery |
labelMenuQuery | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.labelMenuQuery |
pictureBoxHelpPromptOnResume | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .pictureBoxHelpPromptOnResume |
checkBoxPromptOnResume | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .checkBoxPromptOnResume |
pictureBoxHelpNag | 4 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration.pictureBoxHelpNag |
pictureBoxHelpUserActivity | 4 | Rowan.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 |
![]() | Rule warning: Static fields should be prefixed with a 's_' |
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
fields | Size of instance | Full Name |
---|---|---|
_connection | N/A | Rowan.TfsWorkingOn.Connection._connection |
_defaultInstance | N/A | Rowan.TfsWorkingOn.Settings._defaultInstance |
_settingsFilePath | N/A | Rowan.TfsWorkingOn.Settings._settingsFilePath |
DefaultConfigurationsPath | N/A | Rowan.TfsWorkingOn.Settings.DefaultConfigurationsPath |
resourceMan | N/A | Rowan.TfsWorkingOn.Properties.Resources.resourceMan |
resourceCulture | N/A | Rowan.TfsWorkingOn.Properties.Resources.resourceCulture |
defaultInstance | N/A | Rowan.TfsWorkingOn.Properties.Settings.defaultInstance |
ProjectPicker | N/A | Rowan.TfsWorkingOn.WinForm.FormNotificationTray.ProjectPicker |
_formSearchWorkItems | N/A | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems |
_formItemConfiguration | N/A | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration |
_userActivityMutex | N/A | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._userActivityMutex |
_userActivityTriggeredCurrentlyProcessing | N/A | Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing |
resourceMan | N/A | Rowan.TfsWorkingOn.WinForm.Properties.Resources.resourceMan |
resourceCulture | N/A | Rowan.TfsWorkingOn.WinForm.Properties.Resources.resourceCulture |
Statistics
Stat | Size of instance |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Methods name should begin with an Upper character |
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
methods | Full 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: |
![]() | Rule warning: Avoid types with name too long |
warnif count > 0 from t in Application.Types
where !t.IsGeneratedByCompiler
where t.SimpleName.Length > 35
select new { t, t.SimpleName }
3 types matched
types | SimpleName | Full Name |
---|---|---|
GetWarehouseStatusCompletedEventHandler | GetWarehouseStatusCompletedEventHandler | Rowan.TfsWorkingOn.TfsWarehouse .GetWarehouseStatusCompletedEventHandler |
GetWarehouseStatusCompletedEventArgs | GetWarehouseStatusCompletedEventArgs | Rowan.TfsWorkingOn.TfsWarehouse.GetWarehouseStatusCompletedEventArgs |
GetNextIntervalCompletedEventHandler | GetNextIntervalCompletedEventHandler | Rowan.TfsWorkingOn.TfsWarehouse.GetNextIntervalCompletedEventHandler |
Statistics
Stat | SimpleName |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Avoid methods with name too long |
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
methods | SimpleName | Full Name |
---|---|---|
ProjectCollectionHistory_ListChanged(Object,ListChangedEventArgs) | ProjectCollectionHistory_ListChanged | Rowan.TfsWorkingOn.Settings.ProjectCollectionHistory_ListChanged (Object,ListChangedEventArgs) |
WorkingItemConfiguration_PropertyChanged(Object ,PropertyChangedEventArgs) | WorkingItemConfiguration_PropertyChanged | Rowan.TfsWorkingOn.WorkingItemConfiguration .WorkingItemConfiguration_PropertyChanged(Object ,PropertyChangedEventArgs) |
get_AutomaticWorkspaceToManageWorkItemFieldMappings() | get_AutomaticWorkspaceToManageWorkItemFieldMappings | Rowan.TfsWorkingOn.Properties.Resources .get_AutomaticWorkspaceToManageWorkItemFieldMappings() |
get_UserActivityMonitorStartedEventReason() | get_UserActivityMonitorStartedEventReason | Rowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorStartedEventReason() |
get_UserActivityMonitorStoppedEventReason() | get_UserActivityMonitorStoppedEventReason | Rowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorStoppedEventReason() |
get_UserActivityMonitorTriggeredEventActiveReason() | get_UserActivityMonitorTriggeredEventActiveReason | Rowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorTriggeredEventActiveReason() |
get_UserActivityMonitorTriggeredEventIdleReason() | get_UserActivityMonitorTriggeredEventIdleReason | Rowan.TfsWorkingOn.Properties.Resources .get_UserActivityMonitorTriggeredEventIdleReason() |
get_Rowan_TfsWorkingOn_TfsWarehouse_ControllerService() | get_Rowan_TfsWorkingOn_TfsWarehouse_ControllerService | Rowan.TfsWorkingOn.Properties.Settings .get_Rowan_TfsWorkingOn_TfsWarehouse_ControllerService() |
OnGetWarehouseStatusOperationCompleted(Object) | OnGetWarehouseStatusOperationCompleted | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .OnGetWarehouseStatusOperationCompleted(Object) |
pickWorkItemsControl_PickWorkItemsListViewDoubleClicked(Object ,EventArgs) | pickWorkItemsControl_PickWorkItemsListViewDoubleClicked | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems .pickWorkItemsControl_PickWorkItemsListViewDoubleClicked(Object ,EventArgs) |
QueryPickerControl_OnSelectedQueryItemChanged() | QueryPickerControl_OnSelectedQueryItemChanged | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .QueryPickerControl_OnSelectedQueryItemChanged() |
FormWorkItemConfiguration_FormClosing(Object,FormClosingEventArgs) | FormWorkItemConfiguration_FormClosing | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .FormWorkItemConfiguration_FormClosing(Object,FormClosingEventArgs) |
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs) | queryListToolStripMenuItemDropDown_Closing | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs) |
refreshingWorkItemsWorker_RunWorkerCompleted(Object ,RunWorkerCompletedEventArgs) | refreshingWorkItemsWorker_RunWorkerCompleted | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .refreshingWorkItemsWorker_RunWorkerCompleted(Object ,RunWorkerCompletedEventArgs) |
selectWorkItemToolStripMenuItem_Click(Object,EventArgs) | selectWorkItemToolStripMenuItem_Click | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .selectWorkItemToolStripMenuItem_Click(Object,EventArgs) |
queryListToolStripMenuItem_DropDownOpening(Object,EventArgs) | queryListToolStripMenuItem_DropDownOpening | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItem_DropDownOpening(Object,EventArgs) |
modifyEstimatesToolStripMenuItem_Click(Object,EventArgs) | modifyEstimatesToolStripMenuItem_Click | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .modifyEstimatesToolStripMenuItem_Click(Object,EventArgs) |
Statistics
Stat | SimpleName |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
![]() | Rule warning: Avoid fields with name too long |
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
fields | Full Name |
---|---|
TeamProjectCollectionAbsoluteUriPropertyName | Rowan.TfsWorkingOn.Connection .TeamProjectCollectionAbsoluteUriPropertyName |
UserActivityIdleTimeoutMinutesPropertyName | Rowan.TfsWorkingOn.Settings.UserActivityIdleTimeoutMinutesPropertyName |
ProjectCollectionHistoryPropertyName | Rowan.TfsWorkingOn.Settings.ProjectCollectionHistoryPropertyName |
DefaultTeamProjectCollectionAbsoluteUri | Rowan.TfsWorkingOn.Settings.DefaultTeamProjectCollectionAbsoluteUri |
DefaultUserActivityIdleTimeoutMinutes | Rowan.TfsWorkingOn.Settings.DefaultUserActivityIdleTimeoutMinutes |
TeamProjectCollectionAbsoluteUriPropertyName | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn .TeamProjectCollectionAbsoluteUriPropertyName |
GetWarehouseStatusOperationCompleted | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService .GetWarehouseStatusOperationCompleted |
workingItemConfigurationBindingSource | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .workingItemConfigurationBindingSource |
fieldDefinitionsDurationBindingSource | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsDurationBindingSource |
fieldDefinitionsRemainingBindingSource | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsRemainingBindingSource |
fieldDefinitionsElapsedBindingSource | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .fieldDefinitionsElapsedBindingSource |
_userActivityTriggeredCurrentlyProcessing | Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing |
Statistics
Stat |
---|
Sum: |
Average: |
Minimum: |
Maximum: |
Standard deviation: |
Variance: |
Source Files Organization | 420 |
|
![]() | Rule warning: Avoid defining multiple types in a source file |
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
types | types | FilePathString | Full Name |
---|---|---|---|
MonitorBase | 2 types | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\MonitorBase.cs | Rowan.TfsWorkingOn.Monitor.MonitorBase |
UserActivity | 4 types | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.cs | Rowan.TfsWorkingOn.Monitor.UserActivity |
ControllerService | 8 types | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Web References\TfsWarehouse\Reference.cs | Rowan.TfsWorkingOn.TfsWarehouse.ControllerService |
Statistics
Stat | types | FilePathString |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
![]() | Rule warning: Namespace name should correspond to file location |
// 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
types | dirCorresponding | sourceFilePath | Full Name |
---|---|---|---|
Estimates | Rowan TfsWorkingOn | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Estimates.cs | Rowan.TfsWorkingOn.Estimates |
Connection | Rowan TfsWorkingOn | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Connection.cs | Rowan.TfsWorkingOn.Connection |
Settings | Rowan TfsWorkingOn | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Settings.cs | Rowan.TfsWorkingOn.Settings |
WorkingItemConfiguration | Rowan TfsWorkingOn | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\WorkingItemConfiguration.cs | Rowan.TfsWorkingOn.WorkingItemConfiguration |
MonitorBase | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\MonitorBase.cs | Rowan.TfsWorkingOn.Monitor.MonitorBase |
MonitorEventArgs | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\MonitorBase.cs | Rowan.TfsWorkingOn.Monitor.MonitorEventArgs |
Nag | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\Nag.cs | Rowan.TfsWorkingOn.Monitor.Nag |
UserActivity | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.cs | Rowan.TfsWorkingOn.Monitor.UserActivity |
UserActivityState | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.cs | Rowan.TfsWorkingOn.Monitor.UserActivityState |
LASTINPUTINFO | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.cs | Rowan.TfsWorkingOn.Monitor.LASTINPUTINFO |
SafeNativeMethods | Rowan TfsWorkingOn Monitor | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\Monitor\UserActivity.cs | Rowan.TfsWorkingOn.Monitor.SafeNativeMethods |
UserWorkedOnItem | Rowan TfsWorkingOn UserHistory | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\UserHistory\UserWorkedOnItem.cs | Rowan.TfsWorkingOn.UserHistory.UserWorkedOnItem |
ProjectCollectionWorkedOn | Rowan TfsWorkingOn UserHistory | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\UserHistory\ProjectCollectionWorkedOn.cs | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn |
ProjectWorkedOn | Rowan TfsWorkingOn UserHistory | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\TfsWorkingOn\UserHistory\ProjectWorkedOn.cs | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn |
FormEstimates | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormEstimates.cs | Rowan.TfsWorkingOn.WinForm.FormEstimates |
FormEstimates | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormEstimates.Designer.cs | Rowan.TfsWorkingOn.WinForm.FormEstimates |
FormSearchWorkItems | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormSearchWorkItems.cs | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems |
FormSearchWorkItems | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormSearchWorkItems.Designer.cs | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems |
FormWorkItem | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItem.cs | Rowan.TfsWorkingOn.WinForm.FormWorkItem |
FormWorkItem | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItem.Designer.cs | Rowan.TfsWorkingOn.WinForm.FormWorkItem |
FormWorkItemConfiguration | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItemConfiguration.cs | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
FormWorkItemConfiguration | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormWorkItemConfiguration.Designer.cs | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
Program | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\Program.cs | Rowan.TfsWorkingOn.WinForm.Program |
FormNotificationTray | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormNotificationTray.cs | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
FormNotificationTray | Rowan TfsWorkingOn WinForm | c:\CodePlex\TFSWorkingOn\Main\TfsWorkingOn\WinForm\FormNotificationTray.Designer.cs | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
Statistics
Stat | dirCorresponding | sourceFilePath |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
.NET Framework Usage | 000 |
|
System | 1210 |
|
![]() | Rule warning: Uri fields should be of type System.Uri |
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
fields | FieldType | Full Name |
---|---|---|
_teamProjectCollectionAbsoluteUri | String | Rowan.TfsWorkingOn.Connection._teamProjectCollectionAbsoluteUri |
DefaultTeamProjectCollectionAbsoluteUri | String | Rowan.TfsWorkingOn.Settings.DefaultTeamProjectCollectionAbsoluteUri |
_teamProjectCollectionAbsoluteUri | String | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn ._teamProjectCollectionAbsoluteUri |
Statistics
Stat | FieldType |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
System.Runtime.InteropServices | 210 |
|
![]() | Rule warning: Move P/Invokes to NativeMethods class |
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
method | Full Name |
---|---|
GetLastInputInfo(LASTINPUTINFO&) | Rowan.TfsWorkingOn.Monitor.SafeNativeMethods.GetLastInputInfo (LASTINPUTINFO&) |
Statistics
Stat |
---|
Sum: |
Average: |
Minimum: |
Maximum: |
Standard deviation: |
Variance: |
Object Oriented Design
|
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
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
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 |
---|---|---|
FormWorkItemConfiguration | 473 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration |
FormNotificationTray | 378 | Rowan.TfsWorkingOn.WinForm.FormNotificationTray |
FormWorkItem | 119 | Rowan.TfsWorkingOn.WinForm.FormWorkItem |
FormEstimates | 106 | Rowan.TfsWorkingOn.WinForm.FormEstimates |
WorkingItem | 95 | Rowan.TfsWorkingOn.WorkingItem |
WorkingItemConfiguration | 89 | Rowan.TfsWorkingOn.WorkingItemConfiguration |
Settings | 77 | Rowan.TfsWorkingOn.Settings |
FormSearchWorkItems | 62 | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems |
UserActivity | 50 | Rowan.TfsWorkingOn.Monitor.UserActivity |
Connection | 42 | Rowan.TfsWorkingOn.Connection |
Estimates | 30 | Rowan.TfsWorkingOn.Estimates |
Nag | 29 | Rowan.TfsWorkingOn.Monitor.Nag |
ProjectCollectionWorkedOn | 24 | Rowan.TfsWorkingOn.UserHistory.ProjectCollectionWorkedOn |
ProjectWorkedOn | 8 | Rowan.TfsWorkingOn.UserHistory.ProjectWorkedOn |
MonitorEventArgs | 0 | Rowan.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 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
// 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
// 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
// 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
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
methods | staticFieldsUsed | Full Name |
---|---|---|
get_WorkItemTypes() | 0 field | Rowan.TfsWorkingOn.WorkingItemConfiguration.get_WorkItemTypes() |
queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs) | 0 field | Rowan.TfsWorkingOn.WinForm.FormNotificationTray .queryListToolStripMenuItemDropDown_Closing(Object ,ToolStripDropDownClosingEventArgs) |
notifyMenu_Closing(Object,ToolStripDropDownClosingEventArgs) | 0 field | Rowan.TfsWorkingOn.WinForm.FormNotificationTray.notifyMenu_Closing (Object,ToolStripDropDownClosingEventArgs) |
Statistics
Stat | staticFieldsUsed |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
// 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
methods | virtualMethodsCalled | DerivedTypes | Full Name |
---|---|---|---|
.ctor() | 1 method | 0 type | Rowan.TfsWorkingOn.WorkingItemConfiguration..ctor() |
.ctor(WorkItemStore,String) | 2 methods | 0 type | Rowan.TfsWorkingOn.WinForm.FormSearchWorkItems..ctor(WorkItemStore ,String) |
.ctor(WorkItem) | 1 method | 0 type | Rowan.TfsWorkingOn.WinForm.FormWorkItem..ctor(WorkItem) |
Statistics
Stat | virtualMethodsCalled | DerivedTypes |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
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
type | staticFieldInstance | Full Name |
---|---|---|
Connection | _connection | Rowan.TfsWorkingOn.Connection |
Statistics
Stat | staticFieldInstance |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
// 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
fields | assignedBy | Full Name |
---|---|---|
_formSearchWorkItems | 1 method | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formSearchWorkItems |
_formItemConfiguration | 1 method | Rowan.TfsWorkingOn.WinForm.FormNotificationTray._formItemConfiguration |
_userActivityTriggeredCurrentlyProcessing | 1 method | Rowan.TfsWorkingOn.WinForm.FormNotificationTray ._userActivityTriggeredCurrentlyProcessing |
Statistics
Stat | assignedBy |
---|---|
Sum: | 0 |
Average: | 0 |
Minimum: | 0 |
Maximum: | 0 |
Standard deviation: | 0 |
Variance: | 0 |
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
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
|
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
// 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
|
from a in Application.Assemblies where a.WasAdded()
select new { a, a.NbLinesOfCode }
No assemblies matched
from a in codeBase.OlderVersion().Application.Assemblies where a.WasRemoved()
select new { a, a.NbLinesOfCode }
No assemblies matched
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
from n in Application.Namespaces where
!n.ParentAssembly.WasAdded() &&
n.WasAdded()
select new { n, n.NbLinesOfCode }
No namespaces matched
from n in codeBase.OlderVersion().Application.Namespaces where
!n.ParentAssembly.WasRemoved() &&
n.WasRemoved()
select new { n, n.NbLinesOfCode }
No namespaces matched
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
from t in Application.Types where
!t.ParentNamespace.WasAdded() &&
t.WasAdded()
select new { t, t.NbLinesOfCode }
No types matched
from t in codeBase.OlderVersion().Application.Types where
!t.ParentNamespace.WasRemoved() &&
t.WasRemoved()
select new { t, t.NbLinesOfCode }
No types matched
// 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
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
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
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
from m in Application.Methods where
!m.ParentType.WasAdded() &&
m.WasAdded()
select new { m, m.NbLinesOfCode }
No methods matched
from m in codeBase.OlderVersion().Application.Methods where
!m.ParentType.WasRemoved() &&
m.WasRemoved()
select new { m, m.NbLinesOfCode }
No methods matched
// 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
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
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
from f in Application.Fields where
!f.ParentType.WasAdded() &&
f.WasAdded()
select new { f }
No fields matched
from f in codeBase.OlderVersion().Application.Fields where
!f.ParentType.WasRemoved() &&
f.WasRemoved()
select new { f }
No fields matched
from t in ThirdParty.Types where t.IsUsedRecently()
select new { t, t.Methods, t.Fields, t.TypesUsingMe }
No types matched
from t in codeBase.OlderVersion().Types where t.IsNotUsedAnymore()
select new { t, t.Methods, t.Fields, TypesThatUsedMe = t.TypesUsingMe }
No types matched
from m in ThirdParty.Methods where
m.IsUsedRecently() &&
!m.ParentType.IsUsedRecently()
select new { m, m.MethodsCallingMe }
No methods matched
from m in codeBase.OlderVersion().Methods where
m.IsNotUsedAnymore() &&
!m.ParentType.IsNotUsedAnymore()
select new { m, MethodsThatCalledMe = m.MethodsCallingMe}
No methods matched
from f in ThirdParty.Fields where
f.IsUsedRecently() &&
!f.ParentType.IsUsedRecently()
select new { f, f.MethodsUsingMe }
No fields matched
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
|
// 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
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
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
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
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
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
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
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
from t in Application.Types where
t.PercentageCoverage == 0
orderby t.NbLinesOfCode descending
select new { t, t.NbLinesOfCode }
No types matched
from n in Application.Namespaces where
n.PercentageCoverage == 0
orderby n.NbLinesOfCode descending
select new { n, n.NbLinesOfCode}
No namespaces matched
// 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
// 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
// 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
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
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
methods | MethodsCallingMe | depth | Full Name |
---|---|---|---|
get_TeamProjectCollectionUri() | 0 method | 0 | Rowan.TfsWorkingOn.Connection.get_TeamProjectCollectionUri() |
linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs) | 0 method | 0 | Rowan.TfsWorkingOn.WinForm.FormWorkItemConfiguration .linkLabelAbout_LinkClicked(Object,LinkLabelLinkClickedEventArgs) |
Statistics
Stat | MethodsCallingMe | depth |
---|---|---|
Sum: | 0 | 0 |
Average: | 0 | 0 |
Minimum: | 0 | 0 |
Maximum: | 0 | 0 |
Standard deviation: | 0 | 0 |
Variance: | 0 | 0 |
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
// 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.

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.15445 | mscorlib 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.15447 | System.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
- Rowan.TfsWorkingOn
- TfsWorkingOn
Assemblies Build Order
- Rowan.TfsWorkingOn
- TfsWorkingOn
Analysis Log : Information and Warnings
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 |
---|---|
Info | 11/05/2013 15:02:37 Begin full analysis with NDepend v5.0.0.8085 |
Info | No Baseline for Comparison loaded. |
Warning | Can'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? |
Warning | Can'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? |
Warning | Can'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? |
Warning | Can'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? |
Info | Concurrent 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 |
Warning | No application or third party assembly found in folder {C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF} |
Warning | Assembly {Microsoft.TeamFoundation.WorkItemTracking.Controls} is referenced by {TfsWorkingOn} but is not found. |
Warning | Assembly {Microsoft.TeamFoundation.WorkItemTracking.Client} is referenced by {TfsWorkingOn} but is not found. |
Warning | Assembly {Microsoft.TeamFoundation.Client} is referenced by {TfsWorkingOn} but is not found. |
Warning | Assembly {Microsoft.TeamFoundation.Client} is referenced by {Rowan.TfsWorkingOn} but is not found. |
Warning | Assembly {Microsoft.TeamFoundation.WorkItemTracking.Client} is referenced by {Rowan.TfsWorkingOn} but is not found. |
Warning | Assembly {Microsoft.TeamFoundation.VersionControl.Client} is referenced by {Rowan.TfsWorkingOn} but is not found. |
Warning | The 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. |
Warning | The 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. |
Warning | The 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. |
Warning | The 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. |
Warning | The 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. |
Info | 30 source files parsed ; all source files found ; 5 source files not in-sync with PDB |
Info | 0 code rule has been extracted from code. |
Info | No dependency cycle detected in assemblies referencement graph. |
Info | 11/05/2013 15:02:37 Analyse dependencies of your application. |
Info | 11/05/2013 15:02:38 Building the report (standard). |
Warning | 3 critical rules are violated. - Avoid namespaces mutually dependent - Potentially dead Methods - Don't assign a field from many methods |
Info | 11/05/2013 15:02:40 Log trend metrics values. |