问题描述
两个包中有两个POJO 市场和 MarketDTO 。
There are two POJOs Market and MarketDTO in two packages.
市场是来自远程服务的JSON响应的映射对象。
Market is a mapping object for JSON response from remote service.
MarketDTO 是一个响应对象,将通过我们的服务公开。
MarketDTO is a response object which will be exposed via our service.
市场 - > MarketDTO 有一些数据按摩。它们有一些共同的领域,并且都有独特的领域。
共有3个常见字段,例如 ID ,名称和状态。
There are some data massage from Market->MarketDTO. They have some common fields and both have unique fields as well. There are 3 common fields such as id, name and status.
但是,Sonarqube表示他们的getter和setter是要删除的重复代码块。这实际上是不好的代码还是我应该将其标记为误报?
However, Sonarqube indicates their getters and setters as duplicated blocks of codes to be removed. Is this actually bad code or I should just mark it as false positive?
推荐答案
我会说你的选择是从Market和MarketDTO中提取一个共同的祖先类,或者标记重复的块问题不会修复。 (他们不真的是误报,是吗?)
I'd say your choices are to extract a common ancestor class from Market and MarketDTO, or mark the duplicated blocks issues Won't Fix. (They're not really false positives, are they?)
这篇关于Sonarqube在POJO之间复制了代码块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!