|
@@ -5,6 +5,7 @@ import com.moekr.moocoder.logic.service.CodeMetricService;
|
|
|
import com.moekr.moocoder.logic.vo.*;
|
|
import com.moekr.moocoder.logic.vo.*;
|
|
|
import com.moekr.moocoder.util.FileUtil;
|
|
import com.moekr.moocoder.util.FileUtil;
|
|
|
import com.moekr.moocoder.util.enums.Granularity;
|
|
import com.moekr.moocoder.util.enums.Granularity;
|
|
|
|
|
+import lombok.extern.apachecommons.CommonsLog;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
@@ -17,6 +18,7 @@ import java.util.Set;
|
|
|
* @author miaomuzhi
|
|
* @author miaomuzhi
|
|
|
* @since 2020/5/24
|
|
* @since 2020/5/24
|
|
|
*/
|
|
*/
|
|
|
|
|
+@CommonsLog
|
|
|
@Component
|
|
@Component
|
|
|
public class CodeMetricServiceImpl implements CodeMetricService{
|
|
public class CodeMetricServiceImpl implements CodeMetricService{
|
|
|
private OOPMetricAnalyzer analyzer;
|
|
private OOPMetricAnalyzer analyzer;
|
|
@@ -34,6 +36,7 @@ public class CodeMetricServiceImpl implements CodeMetricService{
|
|
|
public CodeScaleMetricVO getCodeScaleMetric(String project) {
|
|
public CodeScaleMetricVO getCodeScaleMetric(String project) {
|
|
|
CallGraphVO methodGraph = visualizer.getForceDirectedGraph(project, Granularity.METHOD);
|
|
CallGraphVO methodGraph = visualizer.getForceDirectedGraph(project, Granularity.METHOD);
|
|
|
if (methodGraph == null) {
|
|
if (methodGraph == null) {
|
|
|
|
|
+ log.warn(new NullPointerException("There is no call graph returned"));
|
|
|
return new CodeScaleMetricVO(0, 0, 0);
|
|
return new CodeScaleMetricVO(0, 0, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|