Dependency Graph

- This diagram represents the Graph of Dependencies between the .NET assemblies of your application.
- This static diagram can be useful but it is just a coarse view of your application architecture.
- It is recommended to use the NDepend interactive Dependency Graph and interactive Dependency Matrix found in the NDepend UI for an in-depth exploration of the actual architecture of your code.

Online documentation:

- NDepend Interactive Dependency Graph
- NDepend Interactive Dependency Matrix

Dependency Matrix

- This diagram represents the DSM (Dependency Structure Matrix) beetween the .NET assemblies of your application.
- The Dependency Matrix is a compact way to represent and navigate across dependencies between components.
- The number on cells of the Dependency Matrix included in the report, represent the number of types involved in the coupling
- It is recommended to use the NDepend interactive Dependency Matrix and interactive Dependency Graph found in the NDepend UI for an in-depth exploration of the actual architecture of your code.

Online documentation:

- NDepend Interactive Dependency Matrix
- NDepend Interactive Dependency Graph

Visualizing Code Metrics through Treemaping

- In this Metric View, the code base is represented through a Treemap.
- Treemapping is a method for displaying tree-structured data by using nested rectangles.
- In the present treemap, each rectangle represents a method and the area of a rectangle is proportional to the number of lines of code of the corresponding method.
- It is recommended to use the NDepend interactive Metric View found in the NDepend UI for an in-depth code metrics exploration.

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

- Visualizing Code Metrics with Treemap

Abstractness versus Instability Diagram

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

- Abstractness: If an assembly contains many abstract types (i.e interfaces and abstract classes) and few concrete types, it is considered as abstract.
- Instability: An assembly is considered stable if its types are used by a lot of types from other assemblies. In this context stable means painful to modify.

Online documentation:

- Definitions of related Code Metrics

For beginners: Where to start

- Search for unwanted dependencies.
- Look for complex methods listed through the standard Rule Quick Summary of methods to refactor.
- Inspect other standard Rules that were violated.
- See how standard Rules are written and customize some Rules to your needs.
- Look at Code Metrics definitions to see how Code Metrics can help increase code quality.
- Use the Code Diff feature to review code changes (pro edition only).
- Import test coverage data to assess possible improvements in your testing strategy (pro edition only).

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

- It is recommended to use the NDepend interactive UI capabilities to browse a large list of code elements matched.
- To enable or disable this setting, there is a tickbox labelled Don't show more than 100 matched items for a Rule violated in the NDepend Project Properties panel > Report tab > Avoid too big report for large code base section
- This setting is enabled by default to avoid to have too large reports when analyzing large code bases.

Does this report gets too large?

- There is a setting enabled by default to avoid to have too large reports when analyzing large code bases.
- To enable or disable this setting, there is a tickbox labelled Don't show more than 100 matched items for a Rule violated in the NDepend Project Properties panel > Report tab > Avoid too big report for large code base section
- It is recommended to use the NDepend interactive UI capabilities to browse a large list of code elements matched.

Quick Tips

- In addition to the NDepend report, use the interactive UI through the standalone executable VisualNDepend.exe, or through the Visual Studio NDepend Addin.
- With the interactive UI, browse more detailed data and have Rules checking updated each time the code is modified and recompiled.
- The analysis execution and the report options are configurable through the interactive UI, in the panel Project Properties.
- Plain HTML report (single HTML page, no javascript, no menu) is also available.
- Full NDepend documentation is available on the NDepend website under the Documentation menu.

Main
Main \ Rules
Main \ Quality Gates
Main \ Quality Gates \ Quality Gates
Main \ Rules \ Code Smells
Main \ Rules \ Object Oriented Design
Main \ Rules \ Design
Main \ Rules \ Architecture
Main \ Rules \ Immutability
Main \ Rules \ Naming Conventions
Main \ Group of Queries \ Hot Spots
Main \ Group of Queries \ Object Oriented Design
Main \ Group of Queries \ API Breaking Changes
Main \ Group of Queries \ Code Coverage
Main \ Group of Queries \ Dead Code
Main \ Group of Queries \ Code Diff Summary
Main \ Metrics \ Application Statistics
Main \ Metrics \ Assemblies Metrics
Main \ Metrics \ Namespaces Metrics
Main \ Metrics \ Types Metrics
Main \ Assemblies Dependencies
Main \ Namespaces Dependencies
Main \ Types Dependencies
Main \ Build Order
Main \ Analysis Log
Main \ Abstractness vs. Instability
Main \ Trend Charts
menu
ndepend report summary application nameChapter12FinalCode (v1.0.0.0)report build date08/28/2023 22:19:48 analysis duration01:14.481 ndepend version 2023.1.1 Professional Developer Edition baseline for comparisonBaseline is same code base snapshot.code coverage data Not Defined. To import Code Coverage Data, please read this online documentation.
Get started.Quick tips.Back to NDepend. The present HTML report is a summary of data gathered by the analysis.
It is recommended to use the NDepend interactive UI capabilities
to make the most of NDepend by mastering all aspects of your code.

#### Diagrams

Dependency Graph
View as ?full scaled
Dependency Matrix
View as ?full scaled
Treemap Metric View
View as ?full scaled
Abstractness vs. Instability
View ?control image

#### Application Metrics

Note: Further Application Statistics are available.

# Lines of Code
246 |  | no diff
6 (NotMyCode) |  | no diff
Estimated Dev Effort 9.97d |  | no diff
# Types
24 |  | no diff
1 Assemblies |  | no diff
10 Namespaces |  | no diff
70 Methods |  | no diff
7 Fields |  | no diff
20 Source Files |  | no diff
160 Third-Party Elements |  | no diff
Comment N/A because some assemblies are written in a language different than C#
Debt
7.92% |  | no diff
Rating |  | B |  | 2h 19min effort to reach |  | A
Debt 6h 19min |  | no diff
The technical-debt is incomplete because no coverage data specified. |  |
Coverage N/A because no coverage data specified
Method Complexity
17 Max |  | no diff
1.41 Average |  | no diff
Quality Gates
| Fail | 2 |  |
| Warn | 0 |  |
| Pass | 9 |  |
Rules
| Critical | 1 |  |
| Violated | 11 |  |
| Ok | 152 |  |
Issues
| All | 33 |  |
| Blocker | 0 |  |
| Critical | 0 |  |
| High | 8 |  |
| Medium | 19 |  |
| Low | 6 |  |
| Suppressed | 0 |  |

#### Quality Gates summary

9 0 2
Some Quality Gates fail. The build
can be stopped upon quality gate
failure. Online documentation.
Quality Gates that measure diff cannot
be run on the baseline. Hence they
have blank trend and baseline value.

Name | Trend | Baseline Value | Value | Group
--- | --- | --- | --- | ---
|  | Percentage Coverage
|  | N/A % | N/A % | Project Rules \ Quality Gates
|  | Percentage Coverage on New Code
|  | N/A % | N/A % | Project Rules \ Quality Gates
|  | Percentage Coverage on Refactored Code
|  | N/A % | N/A % | Project Rules \ Quality Gates
|  | Blocker Issues
|  | 0 issues | 0 issues | Project Rules \ Quality Gates
|  | Critical Issues
|  | 0 issues | 0 issues | Project Rules \ Quality Gates
|  | New Blocker / Critical / High Issues
|  |  | 0 issues | Project Rules \ Quality Gates
|  | Critical Rules Violated
|  | 1 rules | 1 rules | Project Rules \ Quality Gates
|  | Percentage Debt
|  | 7.92 % | 7.92 % | Project Rules \ Quality Gates
|  | New Debt since Baseline
|  |  | 0 man-days | Project Rules \ Quality Gates
|  | Debt Rating per Namespace
|  | 1 namespaces | 1 namespaces | Project Rules \ Quality Gates
|  | New Annual Interest since Baseline
|  |  | 0 man-days | Project Rules \ Quality Gates

#### Rules summary

152 11 1

- Number of Rules or Queries with Error (syntax error, exception thrown, time-out): 0
- Number of Rules violated: 12

Rules can be checked live at
development-time, from within Visual
Studio. Online documentation.
Rules that rely on diff cannot be
run on the baseline. Hence they
have blank # Issues Fixed or Added.

Name | # Issues | Added | Fixed | Elements | Group
--- | --- | --- | --- | --- | ---
|  | Avoid methods potentially poorly commented
| 1 | 0 | 0 | method | Project Rules \ Code Smells
|  | A stateless class or structure might be turned into a static type
| 1 | 0 | 0 | type | Project Rules \ Object Oriented Design
|  | Non-static classes should be instantiated or turned to static
| 11 | 0 | 0 | types | Project Rules \ Object Oriented Design
|  | Methods should be declared static if possible
| 1 | 0 | 0 | method | Project Rules \ Object Oriented Design
|  | Avoid namespaces with few types
| 5 | 0 | 0 | namespaces | Project Rules \ Design
|  | Don't use obsolete types, methods or fields
| 1 | 0 | 0 | method | Project Rules \ Design
|  | Avoid namespaces mutually dependent
| 4 | 0 | 0 | members | Project Rules \ Architecture
|  | Avoid namespaces dependency cycles
| 1 | 0 | 0 | namespace | Project Rules \ Architecture
|  | Fields should be marked as ReadOnly when possible
| 1 | 0 | 0 | field | Project Rules \ Immutability
|  | Record classes should be immutable
| 1 | 0 | 0 | type | Project Rules \ Immutability
|  | Avoid prefixing type name with parent namespace name
| 5 | 0 | 0 | types | Project Rules \ Naming Conventions
|  | Avoid naming types and namespaces with the same identifier
| 1 | 0 | 0 | type | Project Rules \ Naming Conventions

#### Application Statistics

Stat | # Occurences | Avg | StdDev | Max
--- | --- | --- | --- | ---
Properties on interfaces | 2 interfaces | 4 | 1 | 5 properties on Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.IFlightInfo
Methods on interfaces | 2 interfaces | 5 | 1 | 6 methods on Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.IFlightInfo
Arguments on methods on interfaces | 10 methods | 0.1 | 0.3 | 1 arguments on Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.IFlightInfo.set_Status(FlightStatus)
Public properties on classes | 24 Classes | 1.71 | 2.17 | 8 public properties on Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.Search.FlightSearch
Public methods on classes | 24 classes | 5.83 | 4.5 | 17 public methods on Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.Search.FlightSearch
Arguments on public methods on classes | 140 methods | 0.55 | 0.66 | 4 arguments on Packt.CloudySkiesAir.Chapter12.Flight.Baggage.BaggageCalculator.CalculatePrice(Int32,Int32,Int32,Boolean)
IL instructions in non-abstract methods | 152 methods | 13.47 | 28.08 | 274 IL instructions in Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.FlightScheduler.Search(FlightSearch)
Cyclomatic complexity on non abstract Methods | 152 Methods | 1.8 | 3.05 | CC = 30 for Packt.CloudySkiesAir.Chapter12.Flight.Scheduling.FlightScheduler.Search(FlightSearch)

#### Assemblies Metrics

If you wish to define thresholds on assemblies' Code Metrics, consider writing some Rules.
Clicking column header arrows sorts values.
Clicking column header title text redirect to the online Code Metric definition.

Assemblies | # lines of code | # IL instruction | # Types | # Abstract Types | # lines of comment | % Comment | % Coverage | Afferent Coupling | Efferent Coupling | Relational Cohesion | Instability | Abstractness | Distance
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
Chapter12 v1.0.0.0 | 246 | 2047 | 28 | 4 | 0 | 0 | - | 0 | 46 | 2.71 | 1 | 0.14 | 0.1

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.

#### Types Metrics : Code Quality

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
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
NullableContextAttribute | 5.68 | 0 | 7 | - | - | - | 1 | - | 21 | 6 | System.Runtime.CompilerServices
EmbeddedAttribute | 2.25 | 0 | 4 | - | - | - | 1 | - | 3 | 3 | Microsoft.CodeAnalysis
IFlightInfo | 2.18 | - | - | - | - | - | - | - | 10 | 6 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
NullableAttribute | 2.06 | 0 | 19 | - | - | - | 2 | - | 12 | 7 | System.Runtime.CompilerServices
AirportEvent | 1.53 | 6 | 166 | 0 | 0 | 5 | 25 | - | 6 | 18 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
Airport | 1.08 | 13 | 70 | 0 | 0 | 11 | 14 | - | 6 | 13 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
FlightStatus | 1.06 | - | - | - | - | - | - | - | 3 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FlightFilterBase | 0.85 | 0 | 4 | - | - | - | 1 | - | 4 | 5 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
FlightInfoBase | 0.66 | 12 | 78 | 0 | 0 | 12 | 12 | - | 3 | 18 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
ICargoItem | 0.42 | - | - | 0 | 0 | 2 | - | - | 2 | 6 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
BoardingStatus | 0.25 | - | - | - | - | - | - | - | 1 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
Passenger | 0.25 | 14 | 56 | 0 | 0 | 14 | 15 | - | 1 | 12 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
FlightSearch | 0.25 | 16 | 60 | 0 | 0 | 16 | 17 | - | 1 | 10 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
DateHelpers | 0.24 | 2 | 11 | 0 | 0 | 1 | 1 | - | 1 | 7 | Packt.CloudySkiesAir.Chapter12 .Helpers
FlightScheduler | 0.24 | 34 | 357 | 0 | 0 | 24 | 39 | - | 1 | 24 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
BoardingProcessor | 0.15 | 41 | 295 | 0 | 0 | 18 | 37 | - | 0 | 23 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
BaggageCalculator | 0.15 | 27 | 167 | 0 | 0 | 10 | 11 | - | 0 | 12 | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage
PassengerFlightInfo | 0.15 | 5 | 44 | 0 | 0 | 5 | 6 | - | 0 | 10 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FreightFlightInfo | 0.15 | 5 | 45 | 0 | 0 | 5 | 6 | - | 0 | 13 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
Flight | 0.15 | 1 | 14 | 0 | 0 | 1 | 2 | - | 0 | 4 | Packt.CloudySkiesAir.Chapter12 .Flight
FlightTracker | 0.15 | 26 | 269 | 0 | 0 | 13 | 21 | - | 0 | 25 | Packt.CloudySkiesAir.Chapter12 .Flight
RefSafetyRulesAttribute | 0.15 | 0 | 7 | - | - | - | 1 | - | 0 | 6 | System.Runtime.CompilerServices
Program | 0.15 | 1 | 9 | 0 | 0 | 1 | 2 | - | 0 | 6 | Packt.CloudySkiesAir.Chapter12
AirportFilter | 0.15 | 7 | 43 | 0 | 0 | 6 | 8 | - | 0 | 14 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
CargoItem | 0.15 | 6 | 47 | 0 | 0 | 6 | 7 | - | 0 | 14 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
CharterFlightInfo | 0.15 | 11 | 78 | 0 | 0 | 5 | 7 | - | 0 | 21 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FlightDurationFilter | 0.15 | 9 | 84 | 0 | 0 | 9 | 17 | - | 0 | 10 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
FlightTimeFilter | 0.15 | 8 | 86 | 0 | 0 | 11 | 19 | - | 0 | 11 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search

#### Types Metrics : Code Members and Inheritance

Type Name | # Instance Methods | Nb Static Methods | Nb Properties | # Fields | # Children Classes | Depth Of Inheritance Tree | Type Namespace
--- | --- | --- | --- | --- | --- | --- | ---
NullableContextAttribute | 1 | 0 | 0 | 1 | 0 | 2 | System.Runtime.CompilerServices
EmbeddedAttribute | 1 | 0 | 0 | 0 | 0 | 2 | Microsoft.CodeAnalysis
IFlightInfo | 6 | 0 | 5 | 0 | - | - | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
NullableAttribute | 2 | 0 | 0 | 1 | 0 | 2 | System.Runtime.CompilerServices
AirportEvent | 14 | 2 | 3 | 2 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
Airport | 10 | 0 | 3 | 3 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
FlightStatus | - | - | - | - | - | - | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FlightFilterBase | 2 | 0 | 0 | 0 | 3 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
FlightInfoBase | 12 | 0 | 5 | 4 | 3 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
ICargoItem | 4 | 0 | 3 | 0 | - | - | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
BoardingStatus | - | - | - | - | - | - | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
Passenger | 15 | 0 | 7 | 6 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
FlightSearch | 17 | 0 | 8 | 8 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
DateHelpers | 0 | 1 | 0 | 0 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Helpers
FlightScheduler | 6 | 0 | 0 | 1 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
BoardingProcessor | 8 | 0 | 2 | 3 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
BaggageCalculator | 4 | 2 | 1 | 4 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage
PassengerFlightInfo | 6 | 0 | 1 | 1 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FreightFlightInfo | 6 | 0 | 2 | 2 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
Flight | 2 | 0 | 0 | 0 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight
FlightTracker | 7 | 0 | 0 | 1 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight
RefSafetyRulesAttribute | 1 | 0 | 0 | 1 | 0 | 2 | System.Runtime.CompilerServices
Program | 1 | 1 | 0 | 0 | 0 | 1 | Packt.CloudySkiesAir.Chapter12
AirportFilter | 6 | 0 | 2 | 2 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
CargoItem | 7 | 0 | 2 | 2 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
CharterFlightInfo | 3 | 0 | 1 | 1 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FlightDurationFilter | 6 | 0 | 2 | 2 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
FlightTimeFilter | 8 | 0 | 3 | 3 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search

#### 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
--- | --- | --- | --- | ---
NullableContextAttribute | 0 | 0 | 1 | System.Runtime.CompilerServices
EmbeddedAttribute | 0 | 0 | 1 | Microsoft.CodeAnalysis
IFlightInfo | - | - | 0 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
NullableAttribute | 0 | 0 | 1 | System.Runtime.CompilerServices
AirportEvent | 0 | 0 | 12 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
Airport | 0 | 0 | 3 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
FlightStatus | - | - | 0 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FlightFilterBase | 0 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
FlightInfoBase | 0 | 0 | 10 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
ICargoItem | - | - | 6 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
BoardingStatus | - | - | 0 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
Passenger | 0 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
FlightSearch | 0 | 0 | 1 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
DateHelpers | 0 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Helpers
FlightScheduler | 0 | 0 | 34 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
BoardingProcessor | 0.25 | 0.33 | 26 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
BaggageCalculator | 0 | 0 | 13 | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage
PassengerFlightInfo | 0 | 0 | 7 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FreightFlightInfo | 0 | 0 | 3 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
Flight | 0 | 0 | 2 | Packt.CloudySkiesAir.Chapter12 .Flight
FlightTracker | 0.57 | 0.67 | 31 | Packt.CloudySkiesAir.Chapter12 .Flight
RefSafetyRulesAttribute | 0 | 0 | 1 | System.Runtime.CompilerServices
Program | 0 | 0 | 2 | Packt.CloudySkiesAir.Chapter12
AirportFilter | 0 | 0 | 4 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
CargoItem | 0 | 0 | 9 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
CharterFlightInfo | 0 | 0 | 16 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights
FlightDurationFilter | 0 | 0 | 6 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search
FlightTimeFilter | 0 | 0 | 8 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search

#### Namespaces Metrics

If you wish to define thresholds on namespaces' Code Metrics, consider writing some Code Rules.
Clicking column header arrows sorts values.
Clicking column header title text redirect to the online Code Metric definition.

Namespaces | # lines of code | # IL instruction | # Types | # lines of comment | % Comment | % Coverage | Afferent Coupling | Efferent Coupling
--- | --- | --- | --- | --- | --- | --- | --- | ---
Microsoft.CodeAnalysis | 0 | 4 | 1 | - | - | - | 1 | 2
Chapter12.dll::System.Runtime .CompilerServices | 0 | 33 | 3 | - | - | - | 7 | 3
Packt.CloudySkiesAir.Chapter12 | 1 | 9 | 1 | 0 | 0 | - | 0 | 3
Packt.CloudySkiesAir.Chapter12 .Helpers | 2 | 11 | 1 | 0 | 0 | - | 1 | 4
Packt.CloudySkiesAir.Chapter12 .Flight | 27 | 283 | 2 | 0 | 0 | - | 0 | 10
Packt.CloudySkiesAir.Chapter12 .Flight.Boarding | 55 | 351 | 3 | 0 | 0 | - | 0 | 8
Packt.CloudySkiesAir.Chapter12 .Flight.Baggage | 27 | 167 | 1 | 0 | 0 | - | 0 | 4
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 53 | 593 | 4 | 0 | 0 | - | 3 | 12
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search | 40 | 277 | 5 | 0 | 0 | - | 1 | 5
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights | 41 | 319 | 7 | 0 | 0 | - | 2 | 9

####

Quality Gates 9 0 2

2 Quality Gate(s) that Fail Critical Rules Violated Debt Rating per Namespace 9 Quality Gate(s) that Pass Percentage Coverage Percentage Coverage on New Code Percentage Coverage on Refactored Code Blocker Issues Critical Issues New Blocker / Critical / High Issues Percentage Debt New Debt since Baseline New Annual Interest since Baseline

|  | Quality Gate Pass: Percentage Coverage

• Quality Gate Description: Code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage, measured as a percentage, has had more of its source code executed during testing which suggests it has a lower chance of containing undetected software bugs compared to a program with low code coverage. Code coverage is certainly the most important quality code metric. But coverage is not enough the team needs to ensure that results are checked at test-time. These checks can be done both in test code, and in application code through assertions. The important part is that a test must fail explicitly when a check gets unvalidated during the test execution. This quality gate defines a warn threshold (80%) and a fail threshold (70%). These are indicative thresholds and in practice the more the better. To achieve high coverage and low risk, make sure that new and refactored classes gets 100% covered by tests and that the application and test code contains as many checks/assertions as possible.

### Scalar Result: N/A %

|  | Quality Gate Pass: Percentage Coverage on New Code

• Quality Gate Description: New Code is defined as methods added since the baseline. To achieve high code coverage it is essential that new code gets properly tested and covered by tests. It is advised that all non-UI new classes gets 100% covered. Typically 90% of a class is easy to cover by tests and 10% is hard to reach through tests. It means that this 10% remaining is not easily testable, which means it is not well designed, which often means that this code is especially error-prone. This is the reason why it is important to reach 100% coverage for a class, to make sure that potentially error-prone code gets tested.

### Scalar Result: N/A %

|  | Quality Gate Pass: Percentage Coverage on Refactored Code

• Quality Gate Description: Refactored Code is defined as methods where code was changed since the baseline. Comment changes and formatting changes are not considered as refactoring. To achieve high code coverage it is essential that refactored code gets properly tested and covered by tests. It is advised that when refactoring a class or a method, it is important to also write tests to make sure it gets 100% covered. Typically 90% of a class is easy to cover by tests and 10% is hard to reach through tests. It means that this 10% remaining is not easily testable, which means it is not well designed, which often means that this code is especially error-prone. This is the reason why it is important to reach 100% coverage for a class, to make sure that potentially error-prone code gets tested.

### Scalar Result: N/A %

|  | Quality Gate Pass: Blocker Issues

• Quality Gate Description: An issue with the severity Blocker cannot move to production, it must be fixed. The severity of an issue is either defined explicitly in the rule source code, either inferred from the issue annual interest and thresholds defined in the NDepend Project Properties > Issue and Debt.

###

No issue matched

|  | Quality Gate Pass: Critical Issues

• Quality Gate Description: An issue with a severity level Critical shouldn't move to production. It still can for business imperative needs purposes, but at worst it must be fixed during the next iterations. The severity of an issue is either defined explicitly in the rule source code, either inferred from the issue annual interest and thresholds defined in the NDepend Project Properties > Issue and Debt.

###

No issue matched

|  | Quality Gate Pass: New Blocker / Critical / High Issues

• Quality Gate Description: An issue with the severity Blocker cannot move to production, it must be fixed. An issue with a severity level Critical shouldn't move to production. It still can for business imperative needs purposes, but at worth it must be fixed during the next iterations. An issue with a severity level High should be fixed quickly, but can wait until the next scheduled interval. The severity of an issue is either defined explicitly in the rule source code, either inferred from the issue annual interest and thresholds defined in the NDepend Project Properties > Issue and Debt.

###

No issue matched

|  | Quality Gate Fail: Critical Rules Violated

• Quality Gate Description: The concept of critical rule is useful to pinpoint certain rules that should not be violated. A rule can be made critical just by checking the Critical button in the rule edition control and then saving the rule. This quality gate fails if any critical rule gets any violations. When no baseline is available, rules that rely on diff are not counted. If you observe that this quality gate count slightly decreases with no apparent reason, the reason is certainly that rules that rely on diff are not counted because the baseline is not defined.

###

1 rule matched

1 rule | issues | Full Name
--- | --- | ---
Avoid namespaces mutually dependent | 0 4 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>) violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo} violates rule 'Avoid namespaces mutually dependent' | Rule

|  | Quality Gate Pass: Percentage Debt

• Quality Gate Description: % Debt total is defined as a percentage on: • the estimated total effort to develop the code base • and the the estimated total time to fix all issues (the Debt) Estimated total effort to develop the code base is inferred from # lines of code of the code base and from the Estimated number of man-day to develop 1000 logical lines of code setting found in NDepend Project Properties > Issue and Debt. Debt documentation: https://www.ndepend.com/docs/technical-debt#Debt This quality gates fails if the estimated debt is more than 30% of the estimated effort to develop the code base, and warns if the estimated debt is more than 20% of the estimated effort to develop the code base

### Scalar Result: 7.92 %

|  | Quality Gate Pass: New Debt since Baseline

• Quality Gate Description: This Quality Gate fails if the estimated effort to fix new or worsened issues (what is called the New Debt since Baseline) is higher than 2 man-days. This Quality Gate warns if this estimated effort is positive. Debt documentation: https://www.ndepend.com/docs/technical-debt#Debt

### Scalar Result: 0 man-days

|  | Quality Gate Fail: Debt Rating per Namespace

• Quality Gate Description: Forbid namespaces with a poor Debt Rating equals to E or D. The Debt Rating for a code element is estimated by the value of the Debt Ratio and from the various rating thresholds defined in this project Debt Settings. The Debt Ratio of a code element is a percentage of Debt Amount (in floating man-days) compared to the estimated effort to develop the code element (also in floating man-days). The estimated effort to develop the code element is inferred from the code elements number of lines of code, and from the project Debt Settings parameters estimated number of man-days to develop 1000 logical lines of code. The logical lines of code corresponds to the number of debug breakpoints in a method and doesn't depend on code formatting nor comments. The Quality Gate can be modified to match assemblies, types or methods with a poor Debt Rating, instead of matching namespaces.

###

1 namespace matched

1 namespace | debtRating | debtRatio | devTimeInManDay | debtInManDay | issues | Full Name
--- | --- | --- | --- | --- | --- | ---
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 0D | 0 27.41 | 0 2d 0h | 0 4h 27min | 0 First 5 of 10 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling violates rule 'Avoid namespaces with few types' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling violates rule 'Avoid namespaces dependency cycles' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent violates rule 'Record classes should be immutable' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Non-static classes should be instantiated or turned to static' | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling

|  | Quality Gate Pass: New Annual Interest since Baseline

• Quality Gate Description: This Quality Gate fails if the estimated annual cost to leave all issues unfixed, increased from more than 2 man-days since the baseline. This Quality Gate warns if this estimated annual cost is positive. This estimated annual cost is named the Annual-Interest. Each rule can either provide a formula to compute the Annual-Interest per issue, or assign a Severity level for each issue. Some thresholds defined in Project Properties > Issue and Debt > Annual Interest are used to infer an Annual-Interest value from a Severity level. Annual Interest documentation: https://www.ndepend.com/docs/technical-debt#AnnualInterest

### Scalar Result: 0 man-days

####

Hot Spots 0 0 0

####

Code Smells 0 0 0

####

Code Smells Regression 0 0 0

####

Object Oriented Design 0 0 0

####

Design 0 0 0

####

Architecture 0 0 0

####

API Breaking Changes 0 0 0

####

Code Coverage 0 0 0

####

Dead Code 0 0 0

####

Security 0 0 0

####

Visibility 0 0 0

####

Immutability 0 0 0

####

Naming Conventions 0 0 0

####

Source Files Organization 0 0 0

####

.NET Framework Usage 0 0 0

####

API Usage 0 0 0

####

Defining JustMyCode 0 0 0

####

Trend Metrics 0 0 0

####

Code Diff Summary 0 0 0

####

Rules extracted from Source Code 0 0 0

####

Code Smells 7 1 0

1 Rule(s) violated Avoid methods potentially poorly commented

|  | Rule Violated: Avoid methods potentially poorly commented

• Rule Description: This rule matches methods with less than 10% of comment lines and that have at least 20 lines of code. Such method might need to be more commented. See the definitions of the Comments metric here: https://www.ndepend.com/docs/code-metrics#PercentageComment https://www.ndepend.com/docs/code-metrics#NbLinesOfComment Notice that only comments about the method implementation (comments in method body) are taken account.

• How to Fix Issues of this Rule: Typically add more comment. But code commenting is subject to controversy. While poorly written and designed code would needs a lot of comment to be understood, clean code doesn't need that much comment, especially if variables and methods are properly named and convey enough information. Unit-Test code can also play the role of code commenting. However, even when writing clean and well-tested code, one will have to write hacks at a point, usually to circumvent some API limitations or bugs. A hack is a non-trivial piece of code, that doesn't make sense at first glance, and that took time and web research to be found. In such situation comments must absolutely be used to express the intention, the need for the hacks and the source where the solution has been found. The estimated Debt, which means the effort to comment such method, varies linearly from 2 minutes for 10 lines of code not commented, up to 20 minutes for 200 or more, lines of code not commented.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1006:AvoidMethodsPotentiallyPoorlyCommented", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 method matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 method | Percentage Comment | # lines of code (LOC) | # lines of comment | nbLinesOfCodeNotCommented | Debt | Annual Interest | Full Name
--- | --- | --- | --- | --- | --- | --- | ---
Search(FlightSearch) | 0 0 | 0 26 | 0 0 | 0 26 | 0 2min 36s | 016min | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch)

####

Object Oriented Design 11 3 0

3 Rule(s) violated A stateless class or structure might be turned into a static type Non-static classes should be instantiated or turned to static Methods should be declared static if possible

|  | Rule Violated: A stateless class or structure might be turned into a static type

• Rule Description: This rule matches classes and structures that are not static, nor generic, that doesn't have any instance fields, that doesn't implement any interface nor has a base class (different than System.Object). Such class or structure is a stateless collection of pure functions, that doesn't act on any this object data. Such collection of pure functions is better hosted in a static class. Doing so simplifies the client code that doesn't have to create an object anymore to invoke the pure functions.

• How to Fix Issues of this Rule: Declare all methods as static and transform the class or structure into a static class. By default issues of this rule have a Low severity because they reflect more an advice than a problem.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1206:AStatelessClassOrStructureMightBeTurnedIntoAStaticType", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 type matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 type | methodsUsingMe | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Flight | 0no method | 0 1min 0s | 0Low | Packt.CloudySkiesAir.Chapter12 .Flight.Flight

|  | Rule Violated: Non-static classes should be instantiated or turned to static

• Rule Description: If the constructors of a class are never called, the class is never instantiated, and should be defined as a static class. However this rule doesn't match instantiation through reflection. As a consequence, plug-in root classes, instantiated through reflection via IoC frameworks, can be false positives for this rule. This rule doesn't match also classes instantiated by the ASP.NET infrastructure, ASP.NET view model classes and Entity Framework ModelSnapshot, DbContext and Migration classes. Notice that by default this rule matches also public class. If you are developing a framework with classes that are intended to be instantiated by your clients, just uncomment the line !t.IsPublic.

• How to Fix Issues of this Rule: First it is important to investigate why the class is never instantiated. If the reason is the class hosts only static methods then the class can be safely declared as static. Others reasons like, the class is meant to be instantiated via reflection, or is meant to be instantiated only by client code should lead to adapt this rule code to avoid these matches.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1207:NonStaticClassesShouldBeInstantiatedOrTurnedToStatic", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

11 types matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

11 types | Visibility | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Flight | 03Public | 03 2min 0s | 03Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Flight
FlightTracker | 04Public | 04 2min 0s | 04Medium | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker
BoardingProcessor | 02Public | 02 2min 0s | 02Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor
Passenger | 00Public | 00 2min 0s | 00Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger
BaggageCalculator | 01Public | 01 2min 0s | 01Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator
Airport | 05Public | 05 2min 0s | 05Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport
FlightScheduler | 09Public | 09 2min 0s | 09Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler
AirportFilter | 10Public | 10 2min 0s | 10Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter
FlightDurationFilter | 08Public | 08 2min 0s | 08Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter
FlightSearch | 06Public | 06 2min 0s | 06Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch
FlightTimeFilter | 07Public | 07 2min 0s | 07Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter

|  | Rule Violated: Methods should be declared static if possible

• Rule Description: When an instance method can be safely declared as static you should declare it as static. Whenever you write a method, you fulfill a contract in a given scope. The narrower the scope is, the smaller the chance is that you write a bug. When a method is static, you can't access non-static members; hence, your scope is narrower. So, if you don't need and will never need (even in subclasses) instance fields to fulfill your contract, why give access to these fields to your method? Declaring the method static in this case will let the compiler check that you don't use members that you do not intend to use. Declaring a method as static if possible is also good practice because clients can tell from the method signature that calling the method can't alter the object's state. Doing so, is also a micro performance optimization, since a static method is a bit cheaper to invoke than an instance method, because the this reference* doesn't need anymore to be passed. Notice that if a matched method is a handler, bound to an event through code generated by a designer, declaring it as static might break the designer generated code, if the generated code use the this invocation syntax, (like this.Method()).

• How to Fix Issues of this Rule: Declare matched methods as static. Since such method doesn't use any instance fields and methods of its type and base-types, you should consider if it makes sense, to move such a method to a static utility class.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1208:MethodsShouldBeDeclaredStaticIfPossible", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 method matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 method | staticFieldsUsed | methodsCallingMe | Debt | Severity | Full Name
--- | --- | --- | --- | --- | ---
BuildMessage(String,String) | 0no field | 0no method | 0 0min 30s | 0Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String)

####

Design 10 2 0

2 Rule(s) violated Avoid namespaces with few types Don't use obsolete types, methods or fields

|  | Rule Violated: Avoid namespaces with few types

• Rule Description: This rule warns about namespaces other than the global namespace that contain less than five types. Make sure that each of your namespaces has a logical organization and that a valid reason exists to put 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. For example, the System.Web.UI namespace contains types that are used in Web applications, and the System.Windows.Forms namespace contains types that are used in Windows-based applications. Even though both namespaces have types that control aspects of the user interface, these types are not designed for use in the same application. Therefore, they are located in separate namespaces. Careful namespace organization can also be helpful because it increases the discoverability of a feature. By examining the namespace hierarchy, library consumers should be able to locate the types that implement a feature. Notice that this rule source code contains a list of common infrastructure namespace names that you can complete. Namespaces with ending name component in this list are not matched.

• How to Fix Issues of this Rule: To fix a violation of this rule, try to combine namespaces that contain just a few types into a single namespace.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1305:AvoidNamespacesWithFewTypes", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

5 namespaces matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

5 namespaces | types | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Packt.CloudySkiesAir.Chapter12 | 3 1 type Packt.CloudySkiesAir.Chapter12 .Program | 1 5min | 1Low | Packt.CloudySkiesAir.Chapter12
Packt.CloudySkiesAir.Chapter12 .Flight.Baggage | 4 1 type Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator | 0 5min | 0Low | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage
Packt.CloudySkiesAir.Chapter12 .Flight | 2 2 types Packt.CloudySkiesAir.Chapter12 .Flight.Flight Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker | 2 5min | 2Low | Packt.CloudySkiesAir.Chapter12 .Flight
Packt.CloudySkiesAir.Chapter12 .Flight.Boarding | 1 3 types Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger | 4 5min | 4Low | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 0 4 types Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo | 3 5min | 3Low | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling

|  | Rule Violated: Don't use obsolete types, methods or fields

• Rule Description: The attribute System.ObsoleteAttribute is used to tag types, methods, fields, properties or events of an API that clients shouldn't use because these code elements will be removed sooner or later. This rule warns about methods that use a type, a method or a field, tagged with System.ObsoleteAttribute.

• How to Fix Issues of this Rule: Typically when a code element is tagged with System.ObsoleteAttribute, a workaround message is provided to clients. This workaround message will tell you what to do to avoid using the obsolete code element. The estimated Debt, which means the effort to fix such issue, is 5 minutes per type, method or field used. Issues of this rule have a severity High because it is important to not rely anymore on obsolete code.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1311:DontUseObsoleteTypesMethodsOrFields", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 method matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 method | obsoleteUsage | Debt | Severity | Full Name
--- | --- | --- | --- | ---
.ctor() | 0 1 method Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .FlightInfoBase..ctor() | 0 5min | 0High | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor()

####

Architecture 6 1 1

1 Critical Rule(s) violated Avoid namespaces mutually dependent 1 Rule(s) violated Avoid namespaces dependency cycles

|  | Critical Rule Violated: Avoid namespaces mutually dependent

• Rule Description: This rule lists types and methods from a low-level namespace that use types and methods from higher-level namespace. The pair of low and high level namespaces is made of two namespaces that use each other. For each pair of namespaces, to infer which one is low-level and which one is high-level, the rule computes the two coupling [from A to B] and [from B to A] in terms of number of types, methods and fields involved in the coupling. Typically the coupling from low-level to high-level namespace is significantly lower than the other legitimate coupling. Following this rule is useful to avoid namespaces dependency cycles. This will get the code architecture close to a layered architecture, where low-level code is not allowed to use high-level code. In other words, abiding by this rule will help significantly getting rid of what is often called spaghetti code: Entangled code that is not properly layered and structured. More on this in our white books relative to partitioning code. https://www.ndepend.com/docs/white-books

• How to Fix Issues of this Rule: Refactor the code to make sure that the low-level namespace doesn't use the high-level namespace. The rule lists in detail which low-level types and methods shouldn't use which high-level types and methods. The refactoring patterns that help getting rid of each listed dependency include: • Moving one or several types from the low-level namespaces to the high-level one, or do the opposite. • Use Inversion of Control (IoC): http://en.wikipedia.org/wiki/Inversion_of_control This consists in creating new interfaces in the low-level namespace, implemented by classes in the high-level namespace. This way low-level code can consume high-level code through interfaces, without using directly high-level implementations. Interfaces can be passed to low-level code through the high-level namespace code, or through even higher-level code. In related documentations you can see these interfaces named as callbacks, and the overall pattern is also known as Dependency Injection (DI): http://en.wikipedia.org/wiki/Dependency_injection That rule might not be applicable for frameworks that present public namespaces mutually dependent. In such situation the cost to break the API can be higher than the cost to let the code entangled. - The estimated Debt, which means the effort to fix such issue to make sure that the first namespace doesn't rely anymore on the second one, depends on the number of types and methods used. Because both namespace are now forming a super-component that cannot be partitioned in smaller components, the cost to unfix each issue is proportional to the size of this super-component. As a consequence, the estimated Annual Interest, which means the annual cost to let both namespaces mutually dependend, is equal to an hour plus a number of minutes proportional to the size (in lines of code) of both namespaces. The obtained Annual Interest value is then divided by the number of detailled issues listed. Often the estimated Annual Interest for each listed issue is higher than the Debt, which means that leaving such issue unfixed for a year costs more than taking the time to fix issue once. -- To explore the coupling between the two namespaces mutually dependent: 1) from the becauseNamespace right-click menu choose Copy to Matrix Columns to export this low-level namespace to the horizontal header of the dependency matrix. 2) from the shouldntUseNamespace right-click menu choose Copy to Matrix Rows to export this high-level namespace to the vertical header of the dependency matrix. 3) double-click the black matrix cell (it is black because of the mutual dependency). 4) in the matrix command bar, click the button: Remove empty Row(s) and Column(s). At this point, the dependency matrix shows types involved into the coupling. • Blue cells represent types from low-level namespace using types from high-level namespace • Green cells represent types from high-level namespace using types from low-level namespace • Black cells represent types from low-level and high-level namespaces that use each other. There are more green cells than blue and black cells because green cell represents correct coupling from high-level to low-level. The goal is to eliminate incorrect dependencies represented by blue and black cells.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1400:AvoidNamespacesMutuallyDependent", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

4 members matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

4 types and methods | shouldntUse | becauseNamespace | shouldntUseNamespace | Debt | Annual Interest | Full Name
--- | --- | --- | --- | --- | --- | ---
FlightScheduler | 1 2 types Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightFilterBase | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search | 1 20min | 120min | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler
Search(FlightSearch) | 0 First 5 of 8 methods 8 properties Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch.Depart Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch.get_Depart() Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch.Arrive Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch.get_Arrive() Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch.MinDepart | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search | 0 1h 0min | 220min | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch)
Search(List<FlightFilterBase>) | 3 1 method Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightFilterBase.ShouldInclude (IFlightInfo) | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search | 3 15min | 320min | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>)
IFlightInfo | 2 1 type Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .FlightStatus | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights | 2 15min | 01h 1min | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo

|  | Rule Violated: Avoid namespaces dependency cycles

• Rule Description: This rule lists all application namespace dependency cycles. Each row shows a different cycle, indexed with one of the namespace entangled in the cycle. Read our white books relative to partitioning code, to know more about namespaces dependency cycles, and why avoiding them is a simple yet efficient solution to clean the architecture of a code base. https://www.ndepend.com/docs/white-books

• How to Fix Issues of this Rule: Removing first pairs of mutually dependent namespaces will eliminate most namespaces dependency cycles. This is why it is recommended to focus first on matches of the default rule Avoid namespaces mutually dependent before attempting to fix issues of the present rule. Once all mutually dependent namespaces occurrences are solved, remaining cycles matched by the present rule necessarily involve 3 or more namespaces like in: A is using B is using C is using A. To browse a cycle on the dependency graph or the dependency matrix, right click a cycle cell in the result of the present rule and export the matched namespaces to the dependency graph or matrix. This is illustrated here: https://www.ndepend.com/docs/visual-studio-dependency-graph#Entangled With such a cycle graph visualized, you can determine which dependencies should be discarded to break the cycle. To do so, you need to identify which namespace should be at low-level and which one should be at high-level. In the A is using B is using C is using A cycle example, if A should be at low level then C should be at a higher-level than A. As a consequence C shouldn't use A and this dependency should be removed. To remove a dependency you can refer to patterns described in the HowToFix section of the rule Avoid namespaces mutually dependent. Notice that the dependency matrix can also help visualizing and breaking cycles. In the matrix cycles are represented with red squares and black cells. To easily browse dependency cycles, the dependency matrix comes with an option: Display Direct and Indirect Dependencies. See related documentation here: https://www.ndepend.com/docs/dependency-structure-matrix-dsm#Cycle https://www.ndepend.com/docs/dependency-structure-matrix-dsm#Mutual The estimated Debt, which means the effort to fix such issue, doesn't depend on the cycle length. First because fixing the rule Avoid namespaces mutually dependent will fix most cycle reported here, second because even a long cycle can be broken by removing a single or a few dependencies.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1401:AvoidNamespacesDependencyCycles", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 namespace matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 namespace | cycle | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 0 3 namespaces Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 0 2h 0min | 0High | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling

####

Immutability 11 2 0

2 Rule(s) violated Fields should be marked as ReadOnly when possible Record classes should be immutable

|  | Rule Violated: Fields should be marked as ReadOnly when possible

• Rule Description: This rule warns about instance and static fields that can be declared as readonly. This source code of this rule is based on the conditon IField.IsImmutable. https://www.ndepend.com/api/webframe.html#NDepend.API~NDepend.CodeModel.IField~IsImmutable.html 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 through the lifetime of the object. For a static field, this means its value will remain constant through the lifetime of the program.

• How to Fix Issues of this Rule: Declare the field with the C# readonly keyword (ReadOnly in VB.NET). This way the intention that the field value shouldn't change is made explicit.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1900:FieldsShouldBeMarkedAsReadOnlyWhenPossible", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 field matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 field | MethodsReadingMeButNotAssigningMe | MethodsAssigningMe | Debt | Severity | Full Name
--- | --- | --- | --- | --- | ---
_priorityLaneGroups | 0 3 methods Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor .DisplayBoardingHeader() Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor .BuildMessage(Passenger) Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ..ctor() | 0no method | 0 5min | 0Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ._priorityLaneGroups

|  | Rule Violated: Record classes should be immutable

• Rule Description: The language intention for C#9 record is to make it easy to create classes with value-based semantic. Value-based semantic for a class means 1) Value-based equality and 2) Immutability. These are explained in this article: https://blog.ndepend.com/c9-records-immutable-classes/ However it is still possible to create a mutable state in a record with a property setter that is not declared as init. It is recommended to avoid having mutable states in a record class because this breaks the value-based semantic. For example changing the state of a record object used as a key in a hash table can corrupt the hash table integrity. Also changing the state of a record object can lead to unexpected value-based equality results. In both cases such code-smell ends up provoking bugs that are difficult to spot and difficult to fix.

• How to Fix Issues of this Rule: To fix an issue of this rule you must make sure that the matched record becomes immutable. To do so mutable property setters (culpritSetters in the result) of the setter must be transformed in property initializers with the init C# keyword. Callers of the mutable property setters (methodsCallingCulpritSetters in the result) must be also refactored to avoid changing the record states. The estimated Debt, which means the effort to fix such issue, is equal to 8 minutes plus 3 minutes per mutable property setter and per method calling such mutable property setter.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1913:RecordClassesShouldBeImmutable", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 type matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 type | culpritSetters | methodsCallingCulpritSetters | Debt | Severity | Full Name
--- | --- | --- | --- | --- | ---
AirportEvent | 0 1 method Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent .set_Time(DateTime) | 0 3 methods Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker .MarkFlightDelayed(String,DateTime ) Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker .MarkFlightDeparted(String ,DateTime) Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker .MarkFlightArrived(String,DateTime ) | 0 26min | 0High | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent

####

Naming Conventions 19 2 0

2 Rule(s) violated Avoid prefixing type name with parent namespace name Avoid naming types and namespaces with the same identifier

|  | Rule Violated: Avoid prefixing type name with parent namespace name

• Rule Description: This rule warns about situations where the parent namespace name is used as the prefix of a contained type. For example a type named "RuntimeEnvironment" declared in a namespace named "Foo.Runtime" should be named "Environment". Such situation creates naming redundancy with no readability gain.

• How to Fix Issues of this Rule: To fix a violation of this rule, remove the prefix from the type name.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND2013:AvoidPrefixingTypeNameWithParentNamespaceName", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

5 types matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

5 types | namespaceName | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Flight | Flight | 1 10min | 1Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Flight
FlightTracker | Flight | 0 10min | 0Medium | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker
BoardingProcessor | Boarding | 2 10min | 2Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor
BoardingStatus | Boarding | 4 10min | 4Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus
BaggageCalculator | Baggage | 3 10min | 3Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator

|  | Rule Violated: Avoid naming types and namespaces with the same identifier

• Rule Description: This rule warns when a type and a namespace have the same name. For example when a type is named Environment and a namespace is named Foo.Environment. Such situation provokes tedious compiler resolution collision, and makes the code less readable because concepts are not concisely identified.

• How to Fix Issues of this Rule: To fix a violation of this rule, renamed the concerned type or namespace.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND2014:AvoidNamingTypesAndNamespacesWithTheSameIdentifier", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 type matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 type | namespaces | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Flight | 0 1 namespace Packt.CloudySkiesAir.Chapter12 .Flight | 0 12min | 0High | Packt.CloudySkiesAir.Chapter12 .Flight.Flight

#### Hot Spots

7 Queries Types Hot Spots Types to Fix Priority Issues to Fix Priority Debt and Issues per Rule New Debt and Issues per Rule Debt and Issues per Code Element New Debt and Issues per Code Element

|  | Code Query: Types Hot Spots

• Query Description: This query lists types with most Debt, or in other words, types with issues that would need the largest effort to get fixed. Both issues on the type and its members are taken account. Since untested code often generates a lot of Debt, the type size and percentage coverage is shown (just uncomment t.PercentageCoverage in the query source code once you've imported the coverage data). The Debt Rating and Debt Ratio are also shown for informational purpose. -- The amount of Debt is not a measure to prioritize the effort to fix issues, it is an estimation of how far the team is from clean code that abides by the rules set. For each issue the Annual Interest estimates the annual cost to leave the issues unfixed. The Severity of an issue is estimated through thresholds from the Annual Interest. The Debt Breaking Point represents the duration from now when the estimated cost to leave the issue unfixed costs as much as the estimated effort to fix it. Hence the shorter the Debt Breaking Point the largest the Return on Investment for fixing the issue. The Breaking Point is the right metric to prioritize issues fix.

###

15 types matched

15 types | Debt | Issues | Annual Interest | Breaking Point | # lines of code (LOC) | DebtRating | DebtRatio | Full Name
--- | --- | --- | --- | --- | --- | --- | --- | ---
FlightScheduler | 00 1h 39min | 01 5 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid methods potentially poorly commented' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>) violates rule 'Avoid namespaces mutually dependent' | 00 1h 19min | 05 1y 91d | 01 34 | 02D | 01 27.45 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler
AirportEvent | 01 26min | 07 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent violates rule 'Record classes should be immutable' | 03 20min | 04 1y 109d | 11 6 | 04C | 04 10.75 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent
Flight | 02 25min | 00 5 issues Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'A stateless class or structure might be turned into a static type' Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Avoid naming types and namespaces with the same identifier' Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String) violates rule 'Methods should be declared static if possible' | 02 26min | 12 357d | 12 1 | 00E | 00 73.78 | Packt.CloudySkiesAir.Chapter12 .Flight.Flight
BoardingProcessor | 03 17min | 02 3 issues Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ._priorityLaneGroups violates rule 'Fields should be marked as ReadOnly when possible' | 05 6min | 03 2y 304d | 00 41 | 07A | 06 3.58 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor
IFlightInfo | 04 15min | 05 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo} violates rule 'Avoid namespaces mutually dependent' | 01 1h 1min | 14 88d | 14N/A | 03C | 03 14.47 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo
FlightTracker | 06 12min | 03 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker violates rule 'Avoid prefixing type name with parent namespace name' | 07 4min 0s | 01 3y | 03 26 | 05A | 05 3.97 | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker
BaggageCalculator | 05 12min | 04 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator violates rule 'Avoid prefixing type name with parent namespace name' | 06 4min 0s | 02 3y | 02 27 | 08A | 07 3.56 | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator
BoardingStatus | 07 10min | 06 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus} violates rule 'Avoid prefixing type name with parent namespace name' | 08 2min 0s | 00 5y | 13N/A | 01D | 02 23.15 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus
CharterFlightInfo | 08 5min | 13 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor() violates rule 'Don't use obsolete types, methods or fields' | 04 20min | 13 91d | 07 11 | 13A | 08 3.4 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo
Passenger | 12 2min 0s | 14 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger violates rule 'Non-static classes should be instantiated or turned to static' | 13 2min 0s | 10 1y | 05 14 | 14A | 13 0.54 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger
Airport | 13 2min 0s | 11 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport violates rule 'Non-static classes should be instantiated or turned to static' | 14 2min 0s | 11 1y | 06 13 | 09A | 12 0.77 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport
AirportFilter | 14 2min 0s | 08 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter violates rule 'Non-static classes should be instantiated or turned to static' | 09 2min 0s | 06 1y | 10 7 | 10A | 09 1.29 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter
FlightDurationFilter | 09 2min 0s | 09 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter violates rule 'Non-static classes should be instantiated or turned to static' | 10 2min 0s | 08 1y | 08 9 | 11A | 10 1.16 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter
FlightSearch | 10 2min 0s | 10 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch violates rule 'Non-static classes should be instantiated or turned to static' | 11 2min 0s | 07 1y | 04 16 | 12A | 14 0.46 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch
FlightTimeFilter | 11 2min 0s | 12 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter violates rule 'Non-static classes should be instantiated or turned to static' | 12 2min 0s | 09 1y | 09 8 | 06A | 11 1.01 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter

|  | Code Query: Types to Fix Priority

• Query Description: This query lists types per increasing Debt Breaking Point. For each issue the Debt estimates the effort to fix the issue, and the Annual Interest estimates the annual cost to leave the issue unfixed. The Severity of an issue is estimated through thresholds from the Annual Interest of the issue. The Debt Breaking Point represents the duration from now when the estimated cost to leave the issue unfixed costs as much as the estimated effort to fix it. Hence the shorter the Debt Breaking Point the largest the Return on Investment for fixing the issues. Often new and refactored types since baseline will be listed first, because issues on these types get a higher Annual Interest because it is important to focus first on new issues. -- Both issues on the type and its members are taken account. Only types with at least 30 minutes of Debt are listed to avoid polluting the list with the numerous types with small Debt, on which the Breaking Point value makes less sense. The Annual Interest estimates the cost per year in man-days to leave these issues unfixed. Since untested code often generates a lot of Debt, the type size and percentage coverage is shown (just uncomment t.PercentageCoverage in the query source code once you've imported the coverage data). The Debt Rating and Debt Ratio are also shown for informational purpose.

###

1 type matched

1 type | Breaking Point | Debt | Annual Interest | Issues | # lines of code (LOC) | DebtRating | DebtRatio | Full Name
--- | --- | --- | --- | --- | --- | --- | --- | ---
FlightScheduler | 0 1y 91d | 0 1h 39min | 0 1h 19min | 0 5 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid methods potentially poorly commented' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>) violates rule 'Avoid namespaces mutually dependent' | 0 34 | 0D | 0 27.45 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler

|  | Code Query: Issues to Fix Priority

• Query Description: This query lists issues per increasing Debt Breaking Point. Double-click an issue to edit its rule and select the issue in the rule result. This way you can view all information concerning the issue. For each issue the Debt estimates the effort to fix the issue, and the Annual Interest estimates the annual cost to leave the issue unfixed. The Severity of an issue is estimated through thresholds from the Annual Interest of the issue. The Debt Breaking Point represents the duration from now when the estimated cost to leave the issue unfixed costs as much as the estimated effort to fix it. Hence the shorter the Debt Breaking Point the largest the Return on Investment for fixing the issue. Often issues on new and refactored code elements since baseline will be listed first, because such issues get a higher Annual Interest because it is important to focus first on new issues on recent code. More documentation: https://www.ndepend.com/docs/technical-debt

###

33 issues matched

33 issues | Debt | Annual Interest | Breaking Point | CodeElement | Full Name
--- | --- | --- | --- | --- | ---
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Scheduling.FlightScheduler .Search(FlightSearch) | 19 2min 36s | 0816min | 26 59d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) | Rule violated: Avoid methods potentially poorly commented
{I:Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo} | 04 15min | 001h 1min | 25 88d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo | Rule violated: Avoid namespaces mutually dependent
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Flight.BuildMessage(String ,String) | 32 0min 30s | 142min 0s | 23 91d | Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String) | Rule violated: Methods should be declared static if possible
High issue on: Packt .CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor() | 15 5min | 0620min | 24 91d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor() | Rule violated: Don't use obsolete types, methods or fields
High issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Flight | 06 12min | 0720min | 22 219d | Packt.CloudySkiesAir.Chapter12 .Flight.Flight | Rule violated: Avoid naming types and namespaces with the same identifier
High issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Scheduling.FlightScheduler .Search(List<FlightFilterBase>) | 05 15min | 0220min | 21 266d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>) | Rule violated: Avoid namespaces mutually dependent
High issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Scheduling.FlightScheduler | 03 20min | 0120min | 20 355d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler | Rule violated: Avoid namespaces mutually dependent
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Flight | 21 2min 0s | 132min 0s | 12 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Flight | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker | 28 2min 0s | 152min 0s | 15 1y | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Boarding.BoardingProcessor | 29 2min 0s | 172min 0s | 16 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger | 30 2min 0s | 162min 0s | 13 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Baggage.BaggageCalculator | 25 2min 0s | 092min 0s | 14 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport | 26 2min 0s | 102min 0s | 09 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Scheduling.FlightScheduler | 27 2min 0s | 112min 0s | 11 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter | 20 2min 0s | 122min 0s | 10 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter | 22 2min 0s | 242min 0s | 17 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch | 23 2min 0s | 232min 0s | 19 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch | Rule violated: Non-static classes should be instantiated or turned to static
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter | 24 2min 0s | 262min 0s | 18 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter | Rule violated: Non-static classes should be instantiated or turned to static
High issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent | 02 26min | 0520min | 08 1y 109d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent | Rule violated: Record classes should be immutable
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Boarding.BoardingProcessor ._priorityLaneGroups | 17 5min | 252min 0s | 07 2y 182d | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ._priorityLaneGroups | Rule violated: Fields should be marked as ReadOnly when possible
High issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Scheduling.FlightScheduler .Search(FlightSearch) | 01 1h 0min | 0320min | 06 2y 337d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) | Rule violated: Avoid namespaces mutually dependent
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Flight | 08 10min | 222min 0s | 05 5y | Packt.CloudySkiesAir.Chapter12 .Flight.Flight | Rule violated: Avoid prefixing type name with parent namespace name
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker | 07 10min | 192min 0s | 03 5y | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker | Rule violated: Avoid prefixing type name with parent namespace name
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Boarding.BoardingProcessor | 09 10min | 182min 0s | 01 5y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor | Rule violated: Avoid prefixing type name with parent namespace name
{E:Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus} | 11 10min | 212min 0s | 04 5y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus | Rule violated: Avoid prefixing type name with parent namespace name
Medium issue on: Packt.CloudySkiesAir.Chapter12 .Flight .Baggage.BaggageCalculator | 10 10min | 202min 0s | 02 5y | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator | Rule violated: Avoid prefixing type name with parent namespace name
High issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 00 2h 0min | 0420min | 00 6y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | Rule violated: Avoid namespaces dependency cycles
Low issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Flight | 31 1min 0s | 300min 0s | 30 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight.Flight | Rule violated: A stateless class or structure might be turned into a static type
Low issue on: Packt .CloudySkiesAir.Chapter12 | 16 5min | 310min 0s | 31 00:00:00 | Packt.CloudySkiesAir.Chapter12 | Rule violated: Avoid namespaces with few types
Low issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Baggage | 18 5min | 320min 0s | 32 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage | Rule violated: Avoid namespaces with few types
Low issue on: Packt.CloudySkiesAir.Chapter12 .Flight | 12 5min | 270min 0s | 27 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight | Rule violated: Avoid namespaces with few types
Low issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Boarding | 13 5min | 280min 0s | 28 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding | Rule violated: Avoid namespaces with few types
Low issue on: Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 14 5min | 290min 0s | 29 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | Rule violated: Avoid namespaces with few types

|  | Code Query: Debt and Issues per Rule

• Query Description: This query lists violated rules with most Debt first. A rule violated has issues. For each issue the Debt estimates the effort to fix the issue. -- The amount of Debt is not a measure to prioritize the effort to fix issues, it is an estimation of how far the team is from clean code that abides by the rules set. For each issue the Annual Interest estimates the annual cost to leave the issues unfixed. The Severity of an issue is estimated through thresholds from the Annual Interest. The Debt Breaking Point represents the duration from now when the estimated cost to leave the issue unfixed costs as much as the estimated effort to fix it. Hence the shorter the Debt Breaking Point the largest the Return on Investment for fixing the issue. The Breaking Point is the right metric to prioritize issues fix. -- Notice that rules can be grouped in Rule Category. This way you'll see categories that generate most Debt. Typically the rules that generate most Debt are the ones related to Code Coverage by Tests, Architecture and Code Smells. More documentation: https://www.ndepend.com/docs/technical-debt

###

12 rules matched

12 rules | Issues | Debt | Annual Interest | Breaking Point | Category | Full Name
--- | --- | --- | --- | --- | --- | ---
Avoid namespaces dependency cycles | 04 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling violates rule 'Avoid namespaces dependency cycles' | 00 2h 0min | 03 20min | 00 6y | Project Rules \ Architecture | Rule
Avoid namespaces mutually dependent | 03 4 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>) violates rule 'Avoid namespaces mutually dependent' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo} violates rule 'Avoid namespaces mutually dependent' | 01 1h 50min | 00 2h 3min | 05 326d | Project Rules \ Architecture | Rule
Avoid prefixing type name with parent namespace name | 01 5 issues Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus} violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator violates rule 'Avoid prefixing type name with parent namespace name' | 02 50min | 07 10min | 01 5y | Project Rules \ Naming Conventions | Rule
Record classes should be immutable | 05 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent violates rule 'Record classes should be immutable' | 03 26min | 04 20min | 03 1y 109d | Project Rules \ Immutability | Rule
Avoid namespaces with few types | 02 5 issues Packt.CloudySkiesAir.Chapter12 violates rule 'Avoid namespaces with few types' Packt.CloudySkiesAir.Chapter12 .Flight.Baggage violates rule 'Avoid namespaces with few types' Packt.CloudySkiesAir.Chapter12 .Flight violates rule 'Avoid namespaces with few types' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding violates rule 'Avoid namespaces with few types' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling violates rule 'Avoid namespaces with few types' | 04 25min | 10 0min 0s | 10 00:00:00 | Project Rules \ Design | Rule
Non-static classes should be instantiated or turned to static | 00 First 5 of 11 issues Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator violates rule 'Non-static classes should be instantiated or turned to static' | 05 22min | 01 22min | 04 1y | Project Rules \ Object Oriented Design | Rule
Avoid naming types and namespaces with the same identifier | 10 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Avoid naming types and namespaces with the same identifier' | 06 12min | 02 20min | 06 219d | Project Rules \ Naming Conventions | Rule
Don't use obsolete types, methods or fields | 11 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor() violates rule 'Don't use obsolete types, methods or fields' | 08 5min | 05 20min | 08 91d | Project Rules \ Design | Rule
Fields should be marked as ReadOnly when possible | 09 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ._priorityLaneGroups violates rule 'Fields should be marked as ReadOnly when possible' | 07 5min | 09 2min 0s | 02 2y 182d | Project Rules \ Immutability | Rule
Avoid methods potentially poorly commented | 07 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid methods potentially poorly commented' | 09 2min 36s | 06 16min | 09 59d | Project Rules \ Code Smells | Rule
A stateless class or structure might be turned into a static type | 08 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'A stateless class or structure might be turned into a static type' | 10 1min 0s | 11 0min 0s | 11 00:00:00 | Project Rules \ Object Oriented Design | Rule
Methods should be declared static if possible | 06 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String) violates rule 'Methods should be declared static if possible' | 11 0min 30s | 08 2min 0s | 07 91d | Project Rules \ Object Oriented Design | Rule

|  | Code Query: New Debt and Issues per Rule

• Query Description: This query lists violated rules that have new issues since baseline, with most new Debt first. A rule violated has issues. For each issue the Debt estimates the effort to fix the issue. -- New issues since the baseline are consequence of recent code refactoring sessions. They represent good opportunities of fix because the code recently refactored is fresh in the developers mind, which means fixing now costs less than fixing later. Fixing issues on recently touched code is also a good way to foster practices that will lead to higher code quality and maintainability, including writing unit-tests and avoiding unnecessary complex code. -- Notice that rules can be grouped in Rule Category. This way you'll see categories that generate most Debt. Typically the rules that generate most Debt are the ones related to Code Coverage by Tests, Architecture and Code Smells. More documentation: https://www.ndepend.com/docs/technical-debt

###

No rule matched

|  | Code Query: Debt and Issues per Code Element

• Query Description: This query lists code elements that have issues, with most Debt first. For each code element the Debt estimates the effort to fix the element issues. The amount of Debt is not a measure to prioritize the effort to fix issues, it is an estimation of how far the team is from clean code that abides by the rules set. For each element the Annual Interest estimates the annual cost to leave the elements issues unfixed. The Severity of an issue is estimated through thresholds from the Annual Interest of the issue. The Debt Breaking Point represents the duration from now when the estimated cost to leave the issues unfixed costs as much as the estimated effort to fix it. Hence the shorter the Debt Breaking Point the largest the Return on Investment for fixing the issue. The Breaking Point is the right metric to prioritize issues fix.

###

24 code elements matched

24 code elements | Issues | Debt | Annual Interest | Breaking Point | Full Name
--- | --- | --- | --- | --- | ---
Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling | 04 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling violates rule 'Avoid namespaces with few types' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling violates rule 'Avoid namespaces dependency cycles' | 00 2h 5min | 06 20min | 00 6y 91d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling
Search(FlightSearch) | 05 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid methods potentially poorly commented' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch) violates rule 'Avoid namespaces mutually dependent' | 01 1h 2min | 01 36min | 06 1y 260d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(FlightSearch)
AirportEvent | 08 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent violates rule 'Record classes should be immutable' | 02 26min | 07 20min | 07 1y 109d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.AirportEvent
Flight | 00 4 issues Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'A stateless class or structure might be turned into a static type' Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Avoid prefixing type name with parent namespace name' Packt.CloudySkiesAir.Chapter12 .Flight.Flight violates rule 'Avoid naming types and namespaces with the same identifier' | 03 25min | 02 24min | 08 1y 15d | Packt.CloudySkiesAir.Chapter12 .Flight.Flight
FlightScheduler | 01 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler violates rule 'Avoid namespaces mutually dependent' | 04 22min | 03 22min | 15 356d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler
Search(List<FlightFilterBase>) | 11 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>) violates rule 'Avoid namespaces mutually dependent' | 06 15min | 04 20min | 16 266d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler .Search(List<FlightFilterBase>)
IFlightInfo | 10 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo} violates rule 'Avoid namespaces mutually dependent' | 05 15min | 00 1h 1min | 19 88d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.IFlightInfo
FlightTracker | 03 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker violates rule 'Avoid prefixing type name with parent namespace name' | 09 12min | 10 4min 0s | 02 3y | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker
BoardingProcessor | 02 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor violates rule 'Avoid prefixing type name with parent namespace name' | 08 12min | 09 4min 0s | 03 3y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor
BaggageCalculator | 06 2 issues Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator violates rule 'Non-static classes should be instantiated or turned to static' Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator violates rule 'Avoid prefixing type name with parent namespace name' | 07 12min | 08 4min 0s | 04 3y | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator
BoardingStatus | 07 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus} violates rule 'Avoid prefixing type name with parent namespace name' | 10 10min | 11 2min 0s | 01 5y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingStatus
Packt.CloudySkiesAir.Chapter12 | 09 1 issue Packt.CloudySkiesAir.Chapter12 violates rule 'Avoid namespaces with few types' | 11 5min | 20 0min 0s | 20 00:00:00 | Packt.CloudySkiesAir.Chapter12
Packt.CloudySkiesAir.Chapter12 .Flight | 20 1 issue Packt.CloudySkiesAir.Chapter12 .Flight violates rule 'Avoid namespaces with few types' | 15 5min | 23 0min 0s | 22 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight
Packt.CloudySkiesAir.Chapter12 .Flight.Boarding | 19 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding violates rule 'Avoid namespaces with few types' | 16 5min | 21 0min 0s | 23 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding
_priorityLaneGroups | 21 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ._priorityLaneGroups violates rule 'Fields should be marked as ReadOnly when possible' | 14 5min | 18 2min 0s | 05 2y 182d | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor ._priorityLaneGroups
Packt.CloudySkiesAir.Chapter12 .Flight.Baggage | 23 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Baggage violates rule 'Avoid namespaces with few types' | 12 5min | 22 0min 0s | 21 00:00:00 | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage
.ctor() | 22 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor() violates rule 'Don't use obsolete types, methods or fields' | 13 5min | 05 20min | 18 91d | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Flights .CharterFlightInfo..ctor()
Passenger | 18 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger violates rule 'Non-static classes should be instantiated or turned to static' | 20 2min 0s | 14 2min 0s | 12 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger
Airport | 14 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport violates rule 'Non-static classes should be instantiated or turned to static' | 21 2min 0s | 17 2min 0s | 13 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport
AirportFilter | 13 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter violates rule 'Non-static classes should be instantiated or turned to static' | 22 2min 0s | 16 2min 0s | 14 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter
FlightDurationFilter | 15 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter violates rule 'Non-static classes should be instantiated or turned to static' | 17 2min 0s | 15 2min 0s | 09 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter
FlightSearch | 17 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch violates rule 'Non-static classes should be instantiated or turned to static' | 18 2min 0s | 13 2min 0s | 11 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch
FlightTimeFilter | 16 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter violates rule 'Non-static classes should be instantiated or turned to static' | 19 2min 0s | 19 2min 0s | 10 1y | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter
BuildMessage(String,String) | 12 1 issue Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String) violates rule 'Methods should be declared static if possible' | 23 0min 30s | 12 2min 0s | 17 91d | Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String)

|  | Code Query: New Debt and Issues per Code Element

• Query Description: This query lists code elements that have new issues since baseline, with most new Debt first. For each code element the Debt estimates the effort to fix the element issues. New issues since the baseline are consequence of recent code refactoring sessions. They represent good opportunities of fix because the code recently refactored is fresh in the developers mind, which means fixing now costs less than fixing later. Fixing issues on recently touched code is also a good way to foster practices that will lead to higher code quality and maintainability, including writing unit-tests and avoiding unnecessary complex code.

###

No code element matched

#### Object Oriented Design

3 Rule(s) violated A stateless class or structure might be turned into a static type Non-static classes should be instantiated or turned to static Methods should be declared static if possible 11 validated Rule(s) Avoid interfaces too big Base class should not use derivatives Class shouldn't be too deep in inheritance tree Class with no descendant should be sealed if possible Overrides of Method() should call base.Method() Do not hide base class methods Constructor should not call a virtual method Avoid the Singleton pattern Don't assign static fields from instance methods Avoid empty interfaces Avoid types initialization cycles

|  | Validated Rule: Avoid interfaces too big

• Rule Description: This rule matches interfaces with more than 10 methods, properties or events. Interfaces are abstractions and are meant to simplify the code structure. An interface should represent a single responsibility. Making an interface too large, too complex, necessarily means that the interface has too many responsibilities. A property with a getter or setter or both count as one member. An event count as one member.

• How to Fix Issues of this Rule: Typically to fix such issue, the interface must be refactored in a grape of smaller single-responsibility interfaces. A classic example is a ISession large interface, responsible for holding states, run commands and offer various accesses and facilities. The classic problem for a large public interface is that it has many clients that consume it. As a consequence splitting it in smaller interfaces has an important impact and it is not always feasible. The estimated Debt, which means the effort to fix such issue, varies linearly from 20 minutes for an interface with 10 methods, up to 7 hours for an interface with 100 or more methods. The Debt is divided by two if the interface is not publicly visible, because in such situation only the current project is impacted by the refactoring.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1200:AvoidInterfacesTooBig", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Base class should not use derivatives

• Rule Description: In Object-Oriented Programming, the open/closed principle states: software entities (components, classes, methods, etc.) should be open for extension, but closed for modification. http://en.wikipedia.org/wiki/Open/closed_principle Hence a base class should be designed properly to make it easy to derive from, this is extension. But creating a new derived class, or modifying an existing one, shouldn't provoke any modification in the base class. And if a base class is using some derivative classes somehow, there are good chances that such modification will be needed. Extending the base class is not anymore a simple operation, this is not good design. Note that this rule doesn't warn when a base class is using a derived class that is nested in the base class and declared as private. In such situation we consider that the derived class is an encapsulated implementation detail of the base class.

• How to Fix Issues of this Rule: Understand the need for using derivatives, then imagine a new design, and then refactor. Typically an algorithm in the base class needs to access something from derived classes. You can try to encapsulate this access behind an abstract or a virtual method. If you see in the base class some conditions on typeof(DerivedClass) not only urgent refactoring is needed. Such condition can easily be replaced through an abstract or a virtual method. Sometime you'll see a base class that creates instance of some derived classes. In such situation, certainly using the factory method pattern http://en.wikipedia.org/wiki/Factory_method_pattern or the abstract factory pattern http://en.wikipedia.org/wiki/Abstract_factory_pattern will improve the design. The estimated Debt, which means the effort to fix such issue, is equal to 3 minutes per derived class used by the base class + 3 minutes per member of a derived class used by the base class.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1201:BaseClassShouldNotUseDerivatives", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Class shouldn't be too deep in inheritance tree

• Rule Description: This rule warns about classes having 3 or more base classes. Notice that third-party base classes are not counted because this rule is about your code design, not third-party libraries consumed design. In theory, there is nothing wrong having a long inheritance chain, if the modeling has been well thought out, if each base class is a well-designed refinement of the domain. In practice, modeling properly a domain demands a lot of effort and experience and more often than not, a long inheritance chain is a sign of confused design, that will be hard to work with and maintain.

• How to Fix Issues of this Rule: In Object-Oriented Programming, a well-known motto is Favor Composition over Inheritance. This is because inheritance comes with pitfalls. In general, the implementation of a derived class is very bound up with the base class implementation. Also a base class exposes implementation details to its derived classes, that's why it's often said that inheritance breaks encapsulation. On the other hands, Composition favors binding with interfaces over binding with implementations. Hence, not only the encapsulation is preserved, but the design is clearer, because interfaces make it explicit and less coupled. Hence, to break a long inheritance chain, Composition is often a powerful way to enhance the design of the refactored underlying logic. You can also read: http://en.wikipedia.org/wiki/Composition_over_inheritance and http://stackoverflow.com/questions/49002/prefer-composition-over-inheritance The estimated Debt, which means the effort to fix such issue, depends linearly upon the depth of inheritance.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1202:ClassShouldntBeTooDeepInInheritanceTree", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Class with no descendant should be sealed if possible

• Rule Description: If a non-static class isn't declared with the keyword sealed, it means that it can be subclassed everywhere the non-sealed class is visible. Making a class a base class requires significant design effort. Subclassing a non-sealed class, not initially designed to be subclassed, will lead to unanticipated design issue. Most classes are non-sealed because developers don't care about the keyword sealed, not because the primary intention was to write a class that can be subclassed. There are performance gain in declaring a class as sealed. See a benchmark here: https://www.meziantou.net/performance-benefits-of-sealed-class.htm But the real benefit of doing so, is actually to express the intention: this class has not be designed to be a base class, hence it is not allowed to subclass it. Notice that by default this rule doesn't match public class to avoid matching classes that are intended to be sub-classed by third-party code using your library. If you are developing an application and not a library, just uncomment the clause !t.IsPubliclyVisible.

• How to Fix Issues of this Rule: For each matched class, take the time to assess if it is really meant to be subclassed. Certainly most matched class will end up being declared as sealed.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1203:ClassWithNoDescendantShouldBeSealedIfPossible", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Overrides of Method() should call base.Method()

• Rule Description: Typically overrides of a base method, should refine or complete the behavior of the base method. If the 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 actual design provides valid reasons that advocates that the base behavior must be replaced and not refined.

• How to Fix Issues of this Rule: You should investigate if inheritance is the right choice to bind the base class implementation with the derived classes implementations. Does presenting the method with polymorphic behavior through an interface, would be a better design choice? In such situation, often using the design pattern template method http://en.wikipedia.org/wiki/Template_method_pattern might help improving the design.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1204:OverridesOfMethodShouldCallBaseMethod", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

|  | Validated Rule: Do not hide base class methods

• Rule Description: Method hiding is when a base class has a non-virtual method M(), and a derived class has also a method M() with the same signature. In such situation, calling base.M() does something different than calling derived.M(). Notice that this is not polymorphic behavior. With polymorphic behavior, calling both base.M() and derived.M() on an instance object of derived, invoke the same implementation. This situation should be avoided because it obviously leads to confusion. This rule warns about all method hiding cases in the code base.

• How to Fix Issues of this Rule: 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. However method hiding is for those times when you need to have two things to have the same name but different behavior. This is a very rare situations, described here: http://blogs.msdn.com/b/ericlippert/archive/2008/05/21/method-hiding-apologia.aspx

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1205:DoNotHideBaseClassMethods", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

|  | Rule Violated: A stateless class or structure might be turned into a static type

• Rule Description: This rule matches classes and structures that are not static, nor generic, that doesn't have any instance fields, that doesn't implement any interface nor has a base class (different than System.Object). Such class or structure is a stateless collection of pure functions, that doesn't act on any this object data. Such collection of pure functions is better hosted in a static class. Doing so simplifies the client code that doesn't have to create an object anymore to invoke the pure functions.

• How to Fix Issues of this Rule: Declare all methods as static and transform the class or structure into a static class. By default issues of this rule have a Low severity because they reflect more an advice than a problem.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1206:AStatelessClassOrStructureMightBeTurnedIntoAStaticType", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 type matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 type | methodsUsingMe | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Flight | 0no method | 0 1min 0s | 0Low | Packt.CloudySkiesAir.Chapter12 .Flight.Flight

|  | Rule Violated: Non-static classes should be instantiated or turned to static

• Rule Description: If the constructors of a class are never called, the class is never instantiated, and should be defined as a static class. However this rule doesn't match instantiation through reflection. As a consequence, plug-in root classes, instantiated through reflection via IoC frameworks, can be false positives for this rule. This rule doesn't match also classes instantiated by the ASP.NET infrastructure, ASP.NET view model classes and Entity Framework ModelSnapshot, DbContext and Migration classes. Notice that by default this rule matches also public class. If you are developing a framework with classes that are intended to be instantiated by your clients, just uncomment the line !t.IsPublic.

• How to Fix Issues of this Rule: First it is important to investigate why the class is never instantiated. If the reason is the class hosts only static methods then the class can be safely declared as static. Others reasons like, the class is meant to be instantiated via reflection, or is meant to be instantiated only by client code should lead to adapt this rule code to avoid these matches.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1207:NonStaticClassesShouldBeInstantiatedOrTurnedToStatic", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

11 types matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

11 types | Visibility | Debt | Severity | Full Name
--- | --- | --- | --- | ---
Flight | 03Public | 03 2min 0s | 03Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Flight
FlightTracker | 04Public | 04 2min 0s | 04Medium | Packt.CloudySkiesAir.Chapter12 .Flight.FlightTracker
BoardingProcessor | 02Public | 02 2min 0s | 02Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.BoardingProcessor
Passenger | 00Public | 00 2min 0s | 00Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Boarding.Passenger
BaggageCalculator | 01Public | 01 2min 0s | 01Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Baggage.BaggageCalculator
Airport | 05Public | 05 2min 0s | 05Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Airport
FlightScheduler | 09Public | 09 2min 0s | 09Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.FlightScheduler
AirportFilter | 10Public | 10 2min 0s | 10Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .AirportFilter
FlightDurationFilter | 08Public | 08 2min 0s | 08Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightDurationFilter
FlightSearch | 06Public | 06 2min 0s | 06Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightSearch
FlightTimeFilter | 07Public | 07 2min 0s | 07Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Scheduling.Search .FlightTimeFilter

|  | Rule Violated: Methods should be declared static if possible

• Rule Description: When an instance method can be safely declared as static you should declare it as static. Whenever you write a method, you fulfill a contract in a given scope. The narrower the scope is, the smaller the chance is that you write a bug. When a method is static, you can't access non-static members; hence, your scope is narrower. So, if you don't need and will never need (even in subclasses) instance fields to fulfill your contract, why give access to these fields to your method? Declaring the method static in this case will let the compiler check that you don't use members that you do not intend to use. Declaring a method as static if possible is also good practice because clients can tell from the method signature that calling the method can't alter the object's state. Doing so, is also a micro performance optimization, since a static method is a bit cheaper to invoke than an instance method, because the this reference* doesn't need anymore to be passed. Notice that if a matched method is a handler, bound to an event through code generated by a designer, declaring it as static might break the designer generated code, if the generated code use the this invocation syntax, (like this.Method()).

• How to Fix Issues of this Rule: Declare matched methods as static. Since such method doesn't use any instance fields and methods of its type and base-types, you should consider if it makes sense, to move such a method to a static utility class.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1208:MethodsShouldBeDeclaredStaticIfPossible", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

1 method matched

- Formatting: bold means added, underlined means code was changed, strike-bold means removed (since baseline)

1 method | staticFieldsUsed | methodsCallingMe | Debt | Severity | Full Name
--- | --- | --- | --- | --- | ---
BuildMessage(String,String) | 0no field | 0no method | 0 0min 30s | 0Medium | Packt.CloudySkiesAir.Chapter12 .Flight.Flight.BuildMessage(String ,String)

|  | Validated Rule: Constructor should not call a virtual method

• Rule Description: This rule matches constructors of a non-sealed class that call one or several virtual methods. When an object written in C# is constructed, what happens is that constructors run in order from the base class to the most derived class. Also objects do not change type as they are constructed, but start out as the most derived type, with the method table being for the most derived type. This means that virtual method calls always run on the most derived type, even when calls are made from the constructor. When you combine these two facts you are left with the problem that if you make a virtual method call in a constructor, and it is not the most derived type in its inheritance hierarchy, then it will be called on a class whose constructor has not been run, and therefore may not be in a suitable state to have that method called. Hence this situation makes the class fragile to derive from.

• How to Fix Issues of this Rule: Violations reported can be solved by re-designing object initialisation or by declaring the parent class as sealed, if possible.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1209:ConstructorShouldNotCallAVirtualMethod", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

|  | Validated Rule: Avoid the Singleton pattern

• Rule Description: The singleton pattern consists in enforcing that a class has just a single instance: http://en.wikipedia.org/wiki/Singleton_pattern At first glance, this pattern looks appealing, it is simple to implement, it addresses a common situation, and as a consequence it is widely used. However, we discourage you from using singleton classes because experience shows that singleton often results in less testable and less maintainable code. Singleton is by-design, not testable. Each unit test should use their own objects while singleton forces multiple unit-tests to use the same instance object. Also the singleton static GetInstance() method allows magic access to that single object and its state from wherever developers want! This potentially attractive facility unfortunately ends up into unorganized/messy code that will require effort to be refactored. Notice that this rule matches only singleton types with mutable instance fields because singleton pitfalls result from anarchical access and modification of instance data. More details available in these discussions: https://blog.ndepend.com/the-proper-usages-of-the-keyword-static-in-c/ http://adamschepis.com/blog/2011/05/02/im-adam-and-im-a-recovering-singleton-addict/

• How to Fix Issues of this Rule: This rule matches the classic syntax of singletons, where one static field hold the single instance of the parent class. We underline that the problem is this particular syntax, that plays against testability. The problem is not the fact that a single instance of the class lives at runtime. Hence to fix matches fo this rule, creates the single instance at the startup of the program, and pass it to all classes and methods that need to access it. If multiple singletons are identified, they actually form together a program execution context. Such context can be unified in a unique singleton context. Doing so will make it easier to propagate the context across the various program units. The estimated Debt, which means the effort to fix such issue, is equal to 3 minutes per method relying on the singleton. It is not rare that hundreds of methods rely on the singleton and that it takes hours to get rid of a singleton, refactoring the way just explained above. The severity of each singleton issue is Critical because as explained, using a the singleton pattern can really prevent the whole program to be testable.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1210:AvoidTheSingletonPattern", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Don't assign static fields from instance methods

• Rule Description: Assigning static fields from instance methods leads to poorly maintainable and non-thread-safe code. More discussion on the topic can be found here: https://blog.ndepend.com/the-proper-usages-of-the-keyword-static-in-c/

• How to Fix Issues of this Rule: If the static field is just assigned once in the program lifetime, make sure to declare it as readonly and assign it inline, or from the static constructor. In Object-Oriented-Programming the natural artifact to hold states that can be modified is instance fields. Hence to fix violations of this rule, make sure to hold assignable states through instance fields, not through static fields.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1211:DontAssignStaticFieldsFromInstanceMethods", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No field matched

|  | Validated Rule: Avoid empty interfaces

• Rule Description: Interfaces define members that provide a behavior or usage contract. The functionality that is 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 members of the interface. An empty interface does not define any members. Therefore, it 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 to identify a group of types. If this identification will occur at run time, the correct way to accomplish this is to use a custom attribute. Use the presence or absence of the attribute, or the properties of the attribute, to identify the target types. If the identification must occur at compile time, then it is acceptable to use an empty interface. Note that if an interface is empty but implements at least one other interface, it won't be matched by this rule. Such interface can be considered as not empty, since implementing it means that sub-interfaces members must be implemented.

• How to Fix Issues of this Rule: Remove the interface or add members to it. If the empty interface is being used to label a set of types, replace the interface with a custom attribute. The estimated Debt, which means the effort to fix such issue, is equal to 10 minutes to discard an empty interface plus 3 minutes per type implementing an empty interface.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1212:AvoidEmptyInterfaces", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Avoid types initialization cycles

• Rule Description: 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 explicitly declared in C# or VB.NET, to exist in compiled IL code. Having a static field inline initialization is enough to have the cctor implicitly 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://codeblog.jonskeet.uk/2012/04/07/type-initializer-circular-dependencies/ 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.

• How to Fix Issues of this Rule: Types initialization cycles create confusion and unexpected behaviors. If several states hold by several classes must be initialized during the first access of any of those classes, a better design option is to create a dedicated class whose responsibility is to initialize and hold all these states. The estimated Debt, which means the effort to fix such issue, is equal to 20 minutes per cycle plus 10 minutes per type class constructor involved in the cycle.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1213:AvoidTypesInitializationCycles", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

#### API Breaking Changes

6 validated Rule(s) API Breaking Changes: Types API Breaking Changes: Methods API Breaking Changes: Fields API Breaking Changes: Interfaces and Abstract Classes Broken serializable types Avoid changing enumerations Flags status

|  | Validated Rule: API Breaking Changes: Types

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule warns if a type publicly visible in the baseline, is not publicly visible anymore or if it has been removed. Clients code using such type will be broken.

• How to Fix Issues of this Rule: Make sure that public types that used to be presented to clients, still remain public now, and in the future. If a public type must really be removed, you can tag it with System.ObsoleteAttribute with a workaround message during a few public releases, until it gets removed definitely. Notice that this rule doesn't match types removed that were tagged as obsolete. Issues of this rule have a severity equal to High because an API Breaking change can provoque significant friction with consumers of the API.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1500:APIBreakingChangesTypes", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: API Breaking Changes: Methods

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule warns if a method publicly visible in the baseline, is not publicly visible anymore or if it has been removed. Clients code using such method will be broken.

• How to Fix Issues of this Rule: Make sure that public methods that used to be presented to clients, still remain public now, and in the future. If a public method must really be removed, you can tag it with System.ObsoleteAttribute with a workaround message during a few public releases, until it gets removed definitely. Notice that this rule doesn't match methods removed that were tagged as obsolete. Issues of this rule have a severity equal to High because an API Breaking change can provoque significant friction with consumers of the API.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1501:APIBreakingChangesMethods", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

|  | Validated Rule: API Breaking Changes: Fields

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule warns if a field publicly visible in the baseline, is not publicly visible anymore or if it has been removed. Clients code using such field will be broken.

• How to Fix Issues of this Rule: Make sure that public fields that used to be presented to clients, still remain public now, and in the future. If a public field must really be removed, you can tag it with System.ObsoleteAttribute with a workaround message during a few public releases, until it gets removed definitely. Notice that this rule doesn't match fields removed that were tagged as obsolete. Issues of this rule have a severity equal to High because an API Breaking change can provoque significant friction with consumers of the API.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1502:APIBreakingChangesFields", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No field matched

|  | Validated Rule: API Breaking Changes: Interfaces and Abstract Classes

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). 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. Clients code that implement such interface or derive from such abstract class will be broken.

• How to Fix Issues of this Rule: Make sure that the public contracts of interfaces and abstract classes that used to be presented to clients, remain stable now, and in the future. If a public contract must really be changed, you can tag abstract methods that will be removed with System.ObsoleteAttribute with a workaround message during a few public releases, until it gets removed definitely. Issues of this rule have a severity equal to High because an API Breaking change can provoque significant friction with consummers of the API. The severity is not set to Critical because an interface is not necessarily meant to be implemented by the consummer of the API.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1503:APIBreakingChangesInterfacesAndAbstractClasses", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Broken serializable types

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule warns about breaking changes in types tagged with SerializableAttribute. To do so, this rule searches for serializable type with serializable instance fields added or removed. Notice that it doesn't take account of fields tagged with NonSerializedAttribute. 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."

• How to Fix Issues of this Rule: Make sure that the serialization process of serializable types remains stable now, and in the future. Else you'll have to deal with Version Tolerant Serialization that is explained here: https://msdn.microsoft.com/en-us/library/ms229752(v=vs.110).aspx Issues of this rule have a severity equal to High because an API Breaking change can provoque significant friction with consummers of the API.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1504:BrokenSerializableTypes", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Avoid changing enumerations Flags status

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule matches enumeration types that used to be tagged with FlagsAttribute in the baseline, and not anymore. It also matches the opposite, enumeration types that are now tagged with FlagsAttribute, and were not tagged in the baseline. Being tagged with FlagsAttribute is a strong property for an enumeration. Not so much in terms of behavior (only the enum.ToString() method behavior changes when an enumeration is tagged with FlagsAttribute) but in terms of meaning: is the enumeration a range of values or a range of flags? As a consequence, changing the FlagsAttributes status of an enumeration can have significant impact for its clients.

• How to Fix Issues of this Rule: Make sure the FlagsAttribute status of each enumeration remains stable now, and in the future.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1505:AvoidChangingEnumerationsFlagsStatus", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

#### Code Coverage

10 validated Rule(s) Code should be tested New Methods should be tested Methods refactored should be tested Assemblies Namespaces and Types should be tested Types almost 100% tested should be 100% tested Namespaces almost 100% tested should be 100% tested Types that used to be 100% covered by tests should still be 100% covered Types tagged with FullCoveredAttribute should be 100% covered Types 100% covered should be tagged with FullCoveredAttribute Methods should have a low C.R.A.P score

|  | Validated Rule: Code should be tested

• Rule Description: This rule lists methods not covered at all by test or partially covered by tests. For each match, the rules estimates the technical debt, i.e the effort to write unit and integration tests for the method. The estimation is based on the effort to develop the code element multiplied by factors in the range ]0,1.3] based on • the method code size and complexity • the actual percentage coverage • the abstractness of types used, because relying on classes instead of interfaces makes the code more difficult to test • the method visibility because testing private or protected methods is more difficult than testing public and internal ones • the fields used by the method, because is is more complicated to write tests for methods that read mutable static fields whose changing state is shared across tests executions. • whether the method is considered JustMyCode or not because NotMyCode is often generated easier to get tested since tests can be generated as well. This rule is necessarily a large source of technical debt, since the code left untested is by definition part of the technical debt. This rule also estimates the annual interest, i.e the annual cost to let the code uncovered, based on the effort to develop the code element, multiplied by factors based on usage of the code element.

• How to Fix Issues of this Rule: Write unit tests to test and cover the methods and their parent classes matched by this rule.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1600:CodeShouldBeTested", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: New Methods should be tested

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule operates only on methods added or refactored since the baseline. This rule is executed only if some code coverage data is imported from some code coverage files. It is important to write code mostly covered by tests to achieve maintainable and non-error-prone code. In real-world, many code bases are poorly covered by tests. However it is not practicable to stop the development for months to refactor and write tests to achieve high code coverage ratio. Hence it is recommended that each time a method (or a type) gets added, the developer takes the time to write associated unit-tests to cover it. Doing so will help to increase significantly the maintainability of the code base. You'll notice that quickly, refactoring will also be driven by testability, and as a consequence, the overall code structure and design will increase as well. Issues of this rule have a High severity because they reflect an actual trend to not care about writing tests on refactored code.

• How to Fix Issues of this Rule: Write unit-tests to cover the code of most methods and classes added.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1601:NewMethodsShouldBeTested", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Methods refactored should be tested

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule operates only on methods added or refactored since the baseline. This rule is executed only if some code coverage data is imported from some code coverage files. It is important to write code mostly covered by tests to achieve maintainable and non-error-prone code. In real-world, many code bases are poorly covered by tests. However it is not practicable to stop the development for months to refactor and write tests to achieve high code coverage ratio. Hence it is recommended that each time a method (or a type) gets refactored, the developer takes the time to write associated unit-tests to cover it. Doing so will help to increase significantly the maintainability of the code base. You'll notice that quickly, refactoring will also be driven by testability, and as a consequence, the overall code structure and design will increase as well. Issues of this rule have a High severity because they reflect an actual trend to not care about writing tests on refactored code.

• How to Fix Issues of this Rule: Write unit-tests to cover the code of most methods and classes refactored.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1602:MethodsRefactoredShouldBeTested", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Assemblies Namespaces and Types should be tested

• Rule Description: This rule lists assemblies, namespaces and types that are not covered at all by unit tests. If a parent is matched its children are not matched. For example if a namespace is matched, its child types are not matched. This rule goal is not to collide with the Code should be tested rule that lists uncovered code for each method and infer the effort to write unit tests (the Debt) and the annual cost to let the code untested (the Annual Interest). This rule goal is to inform of large code elements left untested. As a consequence the Debt per issue is only 4 minutes and the severity of the issues is Low.

• How to Fix Issues of this Rule: Write unit and integration tests to cover, even partially, code elements matched by this rule. Then use issues of the rules Code should be tested, New Methods should be tested and Methods refactored should be tested to write more tests where it matters most, and eventually refactor some code to make it more testable.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1603:AssembliesNamespacesAndTypesShouldBeTested", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No code element parent matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Types almost 100% tested should be 100% tested

• Rule Description: This rule is executed only if some code coverage data is imported from some code coverage files. Often covering the few percents of remaining uncovered code of a class, requires as much work as covering the first 90%. For this reason, often teams estimate that 90% coverage is enough. However untestable code usually means poorly written code which usually leads to error prone code. So it might be worth refactoring and making sure to cover the few uncovered lines of code because most tricky bugs might come from this small portion of hard-to-test code. Not all classes should be 100% covered by tests (like UI code can be hard to test) but you should make sure that most of the logic of your application is defined in some easy-to-test classes, 100% covered by tests. Issues of this rule have a High severity because as explained, such situation is bug-prone.

• How to Fix Issues of this Rule: Write more unit-tests dedicated to cover code not covered yet. If you find some hard-to-test code, it is certainly a sign that this code is not well designed and hence, needs refactoring.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1604:TypesAlmost100PercentTestedShouldBe100PercentTested", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Namespaces almost 100% tested should be 100% tested

• Rule Description: This rule is executed only if some code coverage data is imported from some code coverage files. Often covering the few percents of remaining uncovered code of one or several classes in a namespace requires as much work as covering the first 90%. For this reason, often teams estimate that 90% coverage is enough. However untestable code usually means poorly written code which usually leads to error prone code. So it might be worth refactoring and making sure to cover the few uncovered lines of code because most tricky bugs might come from this small portion of hard-to-test code. Not all classes should be 100% covered by tests (like UI code can be hard to test) but you should make sure that most of the logic of your application is defined in some easy-to-test classes, 100% covered by tests. Issues of this rule have a High severity because as explained, such situation is bug-prone.

• How to Fix Issues of this Rule: Write more unit-tests dedicated to cover code not covered yet in the namespace. If you find some hard-to-test code, it is certainly a sign that this code is not well designed and hence, needs refactoring.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1605:NamespacesAlmost100PercentTestedShouldBe100PercentTested", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No namespace matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Types that used to be 100% covered by tests should still be 100% covered

• Rule Description: This rule is executed only if a baseline for comparison is defined (diff mode). This rule is executed only if some code coverage data is imported from some code coverage files. Often covering 10% of remaining uncovered code of a class, requires as much work as covering the first 90%. For this reason, typically teams estimate that 90% coverage is enough. However untestable code usually means poorly written code which usually leads to error prone code. So it might be worth refactoring and making sure to cover the 10% remaining code because most tricky bugs might come from this small portion of hard-to-test code. Not all classes should be 100% covered by tests (like UI code can be hard to test) but you should make sure that most of the logic of your application is defined in some easy-to-test classes, 100% covered by tests. In this context, this rule warns when a type fully covered by tests is now only partially covered. Issues of this rule have a High severity because often, a type that used to be 100% and is not covered anymore is a bug-prone situation that should be carefully handled.

• How to Fix Issues of this Rule: Write more unit-tests dedicated to cover code not covered anymore. If you find some hard-to-test code, it is certainly a sign that this code is not well designed and hence, needs refactoring. You'll find code impossible to cover by unit-tests, like calls to MessageBox.Show(). An infrastructure must be defined to be able to mock such code at test-time.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1606:TypesThatUsedToBe100PercentCoveredByTestsShouldStillBe100PercentCovered", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Types tagged with FullCoveredAttribute should be 100% covered

• Rule Description: This rule lists methods partially covered by tests, of types tagged with FullCoveredAttribute. This rule is executed only if some code coverage data is imported from some code coverage files. By using a FullCoveredAttribute, you can express in source code the intention that a class is 100% covered by tests, and should remain 100% covered in the future. If you don't want to link NDepend.API.dll, you can use your own attribute and adapt the source code of this rule. Benefits of using a FullCoveredAttribute are twofold: Not only the intention is expressed in source code, but it is also continuously checked by the present rule. Often covering 10% of remaining uncovered code of a class, requires as much work as covering the first 90%. For this reason, often teams estimate that 90% coverage is enough. However untestable code usually means poorly written code which usually means error prone code. So it might be worth refactoring and making sure to cover the 10% remaining code because most tricky bugs might come from this small portion of hard-to-test code. Not all classes should be 100% covered by tests (like UI code can be hard to test) but you should make sure that most of the logic of your application is defined in some easy-to-test classes, 100% covered by tests. Issues of this rule have a High severity because often, a type that used to be 100% and is not covered anymore is a bug-prone situation that should be carefully handled.

• How to Fix Issues of this Rule: Write more unit-tests dedicated to cover code of matched classes not covered yet. If you find some hard-to-test code, it is certainly a sign that this code is not well designed and hence, needs refactoring.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1607:TypesTaggedWithFullCoveredAttributeShouldBe100PercentCovered", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Types 100% covered should be tagged with FullCoveredAttribute

• Rule Description: This rule is executed only if some code coverage data is imported from some code coverage files. By using a FullCoveredAttribute, you can express in source code the intention that a class is 100% covered by tests, and should remain 100% covered in the future. Benefits of using a FullCoveredAttribute are twofold: Not only the intention is expressed in source code, but it is also continuously checked by the present rule. Issues of this rule have an Low severity because they don't reflect a problem, but provide an advice for potential improvement.

• How to Fix Issues of this Rule: Just tag types 100% covered by tests with the FullCoveredAttribute that can be found in NDepend.API.dll, or by an attribute of yours defined in your own code (in which case this rule must be adapted).

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1608:Types100PercentCoveredShouldBeTaggedWithFullCoveredAttribute", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

- To run this query import some Code Coverage Data..

|  | Validated Rule: Methods should have a low C.R.A.P score

• Rule Description: This rule is executed only if some code coverage data is imported from some code coverage files. So far this rule is disabled because other code coverage rules assess properly code coverage issues. Change Risk Analyzer and Predictor (i.e. CRAP) is a code metric that helps in pinpointing overly both complex and untested code. Is has been first defined here: http://www.artima.com/weblogs/viewpost.jsp?thread=215899 The Formula is: CRAP(m) = CC(m)^2 * (1 – cov(m)/100)^3 + CC(m) • where CC(m) is the cyclomatic complexity of the method m • and cov(m) is the percentage coverage by tests of the method m Matched methods cumulates two highly error prone code smells: • A complex method, difficult to develop and maintain. • Non 100% covered code, difficult to refactor without introducing any regression bug. The higher the CRAP score, the more painful to maintain and error prone is the method. An arbitrary threshold of 30 is fixed for this code rule as suggested by inventors. Notice that no amount of testing will keep methods with a Cyclomatic Complexity higher than 30, out of CRAP territory. Notice that this rule doesn't match too short method with less than 10 lines of code.

• How to Fix Issues of this Rule: In such situation, it is recommended to both refactor the complex method logic into several smaller and less complex methods (that might belong to some new types especially created), and also write unit-tests to full cover the refactored logic. You'll find code impossible to cover by unit-tests, like calls to MessageBox.Show(). An infrastructure must be defined to be able to mock such code at test-time.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1609:MethodsShouldHaveALowCRAPScore", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

- To run this query import some Code Coverage Data..

#### Dead Code

4 validated Rule(s) Potentially Dead Types Potentially Dead Methods Potentially Dead Fields Wrong usage of IsNotDeadCodeAttribute

|  | Validated Rule: Potentially Dead Types

• Rule Description: This rule lists potentially dead types. A dead type is a type that can be removed because it is never used by the program. This rule lists not only types not used anywhere in code, but also types used only by types not used anywhere in code. This is why this rule comes with a column TypesusingMe and this is why there is a code metric named depth: • A depth value of 0 means the type is not used. • A depth value of 1 means the type is used only by types not used. • etc… By reading the source code of this rule, you'll see that by default, public types are not matched, because such type might not be used by the analyzed code, but still be used by client code, not analyzed by NDepend. This default behavior can be easily changed. Note that this rule doesn't match Entity Framework ModelSnapshot classes that are used ony by the EF infrastructure.

• How to Fix Issues of this Rule: Static analysis cannot provide an exact list of dead types, because there are several ways to use a type dynamically (like through reflection). For each type matched by this query, first investigate if the type is used somehow (like through reflection). If the type is really never used, it is important to remove it to avoid maintaining useless code. If you estimate the code of the type might be used in the future, at least comment it, and provide an explanatory comment about the future intentions. If a type is used somehow, but still is matched by this rule, you can tag it with the attribute IsNotDeadCodeAttribute found in NDepend.API.dll to avoid matching the type again. You can also provide your own attribute for this need, but then you'll need to adapt this code rule. Issues of this rule have a Debt equal to 15 minutes because it only takes a short while to investigate if a type can be safely discarded. The Annual Interest of issues of this rule, the annual cost to not fix such issue, is proportional to the type #lines of code, because the bigger the type is, the more it slows down maintenance.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1700:PotentiallyDeadTypes", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No type matched

|  | Validated Rule: Potentially Dead Methods

• Rule Description: This rule lists potentially dead methods. A dead method is a method that can be removed because it is never called by the program. This rule lists not only methods not called anywhere in code, but also methods called only by methods not called anywhere in code. This is why this rule comes with a column MethodsCallingMe and this is why there is a code metric named depth: • A depth value of 0 means the method is not called. • A depth value of 1 means the method is called only by methods not called. • etc… By reading the source code of this rule, you'll see that by default, public methods are not matched, because such method might not be called by the analyzed code, but still be called by client code, not analyzed by NDepend. This default behavior can be easily changed.

• How to Fix Issues of this Rule: Static analysis cannot provide an exact list of dead methods, because there are several ways to invoke a method dynamically (like through reflection). For each method matched by this query, first investigate if the method is invoked somehow (like through reflection). If the method is really never invoked, it is important to remove it to avoid maintaining useless code. If you estimate the code of the method might be used in the future, at least comment it, and provide an explanatory comment about the future intentions. If a method is invoked somehow, but still is matched by this rule, you can tag it with the attribute IsNotDeadCodeAttribute found in NDepend.API.dll to avoid matching the method again. You can also provide your own attribute for this need, but then you'll need to adapt this code rule. Issues of this rule have a Debt equal to 10 minutes because it only takes a short while to investigate if a method can be safely discarded. On top of these 10 minutes, the depth of usage of such method adds up 3 minutes per unity because dead method only called by dead code takes a bit more time to be investigated. The Annual Interest of issues of this rule, the annual cost to not fix such issue, is proportional to the type #lines of code, because the bigger the method is, the more it slows down maintenance.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1701:PotentiallyDeadMethods", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No method matched

|  | Validated Rule: Potentially Dead Fields

• Rule Description: This rule lists potentially dead fields. A dead field is a field that can be removed because it is never used by the program. By reading the source code of this rule, you'll see that by default, public fields are not matched, because such field might not be used by the analyzed code, but still be used by client code, not analyzed by NDepend. This default behavior can be easily changed. Some others default rules in the Visibility group, warn about public fields. More restrictions are applied by this rule because of some by-design limitations. NDepend mostly analyzes compiled IL code, and the information that an enumeration value or a literal constant (which are fields) is used is lost in IL code. Hence by default this rule won't match such field.

• How to Fix Issues of this Rule: Static analysis cannot provide an exact list of dead fields, because there are several ways to assign or read a field dynamically (like through reflection). For each field matched by this query, first investigate if the field is used somehow (like through reflection). If the field is really never used, it is important to remove it to avoid maintaining a useless code element. If a field is used somehow, but still is matched by this rule, you can tag it with the attribute IsNotDeadCodeAttribute found in NDepend.API.dll to avoid matching the field again. You can also provide your own attribute for this need, but then you'll need to adapt this code rule. Issues of this rule have a Debt equal to 10 minutes because it only takes a short while to investigate if a method can be safely discarded. The Annual Interest of issues of this rule, the annual cost to not fix such issue, is set by default to 8 minutes per unused field matched.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1702:PotentiallyDeadFields", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No field matched

|  | Validated Rule: Wrong usage of IsNotDeadCodeAttribute

• Rule Description: The attribute NDepend.Attributes.IsNotDeadCodeAttribute is defined in NDepend.API.dll. This attribute is used to mean that a code element is not used directly, but is used somehow, like through reflection. This attribute is used in the dead code rules, Potentially dead Types, Potentially dead Methods and Potentially dead Fields. If you don't want to link NDepend.API.dll, you can use your own IsNotDeadCodeAttribute and adapt the source code of this rule, and the source code of the dead code rules. In this context, this code rule matches code elements (types, methods, fields) that are tagged with this attribute, but still used directly somewhere in the code.

• How to Fix Issues of this Rule: Just remove IsNotDeadCodeAttribute tagging of types, methods and fields matched by this rule because this tag is not useful anymore.

• How to Suppress an Issue of this Rule: In source code, tag the concerned code element with this attribute: [SuppressMessage("NDepend", "ND1703:WrongUsageOfIsNotDeadCodeAttribute", Justification="...")] This attribute requires the compilation symbol CODE_ANALYSIS to be set on each Visual Studio project relying on it. Without CODE_ANALYSIS symbol defined, the attribute is not compiled and the issues are not suppressed.

###

No member matched

#### Code Diff Summary

» Baseline for comparison : Baseline is same code base snapshot.
25 Queries New assemblies Assemblies removed Assemblies where code was changed New namespaces Namespaces removed Namespaces where code was changed New types Types removed Types where code was changed Heuristic to find types moved from one namespace or assembly to another Types directly using one or several types changed Types indirectly using one or several types changed New methods Methods removed Methods where code was changed Methods directly calling one or several methods changed Methods indirectly calling one or several methods changed New fields Fields removed Third party types that were not used and that are now used Third party types that were used and that are not used anymore Third party methods that were not used and that are now used Third party methods that were used and that are not used anymore Third party fields that were not used and that are now used Third party fields that were used and that are not used anymore

|  | Code Query: New assemblies

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists assemblies that have been added since the baseline.

###

No assembly matched

|  | Code Query: Assemblies removed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists assemblies that have been removed since the baseline.

###

No assembly matched

|  | Code Query: Assemblies where code was changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists assemblies in which, code has been changed since the baseline.

###

No assembly matched

|  | Code Query: New namespaces

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists namespaces that have been added since the baseline.

###

No namespace matched

|  | Code Query: Namespaces removed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists namespaces that have been removed since the baseline.

###

No namespace matched

|  | Code Query: Namespaces where code was changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists namespaces in which, code has been changed since the baseline.

###

No namespace matched

|  | Code Query: New types

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types that have been added since the baseline.

###

No type matched

|  | Code Query: Types removed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types that have been removed since the baseline.

###

No type matched

|  | Code Query: Types where code was changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types in which, code has been changed since the baseline. 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 decompiled with Reflector

###

No type matched

|  | Code Query: Heuristic to find types moved from one namespace or assembly to another

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types moved from one namespace or assembly to another. The heuristic implemented consists in making a join LINQ query on type name (without namespace prefix), applied to the two sets of types added and types removed.

###

No type matched

|  | Code Query: Types directly using one or several types changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types unchanged since the baseline but that use directly some types where code has been changed since the baseline. For such matched type, the code hasen't been changed, but still the overall behavior might have been changed. The query result includes types changed directly used,

###

No type matched

|  | Code Query: Types indirectly using one or several types changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types unchanged since the baseline but that use directly or indirectly some types where code has been changed since the baseline. For such matched type, the code hasen't been changed, but still the overall behavior might have been changed. The query result includes types changed directly used, and the depth of usage of types indirectly used, depth of usage as defined in the documentation of DepthOfIsUsingAny() NDepend API method: https://www.ndepend.com/api/webframe.html#NDepend.API~NDepend.CodeModel.ExtensionMethodsSequenceUsage~DepthOfIsUsingAny.html

###

No type matched

|  | Code Query: New methods

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods that have been added since the baseline.

###

No method matched

|  | Code Query: Methods removed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods that have been removed since the baseline.

###

No method matched

|  | Code Query: Methods where code was changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods in which, code has been changed since the baseline. 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 decompiled with Reflector

###

No method matched

|  | Code Query: Methods directly calling one or several methods changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods unchanged since the baseline but that call directly some methods where code has been changed since the baseline. For such matched method, the code hasen't been changed, but still the overall behavior might have been changed. The query result includes methods changed directly used,

###

No method matched

|  | Code Query: Methods indirectly calling one or several methods changed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods unchanged since the baseline but that use directly or indirectly some methods where code has been changed since the baseline. For such matched method, the code hasen't been changed, but still the overall behavior might have been changed. The query result includes methods changed directly used, and the depth of usage of methods indirectly used, depth of usage as defined in the documentation of DepthOfIsUsingAny() NDepend API method: https://www.ndepend.com/api/webframe.html#NDepend.API~NDepend.CodeModel.ExtensionMethodsSequenceUsage~DepthOfIsUsingAny.html

###

No method matched

|  | Code Query: New fields

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists fields that have been added since the baseline.

###

No field matched

|  | Code Query: Fields removed

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists fields that have been removed since the baseline.

###

No field matched

|  | Code Query: Third party types that were not used and that are now used

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types defined in third-party assemblies, that were not used at baseline time, and that are now used.

###

No type matched

|  | Code Query: Third party types that were used and that are not used anymore

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists types defined in third-party assemblies, that were used at baseline time, and that are not used anymore.

###

No type matched

|  | Code Query: Third party methods that were not used and that are now used

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods defined in third-party assemblies, that were not used at baseline time, and that are now used.

###

No method matched

|  | Code Query: Third party methods that were used and that are not used anymore

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists methods defined in third-party assemblies, that were used at baseline time, and that are not used anymore.

###

No method matched

|  | Code Query: Third party fields that were not used and that are now used

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists fields defined in third-party assemblies, that were not used at baseline time, and that are now used.

###

No field matched

|  | Code Query: Third party fields that were used and that are not used anymore

• Query Description: This query is executed only if a baseline for comparison is defined (diff mode). This code query lists fields defined in third-party assemblies, that were used at baseline time, and that are not used anymore.

###

No field matched

#### Trend Charts

#### Size

#### % Coverage and % Debt

#### Issues

#### Rules

#### Quality Gates

#### Debt

#### Assemblies Dependencies

Assembly | Depends on | Is referenced by
--- | --- | ---
Chapter12 v1.0.0.0 | System.Runtime v7.0.0.0 ; System.Console v7.0.0.0 ; System.Linq v7.0.0.0 ; System.Collections v7.0.0.0 ; | -

#### Assemblies Build Order

1. Chapter12

#### Assemblies Build Order

1. Chapter12

#### Analysis Log : Information and Warnings

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

| Message
--- | ---
| Begin full analysis with NDepend v2023.1.1
| Visual Studio solution file resolved to absolute file path: from {.\Chapter12FinalCode.sln} to {C:\Dev\repos\RefactoringWithCSharp\Chapter12\Ch12FinalCode\Chapter12FinalCode.sln}
| Output directory resolved to absolute directory path: C:\Dev\repos\RefactoringWithCSharp\Chapter12\Ch12FinalCode\NDependOut
| .NET Assembly resolved from the Visual Studio solution file {C:\Dev\repos\RefactoringWithCSharp\Chapter12\Ch12FinalCode\Chapter12FinalCode.sln} C:\Dev\repos\RefactoringWithCSharp\Chapter12\Ch12FinalCode\Chapter12\bin\Debug\net7.0\Chapter12.dll
| .NET Assembly filtered out from the Visual Studio solution file {C:\Dev\repos\RefactoringWithCSharp\Chapter12\Ch12FinalCode\Chapter12FinalCode.sln} Chapter12UnitTests
| Concurrent mode
| .NET Assemblies loaded from {C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.10} System.Linq.dll v7.0.0.0 System.Console.dll v7.0.0.0 System.Collections.dll v7.0.0.0 System.Runtime.dll v7.0.0.0
| 20 source files parsed ; all source files found ; all source files in-sync with PDB
| 0 code rule has been extracted from code.
| No dependency cycle detected in assemblies referencement graph.
| Do merge code generated by compiler into application code.
| No SuppressMessageAttribute found in the analyzed code base. Since NDepend v2018.2 SuppressMessageAttribute can be used to suppress NDepend issues. Don't forget to set in your projects the compilation symbol CODE_ANALYSIS to use this attribute to suppress NDepend issues.
| Analyse dependencies of your application.
| Persisting code model snapshot in {C:\Dev\repos\RefactoringWithCSharp\Chapter12\Ch12FinalCode\NDependOut\NDependAnalysisResult_Chapter12FinalCode_2023Aug28_22h19m48.ndar}
| Log trend metrics values.
| Execute queries and rules.
| 2 quality gates fail: - 'Critical Rules Violated' value 1 rules greater than fail threshold 0 rules - 'Debt Rating per Namespace' value 1 namespaces greater than fail threshold 0 namespaces
| Building the report (standard).
| NDepend analysis done. Duration: 01:14.481

#### Abstractness versus Instability Diagram

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

- Abstractness: If an assembly contains many abstract types (i.e interfaces and abstract classes) and few concrete types, it is considered as abstract.
- Instability: An assembly is considered stable if its types are used by a lot of types from other assemblies. In this context stable means painful to modify.

Online documentation:

- Definitions of related Code Metrics

Search: