diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-01-24 17:17:59 +0400 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2012-01-24 20:33:39 +0400 |
commit | ed409e8f0a53554aad46ac438b93b7adc02cc5d8 (patch) | |
tree | af3c6337ef286c9cd4b68b490b43994fbc78a32a /sonar-core/src/main | |
parent | 74ae0f80835d5b236480b78253ed9a30af56ca6a (diff) | |
download | sonarqube-ed409e8f0a53554aad46ac438b93b7adc02cc5d8.tar.gz sonarqube-ed409e8f0a53554aad46ac438b93b7adc02cc5d8.zip |
SONAR-3181,SONAR-3139 Enable cross project CPD for all languages
sonar.cpd.minimumTokens can't be used, because for index in database
tokens must be grouped by lines.
Diffstat (limited to 'sonar-core/src/main')
3 files changed, 5 insertions, 3 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java index 2d98f947ca8..e557d061ca7 100644 --- a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java +++ b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationDao.java @@ -36,11 +36,11 @@ public class DuplicationDao implements BatchComponent, ServerComponent { this.mybatis = mybatis; } - public List<DuplicationUnitDto> selectCandidates(int resourceSnapshotId, Integer lastSnapshotId) { + public List<DuplicationUnitDto> selectCandidates(int resourceSnapshotId, Integer lastSnapshotId, String language) { SqlSession session = mybatis.openSession(); try { DuplicationMapper mapper = session.getMapper(DuplicationMapper.class); - return mapper.selectCandidates(resourceSnapshotId, lastSnapshotId); + return mapper.selectCandidates(resourceSnapshotId, lastSnapshotId, language); } finally { MyBatis.closeSessionQuietly(session); } diff --git a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java index fa4b30052cb..f7afbb79af4 100644 --- a/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/duplication/DuplicationMapper.java @@ -27,7 +27,8 @@ public interface DuplicationMapper { List<DuplicationUnitDto> selectCandidates( @Param("resource_snapshot_id") int resourceSnapshotId, - @Param("last_project_snapshot_id") Integer lastSnapshotId); + @Param("last_project_snapshot_id") Integer lastSnapshotId, + @Param("language") String language); void batchInsert(DuplicationUnitDto unit); diff --git a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml index c1dc43121e4..2f0af1b57e7 100644 --- a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml @@ -11,6 +11,7 @@ AND to_blocks.snapshot_id = snapshot.id AND snapshot.islast = ${_true} AND snapshot.project_id = res.id + AND res.language = #{language} <if test="last_project_snapshot_id != null"> AND to_blocks.project_snapshot_id != #{last_project_snapshot_id} </if> |