File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 11from ._helpers import AnalyzerHelpers
22from functional import seq
3-
3+ from warnings import warn
44
55class Metrics :
66
@@ -29,7 +29,11 @@ def instability(framework, frameworks):
2929 """
3030 fan_in = Metrics .fan_in (framework , frameworks )
3131 fan_out = Metrics .fan_out (framework )
32- return fan_out / (fan_in + fan_out )
32+ sum_in_out = fan_in + fan_out
33+ if sum_in_out == 0 :
34+ warn (f'{ framework .name } is not linked with the rest of the project.' , Warning )
35+ return 0
36+ return fan_out / sum_in_out
3337
3438 @staticmethod
3539 def abstractness (framework ):
@@ -41,7 +45,7 @@ def abstractness(framework):
4145 :return: The abstractness value (double)
4246 """
4347 if framework .number_of_concrete_data_structures == 0 :
44- # This is an external dependency build as source
48+ warn ( f' { framework . name } is an external dependency.' , Warning )
4549 return 0
4650 else :
4751 return framework .number_of_interfaces / framework .number_of_concrete_data_structures
You can’t perform that action at this time.
0 commit comments