RadonMetrics/MaintainabilityIndexCalculator.py

branch
eric7
changeset 109
47df4b69f699
parent 107
0843dd7239f6
child 110
261babeb7cc6
equal deleted inserted replaced
108:19970127c936 109:47df4b69f699
27 @return the entry point for the background client (function) 27 @return the entry point for the background client (function)
28 """ 28 """
29 return batchMaintainabilityIndex 29 return batchMaintainabilityIndex
30 30
31 31
32 def maintainabilityIndex(file, text=""): # noqa: U100 32 def maintainabilityIndex(
33 file, # noqa: U100
34 text="",
35 ):
33 """ 36 """
34 Private function to calculate the maintainability index of one file. 37 Private function to calculate the maintainability index of one file.
35 38
36 @param file source filename 39 @param file source filename
37 @type str 40 @type str
145 @param text source text 148 @param text source text
146 @type str 149 @type str
147 @return tuple containing the result dictionary 150 @return tuple containing the result dictionary
148 @rtype (tuple of dict) 151 @rtype (tuple of dict)
149 """ 152 """
150 from radon.metrics import mi_rank, mi_visit 153 from radon.metrics import mi_rank, mi_visit # noqa: I102
151 154
152 try: 155 try:
153 mi = mi_visit(text, True) 156 mi = mi_visit(text, True)
154 rank = mi_rank(mi) 157 rank = mi_rank(mi)
155 res = {"mi": mi, "rank": rank} 158 res = {"mi": mi, "rank": rank}

eric ide

mercurial