Revize cfd4e4bb
Přidáno uživatelem stepanekp před asi 3 roky(ů)
data/configurations/Default.json | ||
---|---|---|
106 | 106 |
"value": "2" |
107 | 107 |
} |
108 | 108 |
] |
109 |
}, |
|
110 |
{ |
|
111 |
"antiPattern": "UnknownPoster", |
|
112 |
"thresholds": [ |
|
113 |
{ |
|
114 |
"thresholdName": "searchSubstringsInvalidNames", |
|
115 |
"value": "%unknown%||%anonym%" |
|
116 |
} |
|
117 |
] |
|
109 | 118 |
} |
110 | 119 |
] |
111 | 120 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/BystanderApathyDetectorImpl.java | ||
---|---|---|
1 |
package cz.zcu.fav.kiv.antipatterndetectionapp.detecting.detectors; |
|
2 |
|
|
3 |
import cz.zcu.fav.kiv.antipatterndetectionapp.detecting.DatabaseConnection; |
|
4 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern; |
|
5 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project; |
|
6 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem; |
|
7 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail; |
|
8 |
import org.slf4j.Logger; |
|
9 |
import org.slf4j.LoggerFactory; |
|
10 |
|
|
11 |
import java.util.ArrayList; |
|
12 |
import java.util.Arrays; |
|
13 |
import java.util.List; |
|
14 |
import java.util.Map; |
|
15 |
|
|
16 |
public class BystanderApathyDetectorImpl implements AntiPatternDetector { |
|
17 |
private final Logger LOGGER = LoggerFactory.getLogger(BystanderApathyDetectorImpl.class); |
|
18 |
|
|
19 |
public final String configJsonFileName = "BystanderApathy.json"; |
|
20 |
|
|
21 |
private AntiPattern antiPattern; |
|
22 |
|
|
23 |
private final List<String> SQL_FILE_NAMES = Arrays.asList(); |
|
24 |
|
|
25 |
// sql queries loaded from sql file |
|
26 |
private List<String> sqlQueries; |
|
27 |
|
|
28 |
@Override |
|
29 |
public String getJsonFileName(){ |
|
30 |
return this.configJsonFileName; |
|
31 |
} |
|
32 |
|
|
33 |
@Override |
|
34 |
public void setAntiPattern(AntiPattern antiPattern) { |
|
35 |
this.antiPattern = antiPattern; |
|
36 |
} |
|
37 |
|
|
38 |
@Override |
|
39 |
public AntiPattern getAntiPatternModel() { |
|
40 |
return this.antiPattern; |
|
41 |
} |
|
42 |
|
|
43 |
@Override |
|
44 |
public List<String> getSqlFileNames() { |
|
45 |
return this.SQL_FILE_NAMES; |
|
46 |
} |
|
47 |
|
|
48 |
@Override |
|
49 |
public void setSqlQueries(List<String> queries) { |
|
50 |
this.sqlQueries = queries; |
|
51 |
} |
|
52 |
|
|
53 |
/** |
|
54 |
* |
|
55 |
*/ |
|
56 |
@Override |
|
57 |
public QueryResultItem analyze(Project project, DatabaseConnection databaseConnection, Map<String, String> thresholds) { |
|
58 |
List<ResultDetail> resultDetails = new ArrayList<>(); |
|
59 |
resultDetails.add(new ResultDetail("Test", "Test")); |
|
60 |
return new QueryResultItem(this.antiPattern, false, resultDetails); |
|
61 |
} |
|
62 |
} |
src/main/resources/antipatterns/UnknownPoster.json | ||
---|---|---|
4 | 4 |
"name": "UnknownPoster", |
5 | 5 |
"description": "The identity of the contributor is unknown. The real name of the contributor is missing or replaced by nickname according to which the contributor cannot be identified.", |
6 | 6 |
"thresholds": [ |
7 |
{ |
|
8 |
"thresholdName": "searchSubstringsInvalidNames", |
|
9 |
"thresholdType": "String", |
|
10 |
"thresholdPrintName": "Search substrings with invalid names", |
|
11 |
"thresholdDescription": "Substring that will be search in names", |
|
12 |
"thresholdErrorMess": "Maximum number of substrings is ten and must not starts and ends with characters || " |
|
13 |
} |
|
7 | 14 |
] |
8 | 15 |
} |
src/main/resources/queries/select_all_persons_without_full_name.sql | ||
---|---|---|
1 |
/* Select all persons without full name */ |
|
2 |
select pv.id from personview pv where pv.projectId = @projectId and pv.name not like '% %'; |
src/main/resources/queries/select_identities_without_valid_information.sql | ||
---|---|---|
1 |
/* Select count of identities of a person which are without name written in description, without email and with name like "unknown" */ |
|
2 |
select count(i.id) from identity i where i.personId like '§0§' and ((i.email is not null and i.email not like '') or (i.description like '% %') or (i.name like '% %') or (i.name not like '§1§' and i.name not like '§2§' and i.name not like '§3§' and i.name not like '§4§' and i.name not like '§5§' and i.name not like '§6§' and i.name not like '§7§' and i.name not like '§8§' and i.name not like '§9§' and i.name not like '§10§')); |
Také k dispozici: Unified diff
Unknown Poster antipattern detection added