Revize e15a6649
Přidáno uživatelem Ondřej Váně před více než 3 roky(ů)
README.md | ||
---|---|---|
1 |
# AntiPatternDetectionApp
|
|
2 |
This application was created as part of the thesis. It is used for analysis and detection of anti-patterns in project data.
|
|
1 |
# ReliSA - SPADe-Web-GUI
|
|
2 |
This application was is used for analysis and detection of anti-patterns in project data. |
|
3 | 3 |
|
4 |
## Thesis abstract |
|
5 |
The goal of this thesis is to analyze and automatically detect anti-patterns in the data of project management tools using SPADe tools. The SPADe tool is used to collect data from ALM tools and search for bad practices (anti-patterns) in project data. In order to develop this thesis, an analysis of the available anti-patterns was performed and then a subset was selected for further investigation. In the next part, the detection of the analyzed anti-patterns was implemented using SQL queries and Java programming language was used to process the results of these queries. As an extra feature of this thesis, going beyond the scope of the original assignment, a support web application for running the detection process of implemented anti-patters and results presentation was also developed. Furthermore, an experiment was performed on a selected sets of anti-patterns and project data. The success of the detection was verified by comparing the results to those from a manual anti-pattern detection in project data from the source ALM tools. Detection success was successful at 93.65 % compared to manual control. |
|
6 |
|
|
7 |
## Analyzed Anti-Patterns |
|
8 | 4 |
In version 1.0.0 of this application, the detection of the following Anti-Patterns is implemented: |
9 | 5 |
* Business As Usual |
10 | 6 |
* Long Or Non-Existant Feedback Loops |
... | ... | |
14 | 10 |
* Too Long Sprint |
15 | 11 |
* Varying Sprint Length |
16 | 12 |
|
17 |
## Run |
|
18 |
### Tools to run |
|
19 |
It will need the following tools to run the application: |
|
20 |
* Docker |
|
21 |
* Docker Compose |
|
22 |
### Run application |
|
23 |
The following list describes the steps to run (you will need): |
|
24 |
1. Open terminal. |
|
25 |
2. Move to the root folder of this project (AntiPatternDetectionApp). |
|
26 |
3. Build docker images with command `docker-compose build`. |
|
27 |
4. Create and run all containers with command `docker-compose run`. |
|
28 |
5. Open phpMyAdmin on docker address on port 8082. |
|
29 |
6. Create database with name spade using command `CREATE DATABASE spade;`. |
|
30 |
7. Restore database from file `db_dump.sql` located in project root folder. |
|
31 |
8. Run all commands from file `config.sql` located in project root folder. |
|
13 |
# Basic architecture of app |
|
14 |
|
|
15 |
# Installation guide |
|
16 |
|
|
17 |
# Add new Anti-Pattern |
|
18 |
|
|
19 |
# User guide |
|
20 |
## Analyze projects |
|
21 |
1) On home page select project to analyze (you can use check box for select/deselect all projects) |
|
22 |
TODO obrázek |
|
23 |
2) Select Anti-Patterns to analyze (you can use check box for select/deselect all Anti-Patterns) |
|
24 |
TODO obrázek |
|
25 |
3) Click to button Analyze |
|
26 |
TODO obrázek |
|
27 |
4) Table with detections result |
|
28 |
TODO obrázek |
|
29 |
5) Show details of detection |
|
30 |
6) Show detail of Anti-Pattern |
|
31 |
|
|
32 |
## Configuration of Anti-Patterns |
|
33 |
1) Go to Configuration page |
|
34 |
TODO obrázek |
|
35 |
2) Change corresponding threshold values |
|
36 |
TODO obrázek |
|
37 |
3) Click button Save or press Enter |
|
38 |
TODO obrázek |
|
39 |
4) If the values are set correctly, a message is displayed stating that the values were saved successfully |
|
40 |
TODO obrázek |
|
41 |
5) If the values are set incorrectly, a error message is displayed and the corresponding values are highlighted in red with error message |
|
42 |
TODO obrázek |
|
43 |
|
|
44 |
## Show Anti-Pattern detail |
|
45 |
1) Go to Anti-Pattern detail page |
|
46 |
1) On Home page click on anchor Show next to corresponding Anti-Pattern |
|
47 |
2) On result page slick on Anti-Pattern name and anchor Detail |
|
48 |
2) Anti-Pattern detail page is shown (name, description, anchor to catalogue, configuration values) |
|
49 |
3) Configuration values can be updated also in this page |
|
50 |
1) Change corresponding threshold values |
|
51 |
2) Click button Save or press Enter |
|
52 |
4) If the values are set correctly, a message is displayed stating that the values were saved successfully |
|
53 |
TODO obrázek |
|
54 |
5) If the values are set incorrectly, a error message is displayed and the corresponding values are highlighted in red with error message |
|
55 |
TODO obrázek |
|
56 |
|
|
57 |
## Show project detail |
|
58 |
1) On home page click on anchor Show, next to corresponding project |
|
59 |
TODO obrázek |
|
60 |
2) Project details is shown (project id, name, description) |
|
61 |
TODO obrázek |
|
62 |
|
|
32 | 63 |
|
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/AntiPatternDetector.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
AntiPattern getAntiPatternModel(); |
14 | 14 |
|
15 |
String getAntiPatternSqlFileName();
|
|
15 |
List<String> getSqlFileNames();
|
|
16 | 16 |
|
17 | 17 |
void setSqlQueries(List<String> queries); |
18 | 18 |
|
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/BusinessAsUsualDetectorImpl.java | ||
---|---|---|
35 | 35 |
}}, |
36 | 36 |
"Business_As_Usual.md"); |
37 | 37 |
|
38 |
private final String sqlFileName = "business_as_usual.sql"; |
|
38 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
39 |
"set_project_id.sql", |
|
40 |
"select_number_of_iterations.sql", |
|
41 |
"select_iterations_with_substrings.sql", |
|
42 |
"select_all_wikipages_that_is_updated_in_iteration.sql"); |
|
39 | 43 |
|
40 | 44 |
// sql queries loaded from sql file |
41 | 45 |
private List<String> sqlQueries; |
... | ... | |
54 | 58 |
} |
55 | 59 |
|
56 | 60 |
@Override |
57 |
public String getAntiPatternSqlFileName() {
|
|
58 |
return this.sqlFileName;
|
|
61 |
public List<String> getSqlFileNames() {
|
|
62 |
return this.SQL_FILE_NAMES;
|
|
59 | 63 |
} |
60 | 64 |
|
61 | 65 |
@Override |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/LongOrNonExistentFeedbackLoopsDetectorImpl.java | ||
---|---|---|
51 | 51 |
}} |
52 | 52 |
); |
53 | 53 |
|
54 |
private final String SQL_FILE_NAME = "long_or_non_existent_feedback_loops.sql"; |
|
54 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
55 |
"set_project_id.sql", |
|
56 |
"select_number_of_iterations.sql", |
|
57 |
"select_average_iterations_length.sql", |
|
58 |
"select_number_of_iterations_with_substrings_in_activity.sql", |
|
59 |
"select_all_activities_with_substrings_and_last_modified_date_as_end_date.sql", |
|
60 |
"select_project_start_date.sql", |
|
61 |
"select_project_end_date.sql", |
|
62 |
"select_all_iterations_that_contains_wikipages_with_substrings.sql"); |
|
63 |
|
|
55 | 64 |
// sql queries loaded from sql file |
56 | 65 |
private List<String> sqlQueries; |
57 | 66 |
|
... | ... | |
60 | 69 |
} |
61 | 70 |
|
62 | 71 |
private float getMaxGapBetweenFeedbackLoopRate() { |
63 |
return (float) antiPattern.getConfigurations().get("maxGapBetweenFeedbackLoopRate").getValue();
|
|
72 |
return ((PositiveFloat) antiPattern.getConfigurations().get("maxGapBetweenFeedbackLoopRate").getValue()).floatValue();
|
|
64 | 73 |
} |
65 | 74 |
|
66 | 75 |
private List<String> getSearchSubstringsWithFeedbackLoop() { |
... | ... | |
72 | 81 |
return this.antiPattern; |
73 | 82 |
} |
74 | 83 |
|
75 |
@Override |
|
76 |
public String getAntiPatternSqlFileName() { |
|
77 |
return this.SQL_FILE_NAME; |
|
84 |
public List<String> getSqlFileNames() { |
|
85 |
return this.SQL_FILE_NAMES; |
|
78 | 86 |
} |
79 | 87 |
|
80 | 88 |
@Override |
... | ... | |
124 | 132 |
break; |
125 | 133 |
case 2: |
126 | 134 |
if (rs.size() != 0) { |
127 |
numberOfIterationsWhichContainsAtLeastOneActivityForFeedback = ((Long) rs.get(0).get("totalCountOfIterationsWithFeedbackActivity")).intValue();
|
|
135 |
numberOfIterationsWhichContainsAtLeastOneActivityForFeedback = ((Long) rs.get(0).get("totalCountOfIterationsWithSubstringsInActivity")).intValue();
|
|
128 | 136 |
} |
129 | 137 |
break; |
130 | 138 |
case 3: |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/NinetyNinetyRuleDetectorImpl.java | ||
---|---|---|
34 | 34 |
new PositiveInteger(2))); |
35 | 35 |
}}); |
36 | 36 |
|
37 |
private final String sqlFileName = "ninety_ninety_rule.sql"; |
|
37 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
38 |
"set_project_id.sql", |
|
39 |
"select_all_iterations_with_sum_estimated_and_spent_time.sql"); |
|
40 |
|
|
38 | 41 |
// sql queries loaded from sql file |
39 | 42 |
private List<String> sqlQueries; |
40 | 43 |
|
41 | 44 |
private double getMaxDivisionRange() { |
42 |
return (Double) antiPattern.getConfigurations().get("maxDivisionRange").getValue();
|
|
45 |
return ((PositiveFloat) antiPattern.getConfigurations().get("maxDivisionRange").getValue()).doubleValue();
|
|
43 | 46 |
} |
44 | 47 |
|
45 | 48 |
private int getMaxBadDivisionLimit() { |
46 |
return (int) antiPattern.getConfigurations().get("maxBadDivisionLimit").getValue();
|
|
49 |
return ((PositiveInteger) antiPattern.getConfigurations().get("maxBadDivisionLimit").getValue()).intValue();
|
|
47 | 50 |
} |
48 | 51 |
|
49 | 52 |
@Override |
... | ... | |
52 | 55 |
} |
53 | 56 |
|
54 | 57 |
@Override |
55 |
public String getAntiPatternSqlFileName() {
|
|
56 |
return this.sqlFileName;
|
|
58 |
public List<String> getSqlFileNames() {
|
|
59 |
return this.SQL_FILE_NAMES;
|
|
57 | 60 |
} |
58 | 61 |
|
59 | 62 |
@Override |
... | ... | |
63 | 66 |
|
64 | 67 |
/** |
65 | 68 |
* Postup detekce: |
66 |
* 1) pro každou iteraci udělat součet stráveného a odhadovaného času přes všechny aktivity
|
|
67 |
* 2) udělat podíl strávený čas / odhadovaný čas
|
|
68 |
* 3) pokud všechny výsledky podílů budou menší než 1.2 => vše ok
|
|
69 |
* 4) pokud předchozí bod nezabere, tak iterovat přes všechny podíly
|
|
70 |
* 5) pokud budou nalezeny tři iterace po sobě, kde se stále zhoršují odhady => detekováno
|
|
69 |
* 1) pro každou iteraci udělat součet stráveného a odhadovaného času přes všechny aktivity |
|
70 |
* 2) udělat podíl strávený čas / odhadovaný čas |
|
71 |
* 3) pokud všechny výsledky podílů budou menší než 1.2 => vše ok |
|
72 |
* 4) pokud předchozí bod nezabere, tak iterovat přes všechny podíly |
|
73 |
* 5) pokud budou nalezeny tři iterace po sobě, kde se stále zhoršují odhady => detekováno |
|
71 | 74 |
* |
72 | 75 |
* @param project analyzovaný project |
73 | 76 |
* @param databaseConnection databázové připojení |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/RoadToNowhereDetectorImpl.java | ||
---|---|---|
44 | 44 |
}}, |
45 | 45 |
"Road_To_Nowhere.md"); |
46 | 46 |
|
47 |
private final String sqlFileName = "road_to_nowhere.sql"; |
|
47 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
48 |
"set_project_id.sql", |
|
49 |
"set_first_iteration_start_date.sql", |
|
50 |
"set_second_iteration_start_date.sql", |
|
51 |
"set_number_of_activities_with_substrings.sql", |
|
52 |
"set_number_of_wiki_pages_with_substrings.sql", |
|
53 |
"select_number_of_activities_and_wiki_pages_with_substrings.sql"); |
|
54 |
|
|
48 | 55 |
// sql queries loaded from sql file |
49 | 56 |
private List<String> sqlQueries; |
50 | 57 |
|
51 | 58 |
private int getMinNumberOfWikiPagesWithProjectPlan() { |
52 |
return (int) antiPattern.getConfigurations().get("minNumberOfWikiPagesWithProjectPlan").getValue();
|
|
59 |
return ((PositiveInteger) antiPattern.getConfigurations().get("minNumberOfWikiPagesWithProjectPlan").getValue()).intValue();
|
|
53 | 60 |
} |
54 | 61 |
|
55 | 62 |
private int getMinNumberOfActivitiesWithProjectPlan() { |
56 |
return (int) antiPattern.getConfigurations().get("minNumberOfActivitiesWithProjectPlan").getValue();
|
|
63 |
return ((PositiveInteger) antiPattern.getConfigurations().get("minNumberOfActivitiesWithProjectPlan").getValue()).intValue();
|
|
57 | 64 |
} |
58 | 65 |
|
59 | 66 |
private List<String> getSearchSubstringsWithProjectPlan() { |
... | ... | |
66 | 73 |
} |
67 | 74 |
|
68 | 75 |
@Override |
69 |
public String getAntiPatternSqlFileName() {
|
|
70 |
return this.sqlFileName;
|
|
76 |
public List<String> getSqlFileNames() {
|
|
77 |
return this.SQL_FILE_NAMES;
|
|
71 | 78 |
} |
72 | 79 |
|
73 | 80 |
@Override |
... | ... | |
98 | 105 |
Utils.fillQueryWithSearchSubstrings(this.sqlQueries, getSearchSubstringsWithProjectPlan())); |
99 | 106 |
if (rs != null) { |
100 | 107 |
while (rs.next()) { |
101 |
numberOfIssuesForProjectPlan = rs.getInt("numberOfIssuesForProjectPlan");
|
|
102 |
numberOfWikiPagesForProjectPlan = rs.getInt("numberOfWikiPagesForProjectPlan");
|
|
108 |
numberOfIssuesForProjectPlan = rs.getInt("numberOfActivitiesWithSubstrings");
|
|
109 |
numberOfWikiPagesForProjectPlan = rs.getInt("numberOfWikiPagesWithSubstrings");
|
|
103 | 110 |
} |
104 | 111 |
} |
105 | 112 |
|
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/SpecifyNothingDetectorImpl.java | ||
---|---|---|
49 | 49 |
}}, |
50 | 50 |
"Specify_Nothing.md"); |
51 | 51 |
|
52 |
private final String sqlFileName = "specify_nothing.sql"; |
|
52 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
53 |
"set_project_id.sql", |
|
54 |
"set_number_of_wiki_pages_with_substrings.sql", |
|
55 |
"set_number_of_activities_with_substrings.sql", |
|
56 |
"set_average_length_of_activities_description.sql", |
|
57 |
"select_statistics_for_given_project.sql"); |
|
58 |
|
|
53 | 59 |
// sql queries loaded from sql file |
54 | 60 |
private List<String> sqlQueries; |
55 | 61 |
|
56 | 62 |
private int getMinNumberOfWikiPagesWithSpecification() { |
57 |
return (int) antiPattern.getConfigurations().get("minNumberOfWikiPagesWithSpecification").getValue();
|
|
63 |
return ((PositiveInteger) antiPattern.getConfigurations().get("minNumberOfWikiPagesWithSpecification").getValue()).intValue();
|
|
58 | 64 |
} |
59 | 65 |
|
60 | 66 |
private int getMinNumberOfActivitiesWithSpecification() { |
61 |
return (int) antiPattern.getConfigurations().get("minNumberOfActivitiesWithSpecification").getValue();
|
|
67 |
return ((PositiveInteger) antiPattern.getConfigurations().get("minNumberOfActivitiesWithSpecification").getValue()).intValue();
|
|
62 | 68 |
} |
63 | 69 |
|
64 | 70 |
private int getMinAvgLengthOfActivityDescription() { |
65 |
return (int) antiPattern.getConfigurations().get("minAvgLengthOfActivityDescription").getValue();
|
|
71 |
return ((PositiveInteger) antiPattern.getConfigurations().get("minAvgLengthOfActivityDescription").getValue()).intValue();
|
|
66 | 72 |
} |
67 | 73 |
|
68 | 74 |
private List<String> getSearchSubstringsWithProjectSpecification() { |
... | ... | |
75 | 81 |
} |
76 | 82 |
|
77 | 83 |
@Override |
78 |
public String getAntiPatternSqlFileName() {
|
|
79 |
return this.sqlFileName;
|
|
84 |
public List<String> getSqlFileNames() {
|
|
85 |
return this.SQL_FILE_NAMES;
|
|
80 | 86 |
} |
81 | 87 |
|
82 | 88 |
@Override |
... | ... | |
110 | 116 |
Utils.fillQueryWithSearchSubstrings(this.sqlQueries, getSearchSubstringsWithProjectSpecification())); |
111 | 117 |
if (rs != null) { |
112 | 118 |
while (rs.next()) { |
113 |
numberOfWikiPages = rs.getInt("numberOfWikiPages"); |
|
114 |
numberOfActivitiesForSpecification = rs.getInt("numberOfActivitiesForSpecification");
|
|
119 |
numberOfWikiPages = rs.getInt("numberOfWikiPagesWithSubstrings");
|
|
120 |
numberOfActivitiesForSpecification = rs.getInt("numberOfActivitiesWithSubstrings");
|
|
115 | 121 |
averageLengthOfIssueDescription = rs.getDouble("averageLengthOfIssueDescription"); |
116 | 122 |
} |
117 | 123 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/TooLongSprintDetectorImpl.java | ||
---|---|---|
6 | 6 |
import org.slf4j.Logger; |
7 | 7 |
import org.slf4j.LoggerFactory; |
8 | 8 |
|
9 |
import java.util.ArrayList; |
|
10 |
import java.util.HashMap; |
|
11 |
import java.util.List; |
|
12 |
import java.util.Map; |
|
9 |
import java.util.*; |
|
13 | 10 |
|
14 | 11 |
public class TooLongSprintDetectorImpl implements AntiPatternDetector { |
15 | 12 |
|
... | ... | |
37 | 34 |
}} |
38 | 35 |
); |
39 | 36 |
|
40 |
private final String SQL_FILE_NAME = "too_long_sprint.sql"; |
|
37 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
38 |
"set_project_id.sql", |
|
39 |
"set_first_iteration_id.sql", |
|
40 |
"set_last_iteration_id.sql", |
|
41 |
"select_all_iterations_with_lengths_without_first_and_last.sql"); |
|
42 |
|
|
41 | 43 |
// sql queries loaded from sql file |
42 | 44 |
private List<String> sqlQueries; |
43 | 45 |
|
... | ... | |
47 | 49 |
} |
48 | 50 |
|
49 | 51 |
@Override |
50 |
public String getAntiPatternSqlFileName() {
|
|
51 |
return this.SQL_FILE_NAME; |
|
52 |
public List<String> getSqlFileNames() {
|
|
53 |
return this.SQL_FILE_NAMES;
|
|
52 | 54 |
} |
53 | 55 |
|
56 |
|
|
54 | 57 |
@Override |
55 | 58 |
public void setSqlQueries(List<String> queries) { |
56 | 59 |
this.sqlQueries = queries; |
57 | 60 |
} |
58 | 61 |
|
59 | 62 |
private Integer getMaxIterationLength(){ |
60 |
return (Integer) this.antiPattern.getConfigurations().get("maxIterationLength").getValue();
|
|
63 |
return ((PositiveInteger) this.antiPattern.getConfigurations().get("maxIterationLength").getValue()).intValue();
|
|
61 | 64 |
} |
62 | 65 |
|
63 | 66 |
private Integer getMaxNumberOfTooLongIterations(){ |
64 |
return (Integer) this.antiPattern.getConfigurations().get("maxNumberOfTooLongIterations").getValue();
|
|
67 |
return ((PositiveInteger) this.antiPattern.getConfigurations().get("maxNumberOfTooLongIterations").getValue()).intValue();
|
|
65 | 68 |
} |
66 | 69 |
|
67 | 70 |
/** |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/VaryingSprintLengthDetectorImpl.java | ||
---|---|---|
9 | 9 |
import java.sql.ResultSet; |
10 | 10 |
import java.sql.SQLException; |
11 | 11 |
import java.util.ArrayList; |
12 |
import java.util.Arrays; |
|
12 | 13 |
import java.util.HashMap; |
13 | 14 |
import java.util.List; |
14 | 15 |
|
... | ... | |
37 | 38 |
new PositiveInteger(1))); |
38 | 39 |
}}); |
39 | 40 |
|
40 |
private final String sqlFileName = "varying_sprint_length.sql"; |
|
41 |
private final List<String> SQL_FILE_NAMES = Arrays.asList( |
|
42 |
"set_project_id.sql", |
|
43 |
"set_first_iteration_id.sql", |
|
44 |
"set_last_iteration_id.sql", |
|
45 |
"select_all_iterations_with_lengths_without_first_and_last.sql"); |
|
46 |
|
|
41 | 47 |
// sql queries loaded from sql file |
42 | 48 |
private List<String> sqlQueries; |
43 | 49 |
|
44 | 50 |
private Integer getMaxDaysDifference(){ |
45 |
return (Integer) this.antiPattern.getConfigurations().get("maxDaysDifference").getValue();
|
|
51 |
return ((PositiveInteger) this.antiPattern.getConfigurations().get("maxDaysDifference").getValue()).intValue();
|
|
46 | 52 |
} |
47 | 53 |
|
48 | 54 |
private Integer getMaxIterationChanged(){ |
49 |
return (Integer) this.antiPattern.getConfigurations().get("maxIterationChanged").getValue();
|
|
55 |
return ((PositiveInteger) this.antiPattern.getConfigurations().get("maxIterationChanged").getValue()).intValue();
|
|
50 | 56 |
} |
51 | 57 |
|
52 | 58 |
@Override |
... | ... | |
55 | 61 |
} |
56 | 62 |
|
57 | 63 |
@Override |
58 |
public String getAntiPatternSqlFileName() {
|
|
59 |
return this.sqlFileName;
|
|
64 |
public List<String> getSqlFileNames() {
|
|
65 |
return this.SQL_FILE_NAMES;
|
|
60 | 66 |
} |
61 | 67 |
|
62 | 68 |
@Override |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/model/types/PositiveFloat.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
@Override |
18 | 18 |
public int intValue() { |
19 |
return 0;
|
|
19 |
return (int) this.value;
|
|
20 | 20 |
} |
21 | 21 |
|
22 | 22 |
@Override |
23 | 23 |
public long longValue() { |
24 |
return 0;
|
|
24 |
return (long) this.value;
|
|
25 | 25 |
} |
26 | 26 |
|
27 | 27 |
@Override |
28 | 28 |
public float floatValue() { |
29 |
return 0;
|
|
29 |
return this.value;
|
|
30 | 30 |
} |
31 | 31 |
|
32 | 32 |
@Override |
33 | 33 |
public double doubleValue() { |
34 |
return 0;
|
|
34 |
return this.value;
|
|
35 | 35 |
} |
36 | 36 |
|
37 | 37 |
public static PositiveFloat parsePositiveFloat(String value) { |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/model/types/PositiveInteger.java | ||
---|---|---|
17 | 17 |
|
18 | 18 |
@Override |
19 | 19 |
public int intValue() { |
20 |
return 0;
|
|
20 |
return this.value;
|
|
21 | 21 |
} |
22 | 22 |
|
23 | 23 |
@Override |
24 | 24 |
public long longValue() { |
25 |
return 0;
|
|
25 |
return this.value;
|
|
26 | 26 |
} |
27 | 27 |
|
28 | 28 |
@Override |
29 | 29 |
public float floatValue() { |
30 |
return 0;
|
|
30 |
return this.value;
|
|
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
@Override |
34 | 34 |
public double doubleValue() { |
35 |
return 0;
|
|
35 |
return this.value;
|
|
36 | 36 |
} |
37 | 37 |
|
38 | 38 |
public static PositiveInteger parsePositiveInteger(String value) { |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/repository/AntiPatternRepository.java | ||
---|---|---|
18 | 18 |
@Component |
19 | 19 |
public class AntiPatternRepository implements ServletContextAware { |
20 | 20 |
|
21 |
private static final String QUERY_DIR = "/queries/"; |
|
21 | 22 |
private final Logger LOGGER = LoggerFactory.getLogger(AntiPatternRepository.class); |
22 |
|
|
23 | 23 |
private ServletContext servletContext; |
24 | 24 |
private Map<Long, AntiPatternDetector> antiPatternDetectors = init(); |
25 | 25 |
|
26 |
private static final String QUERY_DIR = "/queries/" ; |
|
27 |
|
|
28 | 26 |
private Map<Long, AntiPatternDetector> init() { |
29 | 27 |
LOGGER.info("-------START CREATING DETECTORS WITH REFLECTION-------"); |
30 | 28 |
Map<Long, AntiPatternDetector> antiPatterns = new HashMap<>(); |
... | ... | |
57 | 55 |
this.servletContext = servletContext; |
58 | 56 |
LOGGER.info("-------START READING SQL FROM FILES-------"); |
59 | 57 |
for (AntiPatternDetector antiPatternDetector : getAllAntiPatterns()) { |
60 |
LOGGER.info("Reading sql from file " + antiPatternDetector.getAntiPatternSqlFileName()); |
|
61 |
antiPatternDetector.setSqlQueries(loadSqlFile(antiPatternDetector.getAntiPatternSqlFileName())); |
|
58 |
LOGGER.info("Reading sql files for AP " + antiPatternDetector.getAntiPatternModel().getPrintName()); |
|
59 |
antiPatternDetector.setSqlQueries(loadSqlFile(antiPatternDetector.getSqlFileNames())); |
|
60 |
|
|
62 | 61 |
} |
63 | 62 |
LOGGER.info("-------FINISHED READING SQL FROM FILES-------"); |
64 | 63 |
} |
65 | 64 |
|
66 |
private List<String> loadSqlFile(String fileName) { |
|
65 |
/** |
|
66 |
* Method for loading list of sql files from given list of files |
|
67 |
* @param fileNames list of files with sql queries |
|
68 |
* @return list of queries |
|
69 |
*/ |
|
70 |
private List<String> loadSqlFile(List<String> fileNames) { |
|
67 | 71 |
List<String> queries = new ArrayList<>(); |
68 | 72 |
|
69 |
try { |
|
70 |
URL test = servletContext.getResource(QUERY_DIR + fileName); |
|
71 |
BufferedReader read = new BufferedReader( |
|
72 |
new InputStreamReader(test.openStream())); |
|
73 |
String line; |
|
74 |
while ((line = read.readLine()) != null) { |
|
75 |
if (line.startsWith("select") || line.startsWith("set") && line.charAt(line.length()-1) == ';') { |
|
76 |
queries.add(line); |
|
73 |
// walk through all sql filenames and load all sql queries |
|
74 |
for (String fileName : fileNames) { |
|
75 |
LOGGER.info("Reading sql query from file name " + fileName); |
|
76 |
try { |
|
77 |
URL test = servletContext.getResource(QUERY_DIR + fileName); |
|
78 |
BufferedReader read = new BufferedReader( |
|
79 |
new InputStreamReader(test.openStream())); |
|
80 |
String line; |
|
81 |
while ((line = read.readLine()) != null) { |
|
82 |
if (line.startsWith("select") || line.startsWith("set") && line.charAt(line.length() - 1) == ';') { |
|
83 |
queries.add(line); |
|
84 |
} |
|
77 | 85 |
} |
86 |
read.close(); |
|
87 |
} catch (IOException e) { |
|
88 |
LOGGER.warn("Cannot read sql from file " + fileName, e); |
|
89 |
return queries; |
|
78 | 90 |
} |
79 |
read.close(); |
|
80 |
} catch (IOException e) { |
|
81 |
LOGGER.warn("Cannot read sql from file " + fileName, e); |
|
82 |
return queries; |
|
83 | 91 |
} |
84 | 92 |
return queries; |
85 | 93 |
} |
src/main/webapp/queries/business_as_usual.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Business as usual (No sprint retrospective) |
|
3 |
|
|
4 |
Description: Absence of a retrospective after individual |
|
5 |
iterations or after the completion project. |
|
6 |
|
|
7 |
Detection: There will be no activities in the project |
|
8 |
that would indicate that a retrospective is |
|
9 |
taking place (issue with the name of the |
|
10 |
retrospective, issue on which all team members |
|
11 |
log, issue that is repeated periodically, |
|
12 |
issue to which no commit is bound, issue which |
|
13 |
will be marked as administration or something like that). |
|
14 |
There will be no notes in the wiki or other tool called |
|
15 |
retrospectives (%retr%). |
|
16 |
*/ |
|
17 |
|
|
18 |
/* Init project id */ |
|
19 |
set @projectId = ?; |
|
20 |
/* Number of iterations for given project */ |
|
21 |
select COUNT(id) as 'numberOfIterations' from iteration where superProjectId = @projectId and name like '%itera%'; |
|
22 |
/* Select all iteration with detected retrospective activities */ |
|
23 |
select iterationName as 'iterationName', count(name) as 'numberOfIssues' from workUnitView where projectId = @projectId and (lower(name) like lower('§0§') or lower(name) like lower('§1§') or lower(name) like lower('§2§') or lower(name) like lower('§3§') or lower(name) like lower('§4§') or lower(name) like lower('§5§') or lower(name) like lower('§6§') or lower(name) like lower('§7§') or lower(name) like lower('§8§') or lower(name) like lower('§9§')) group by iterationName; |
|
24 |
/* Select all wikipages that were created or updated in iteration and have name with retr or revi*/ |
|
25 |
select iteration.name as 'iterationName', count(distinct(artifactView.name)) as 'numberOfWikiPages' from artifactView inner join fieldChangeView on artifactView.id = fieldChangeView.itemId inner join iteration on (fieldChangeView.created between iteration.startDate and iteration.endDate) and iteration.superProjectId = @projectId where artifactView.projectId = @projectId and artifactView.artifactClass like 'WIKIPAGE' and (lower(artifactView.name) like lower('§0§') or lower(artifactView.name) like lower('§1§') or lower(artifactView.name) like lower('§2§') or lower(artifactView.name) like lower('§3§') or lower(artifactView.name) like lower('§4§') or lower(artifactView.name) like lower('§5§') or lower(artifactView.name) like lower('§6§') or lower(artifactView.name) like lower('§7§') or lower(artifactView.name) like lower('§8§') or lower(artifactView.name) like lower('§9§')) group by iteration.id order by iteration.name; |
src/main/webapp/queries/long_or_non_existent_feedback_loops.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Long Or Non-Existant Feedback Loops (No Customer feedback) |
|
3 |
|
|
4 |
Description: Long spacings between customer feedback or no feedback. The customer |
|
5 |
enters the project and sees the final result. In the end, the customer |
|
6 |
may not get what he really wanted. With long intervals of feedback, |
|
7 |
some misunderstood functionality can be created and we have to spend |
|
8 |
a lot of effort and time to redo it. |
|
9 |
|
|
10 |
|
|
11 |
Detection: How to choose what is the optimal spacing between feedbacks? In ASWI, |
|
12 |
it was mostly after each iteration, ie 2-3 weeks apart. Check if there |
|
13 |
is an activity that is repeated periodically, all team members or |
|
14 |
leaders log time on it (essentially a similar issue as in the anti-Business |
|
15 |
as usual model). Search for an activity named "DEMO", "CUSTOMER", etc. |
|
16 |
Search for some records from the demo in the wiki. Similar to Business as usual. |
|
17 |
*/ |
|
18 |
|
|
19 |
/* Init project id */ |
|
20 |
set @projectId = ?; |
|
21 |
/* Number of iterations for given project */ |
|
22 |
select COUNT(id) as 'numberOfIterations' from iteration where superProjectId = @projectId; |
|
23 |
/* Average iteration length */ |
|
24 |
select avg(abs(dateDiff(iteration.endDate, iteration.startDate))) as 'averageIterationLength' from iteration where superProjectId = @projectId; |
|
25 |
/* Select number of iterations which contains at least one feedback activity */ |
|
26 |
select count(*) over () as 'totalCountOfIterationsWithFeedbackActivity' from workUnitView as wuv where wuv.projectId = @projectId and (wuv.name like '§0§' or wuv.name like '§1§' or wuv.name like '§2§' or wuv.name like '§3§' or wuv.name like '§4§' or wuv.name like '§5§' or wuv.name like '§6§' or wuv.name like '§7§' or wuv.name like '§8§' or wuv.name like '§9§') group by wuv.iterationName order by wuv.activityEndDate; |
|
27 |
/* Select all activities for feedback loop with last modified date as end date */ |
|
28 |
select wuv.id, wuv.iterationName, wuv.name, cast(max(fieldChangeView.created) as date) as 'endDate' from workUnitView as wuv inner join fieldChangeView on wuv.id = fieldChangeView.itemId where wuv.projectId = @projectId and (wuv.name like '§0§' or wuv.name like '§1§' or wuv.name like '§2§' or wuv.name like '§3§' or wuv.name like '§4§' or wuv.name like '§5§' or wuv.name like '§6§' or wuv.name like '§7§' or wuv.name like '§8§' or wuv.name like '§9§') GROUP by id order by fieldChangeView.created; |
|
29 |
/* Get project start date */ |
|
30 |
select startDate as 'projectStartDate' from iteration where superProjectId = @projectId order by startDate limit 1; |
|
31 |
/* Get project end date */ |
|
32 |
select endDate as 'projectEndDate' from iteration where superProjectId = @projectId order by endDate desc limit 1; |
|
33 |
/* Select all iterations that contains wiki pages which were created or updated in iteration and have name or description that mentions some key words for customer demo*/ |
|
34 |
select iteration.name as 'iterationWithCustomerFeedback', cast(max(fieldChangeView.created) as date) as 'appointmentDate' from artifactView inner join fieldChangeView on artifactView.id = fieldChangeView.itemId inner join iteration on (fieldChangeView.created between iteration.startDate and iteration.endDate) and iteration.superProjectId = @projectId where artifactView.artifactClass like 'WIKIPAGE' and artifactView.projectId = @projectId and length(fieldChangeView.newValue) > length(fieldChangeView.oldValue) and (artifactView.name like '§0§' or artifactView.name like '§1§' or artifactView.name like '§2§' or artifactView.name like '§3§' or artifactView.name like '§4§' or artifactView.name like '§5§' or artifactView.name like '§6§' or artifactView.name like '§7§' or artifactView.name like '§8§' or artifactView.name like '§9§') group by iteration.name order by iteration.name; |
src/main/webapp/queries/ninety_ninety_rule.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Ninety-Ninety Rule |
|
3 |
|
|
4 |
Description: The first 90 percent of the code represents the first 90 percent of development time. The |
|
5 |
remaining 10 percent of the code represents another 90 percent of development time. |
|
6 |
Then decide on a long delay of the project compared to the original estimate. |
|
7 |
The functionality is almost done, some number is already closed and is only waiting |
|
8 |
for one activity to close, but it has been open for a long time. |
|
9 |
|
|
10 |
Detection: Compare the estimated time and time spent in each iteration. If the estimates deteriorate |
|
11 |
continuously during the project, it will be detected. |
|
12 |
|
|
13 |
*/ |
|
14 |
|
|
15 |
/* Init project id */ |
|
16 |
set @projectId = ?; |
|
17 |
/* Select all activities for each iteration and sum estimated time and spent time */ |
|
18 |
select iterationName, sum(estimatedTime) as 'estimatedTime', sum(spentTime) as 'spentTime', sum(spentTime)/sum(estimatedTime) as 'timeDivision', abs(1-(sum(spentTime)/sum(estimatedTime))) as 'deviation' from workUnitView where projectid = @projectId and iterationName is not null group by iterationName order by iterationName; |
src/main/webapp/queries/road_to_nowhere.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Road To Nowhere |
|
3 |
|
|
4 |
Description: The project is not sufficiently planned and therefore |
|
5 |
takes place on an ad hoc basis with an uncertain |
|
6 |
outcome and deadline. There is no project plan in the project. |
|
7 |
|
|
8 |
Detection: There is no activity in ALM that would indicate the creation |
|
9 |
of a project plan. There will be no document in the wiki |
|
10 |
called the "Project Plan". Project plan should be created in first or |
|
11 |
second iteration. Also could be detected with field change view. If is |
|
12 |
a lot of changes on issues in the beginning of the iteration so then could |
|
13 |
indicate some planning. |
|
14 |
*/ |
|
15 |
set @projectId = ?; |
|
16 |
set @firstIterationStartDate = (select startDate from iteration where superProjectId = @projectId ORDER BY startDate LIMIT 1 offset 0); |
|
17 |
set @secondIterationStartDate = (select startDate from iteration where superProjectId = @projectId ORDER BY startDate LIMIT 1 offset 1); |
|
18 |
set @numberOfIssuesForProjectPlan = (SELECT count(*) from workUnitView where projectId = @projectId and (lower(workUnitView.name) like lower('§0§') or lower(workUnitView.description) like lower('§0§') or lower(workUnitView.name) like lower('§1§') or lower(workUnitView.description) like lower('§1§') or lower(workUnitView.name) like lower('§2§') or lower(workUnitView.description) like lower('§2§') or lower(workUnitView.name) like lower('§3§') or lower(workUnitView.description) like lower('§3§') or lower(workUnitView.name) like lower('§4§') or lower(workUnitView.description) like lower('§4§') or lower(workUnitView.name) like lower('§5§') or lower(workUnitView.description) like lower('§5§') or lower(workUnitView.name) like lower('§6§') or lower(workUnitView.description) like lower('§6§') or lower(workUnitView.name) like lower('§7§') or lower(workUnitView.description) like lower('§7§') or lower(workUnitView.name) like lower('§8§') or lower(workUnitView.description) like lower('§8§') or lower(workUnitView.name) like lower('§9§') or lower(workUnitView.description) like lower('§9§')) AND (iterationStartDate = @firstIterationStartDate OR iterationStartDate = @secondIterationStartDate)); |
|
19 |
set @numberOfWikiPagesForProjectPlan = (SELECT count(*) from artifactView where projectId = @projectId AND artifactClass like 'WIKIPAGE' AND (lower(artifactView.name) like lower('§0§') or lower(artifactView.description) like lower('§0§') or lower(artifactView.name) like lower('§1§') or lower(artifactView.description) like lower('§1§') or lower(artifactView.name) like lower('§2§') or lower(artifactView.description) like lower('§2§') or lower(artifactView.name) like lower('§3§') or lower(artifactView.description) like lower('§3§') or lower(artifactView.name) like lower('§4§') or lower(artifactView.description) like lower('§4§') or lower(artifactView.name) like lower('§5§') or lower(artifactView.description) like lower('§5§') or lower(artifactView.name) like lower('§6§') or lower(artifactView.description) like lower('§6§') or lower(artifactView.name) like lower('§7§') or lower(artifactView.description) like lower('§7§') or lower(artifactView.name) like lower('§8§') or lower(artifactView.description) like lower('§8§') or lower(artifactView.name) like lower('§9§') or lower(artifactView.description) like lower('§9§'))); |
|
20 |
select @projectId as `projectId`, @numberOfIssuesForProjectPlan as `numberOfIssuesForProjectPlan`, @numberOfWikiPagesForProjectPlan as `numberOfWikiPagesForProjectPlan`; |
src/main/webapp/queries/select_all_activities_with_substrings_and_last_modified_date_as_end_date.sql | ||
---|---|---|
1 |
/* Select all activities with substrings and with last modified date as end date */ |
|
2 |
select wuv.id, wuv.iterationName, wuv.name, cast(max(fieldChangeView.created) as date) as 'endDate' from workUnitView as wuv inner join fieldChangeView on wuv.id = fieldChangeView.itemId where wuv.projectId = @projectId and (wuv.name like '§0§' or wuv.name like '§1§' or wuv.name like '§2§' or wuv.name like '§3§' or wuv.name like '§4§' or wuv.name like '§5§' or wuv.name like '§6§' or wuv.name like '§7§' or wuv.name like '§8§' or wuv.name like '§9§') GROUP by id order by fieldChangeView.created; |
src/main/webapp/queries/select_all_iterations_that_contains_wikipages_with_substrings.sql | ||
---|---|---|
1 |
/* Select all iterations that contains wiki pages which were created or updated in iteration and have name or description that mentions some key words for customer demo*/ |
|
2 |
select iteration.name as 'iterationWithCustomerFeedback', cast(max(fieldChangeView.created) as date) as 'appointmentDate' from artifactView inner join fieldChangeView on artifactView.id = fieldChangeView.itemId inner join iteration on (fieldChangeView.created between iteration.startDate and iteration.endDate) and iteration.superProjectId = @projectId where artifactView.artifactClass like 'WIKIPAGE' and artifactView.projectId = @projectId and length(fieldChangeView.newValue) > length(fieldChangeView.oldValue) and (artifactView.name like '§0§' or artifactView.name like '§1§' or artifactView.name like '§2§' or artifactView.name like '§3§' or artifactView.name like '§4§' or artifactView.name like '§5§' or artifactView.name like '§6§' or artifactView.name like '§7§' or artifactView.name like '§8§' or artifactView.name like '§9§') group by iteration.name order by iteration.name; |
src/main/webapp/queries/select_all_iterations_with_lengths_without_first_and_last.sql | ||
---|---|---|
1 |
/* !Global variables must be set for proper behavior! Select all iterations with their length without first and last iterations */ |
|
2 |
select datediff(endDate, startDate) as `iterationLength` from iteration where iteration.superProjectId = @projectId and iteration.id != @idOfFirstIteration and iteration.id != @idOfLastIteration order by iteration.name; |
src/main/webapp/queries/select_all_iterations_with_sum_estimated_and_spent_time.sql | ||
---|---|---|
1 |
/* Select all activities for each iteration and sum estimated time and spent time */ |
|
2 |
select iterationName, sum(estimatedTime) as 'estimatedTime', sum(spentTime) as 'spentTime', sum(spentTime)/sum(estimatedTime) as 'timeDivision', abs(1-(sum(spentTime)/sum(estimatedTime))) as 'deviation' from workUnitView where projectid = @projectId and iterationName is not null group by iterationName order by iterationName; |
src/main/webapp/queries/select_all_wikipages_that_is_updated_in_iteration.sql | ||
---|---|---|
1 |
/* Select all wikipages that were created or updated in iteration and have name with retr or revi*/ |
|
2 |
select iteration.name as 'iterationName', count(distinct(artifactView.name)) as 'numberOfWikiPages' from artifactView inner join fieldChangeView on artifactView.id = fieldChangeView.itemId inner join iteration on (fieldChangeView.created between iteration.startDate and iteration.endDate) and iteration.superProjectId = @projectId where artifactView.projectId = @projectId and artifactView.artifactClass like 'WIKIPAGE' and (lower(artifactView.name) like lower('§0§') or lower(artifactView.name) like lower('§1§') or lower(artifactView.name) like lower('§2§') or lower(artifactView.name) like lower('§3§') or lower(artifactView.name) like lower('§4§') or lower(artifactView.name) like lower('§5§') or lower(artifactView.name) like lower('§6§') or lower(artifactView.name) like lower('§7§') or lower(artifactView.name) like lower('§8§') or lower(artifactView.name) like lower('§9§')) group by iteration.id order by iteration.name; |
src/main/webapp/queries/select_average_iterations_length.sql | ||
---|---|---|
1 |
/* Average iteration length */ |
|
2 |
select avg(abs(dateDiff(iteration.endDate, iteration.startDate))) as 'averageIterationLength' from iteration where superProjectId = @projectId; |
src/main/webapp/queries/select_iterations_with_substrings.sql | ||
---|---|---|
1 |
/* Select all iteration with detected retrospective activities */ |
|
2 |
select iterationName as 'iterationName', count(name) as 'numberOfIssues' from workUnitView where projectId = @projectId and (lower(name) like lower('§0§') or lower(name) like lower('§1§') or lower(name) like lower('§2§') or lower(name) like lower('§3§') or lower(name) like lower('§4§') or lower(name) like lower('§5§') or lower(name) like lower('§6§') or lower(name) like lower('§7§') or lower(name) like lower('§8§') or lower(name) like lower('§9§')) group by iterationName; |
src/main/webapp/queries/select_number_of_activities_and_wiki_pages_with_substrings.sql | ||
---|---|---|
1 |
/* !Global variables must be set for proper behavior.! Select number of activities and wiki pages with given substrings and for given projects. */ |
|
2 |
select @projectId as `projectId`, @numberOfActivitiesWithSubstrings as `numberOfActivitiesWithSubstrings`, @numberOfWikiPagesWithSubstrings as `numberOfWikiPagesWithSubstrings`; |
src/main/webapp/queries/select_number_of_iterations.sql | ||
---|---|---|
1 |
/* Number of iterations for given project */ |
|
2 |
select COUNT(id) as 'numberOfIterations' from iteration where superProjectId = @projectId and name like '%itera%'; |
src/main/webapp/queries/select_number_of_iterations_with_substrings_in_activity.sql | ||
---|---|---|
1 |
/* Select number of iterations which with substring in activity */ |
|
2 |
select count(*) over () as 'totalCountOfIterationsWithSubstringsInActivity' from workUnitView as wuv where wuv.projectId = @projectId and (wuv.name like '§0§' or wuv.name like '§1§' or wuv.name like '§2§' or wuv.name like '§3§' or wuv.name like '§4§' or wuv.name like '§5§' or wuv.name like '§6§' or wuv.name like '§7§' or wuv.name like '§8§' or wuv.name like '§9§') group by wuv.iterationName order by wuv.activityEndDate; |
src/main/webapp/queries/select_project_end_date.sql | ||
---|---|---|
1 |
/* Get project end date */ |
|
2 |
select endDate as 'projectEndDate' from iteration where superProjectId = @projectId order by endDate desc limit 1; |
src/main/webapp/queries/select_project_start_date.sql | ||
---|---|---|
1 |
/* Get project start date */ |
|
2 |
select startDate as 'projectStartDate' from iteration where superProjectId = @projectId order by startDate limit 1; |
src/main/webapp/queries/select_statistics_for_given_project.sql | ||
---|---|---|
1 |
/* !Global variables must be set for proper behavior! Show number of wiki pages, number */ |
|
2 |
select @projectId as `projectId`, @numberOfWikiPagesWithSubstrings as `numberOfWikiPagesWithSubstrings`, @numberOfActivitiesWithSubstrings as `numberOfActivitiesWithSubstrings`, @averageLengthOfIssueDescription as `averageLengthOfIssueDescription`; |
src/main/webapp/queries/set_average_length_of_activities_description.sql | ||
---|---|---|
1 |
/* Count average length of issues description */ |
|
2 |
set @averageLengthOfIssueDescription = (select AVG(CHAR_LENGTH(workUnitView.description)) from workUnitView where workUnitView.projectId = @projectId); |
src/main/webapp/queries/set_first_iteration_id.sql | ||
---|---|---|
1 |
/* Id of first iteration */ |
|
2 |
set @idOfFirstIteration = (select id from iteration where iteration.superProjectId = @projectId order by name limit 1); |
src/main/webapp/queries/set_first_iteration_start_date.sql | ||
---|---|---|
1 |
/* set first iteration start date to the global values named @firstIterationStartDate */ |
|
2 |
set @firstIterationStartDate = (select startDate from iteration where superProjectId = @projectId ORDER BY startDate LIMIT 1 offset 0); |
src/main/webapp/queries/set_last_iteration_id.sql | ||
---|---|---|
1 |
/* Id of last iteration */ |
|
2 |
set @idOfLastIteration = (select id from iteration where iteration.superProjectId = @projectId order by name desc limit 1); |
src/main/webapp/queries/set_number_of_activities_with_substrings.sql | ||
---|---|---|
1 |
/* Select number of activities with given substrings and set it to the global value named @numberOfActivitiesWithSubstrings */ |
|
2 |
set @numberOfActivitiesWithSubstrings = (SELECT count(*) from workUnitView where projectId = @projectId and (lower(workUnitView.name) like lower('§0§') or lower(workUnitView.description) like lower('§0§') or lower(workUnitView.name) like lower('§1§') or lower(workUnitView.description) like lower('§1§') or lower(workUnitView.name) like lower('§2§') or lower(workUnitView.description) like lower('§2§') or lower(workUnitView.name) like lower('§3§') or lower(workUnitView.description) like lower('§3§') or lower(workUnitView.name) like lower('§4§') or lower(workUnitView.description) like lower('§4§') or lower(workUnitView.name) like lower('§5§') or lower(workUnitView.description) like lower('§5§') or lower(workUnitView.name) like lower('§6§') or lower(workUnitView.description) like lower('§6§') or lower(workUnitView.name) like lower('§7§') or lower(workUnitView.description) like lower('§7§') or lower(workUnitView.name) like lower('§8§') or lower(workUnitView.description) like lower('§8§') or lower(workUnitView.name) like lower('§9§') or lower(workUnitView.description) like lower('§9§')) AND (iterationStartDate = @firstIterationStartDate OR iterationStartDate = @secondIterationStartDate)); |
src/main/webapp/queries/set_number_of_wiki_pages_with_substrings.sql | ||
---|---|---|
1 |
/* Select number of wiki pages with given substrings and set it to the global value named @numberOfWikiPagesWithSubstrings */ |
|
2 |
set @numberOfWikiPagesWithSubstrings = (SELECT count(*) from artifactView where projectId = @projectId AND artifactClass like 'WIKIPAGE' AND (lower(artifactView.name) like lower('§0§') or lower(artifactView.description) like lower('§0§') or lower(artifactView.name) like lower('§1§') or lower(artifactView.description) like lower('§1§') or lower(artifactView.name) like lower('§2§') or lower(artifactView.description) like lower('§2§') or lower(artifactView.name) like lower('§3§') or lower(artifactView.description) like lower('§3§') or lower(artifactView.name) like lower('§4§') or lower(artifactView.description) like lower('§4§') or lower(artifactView.name) like lower('§5§') or lower(artifactView.description) like lower('§5§') or lower(artifactView.name) like lower('§6§') or lower(artifactView.description) like lower('§6§') or lower(artifactView.name) like lower('§7§') or lower(artifactView.description) like lower('§7§') or lower(artifactView.name) like lower('§8§') or lower(artifactView.description) like lower('§8§') or lower(artifactView.name) like lower('§9§') or lower(artifactView.description) like lower('§9§'))); |
src/main/webapp/queries/set_project_id.sql | ||
---|---|---|
1 |
/* Init project id */ |
|
2 |
set @projectId = ?; |
src/main/webapp/queries/set_second_iteration_start_date.sql | ||
---|---|---|
1 |
/* set second iteration start date to the global values named @firstIterationStartDate */ |
|
2 |
set @secondIterationStartDate = (select startDate from iteration where superProjectId = @projectId ORDER BY startDate LIMIT 1 offset 1); |
src/main/webapp/queries/specify_nothing.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Specify nothing |
|
3 |
|
|
4 |
Description: The specification is not done intentionally. Programmers are |
|
5 |
expected to work better without written specifications. |
|
6 |
|
|
7 |
Detection: No specification artifact. There is no issue that will have something |
|
8 |
like "DSP, SPECIFICATIONS, ETC." in the title. Initially, meetings |
|
9 |
with the customer should be more frequent to clarify the project framework. |
|
10 |
No entry in the wiki with the project specification. |
|
11 |
*/ |
|
12 |
|
|
13 |
/* Init project id */ |
|
14 |
set @projectId = ?; |
|
15 |
/* Find number of wikipages with some project specification */ |
|
16 |
set @numberOfWikiPages = (select count(name) from artifactView where projectId = @projectId and artifactClass = 'WIKIPAGE' and (lower(name) like lower('§0§') or lower(description) like lower('§0§') or lower(name) like lower('§1§') or lower(description) like lower('§1§') or lower(name) like lower('§2§') or lower(description) like lower('§2§') or lower(name) like lower('§3§') or lower(description) like lower('§3§') or lower(name) like lower('§4§') or lower(description) like lower('§4§') or lower(name) like lower('§5§') or lower(description) like lower('§5§') or lower(name) like lower('§6§') or lower(description) like lower('§6§') or lower(name) like lower('§7§') or lower(description) like lower('§7§') or lower(name) like lower('§8§') or lower(description) like lower('§8§') or lower(name) like lower('§9§') or lower(description) like lower('§9§'))); |
|
17 |
/* Find activities for creating DSP or project specification */ |
|
18 |
set @numberOfActivitiesForSpecification = (SELECT count(id) from workUnitView where projectId = @projectId and (lower(name) like lower('§0§') or lower(name) like lower('§1§') or lower(name) like lower('§2§') or lower(name) like lower('§3§') or lower(name) like lower('§4§') or lower(name) like lower('§5§') or lower(name) like lower('§6§') or lower(name) like lower('§7§') or lower(name) like lower('§8§') or lower(name) like lower('§9§'))); |
|
19 |
/* Count average length of issues description */ |
|
20 |
set @averageLengthOfIssueDescription = (select AVG(CHAR_LENGTH(workUnitView.description)) from workUnitView where workUnitView.projectId = @projectId); |
|
21 |
/* Show all statistics */ |
|
22 |
select @projectId as `projectId`, @numberOfWikiPages as `numberOfWikiPages`, @numberOfActivitiesForSpecification as `numberOfActivitiesForSpecification`, @averageLengthOfIssueDescription as `averageLengthOfIssueDescription`; |
src/main/webapp/queries/too_long_sprint.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Too Long Sprint |
|
3 |
|
|
4 |
Description: Iterations too long. (ideal iteration length is about 1-2 weeks, |
|
5 |
maximum 3 weeks). It could also be detected here if the length |
|
6 |
of the iteration does not change often (It can change at the |
|
7 |
beginning and at the end of the project, but it should not |
|
8 |
change in the already started project). |
|
9 |
|
|
10 |
Detection: Detect the beginning and end of the iteration and what is |
|
11 |
the interval between these time points. We should exclude |
|
12 |
the initial and final iterations, as they could skew the result. |
|
13 |
*/ |
|
14 |
|
|
15 |
/* Init project id */ |
|
16 |
set @projectId = ?; |
|
17 |
/* Exclude first and last iteration? */ |
|
18 |
set @excludeFirstAndLastIteration = true; |
|
19 |
/* Id of first iteration */ |
|
20 |
set @idOfFirstIteration = (select id from iteration where iteration.superProjectId = @projectId order by name limit 1); |
|
21 |
/* Id of last iteration */ |
|
22 |
set @idOfLastIteration = (select id from iteration where iteration.superProjectId = @projectId order by name desc limit 1); |
|
23 |
/* Select all iterations with their length */ |
|
24 |
select datediff(endDate, startDate) as `iterationLength` from iteration where iteration.superProjectId = @projectId and iteration.id != if(@excludeFirstAndLastIteration = true, @idOfFirstIteration, -1) and iteration.id != if(@excludeFirstAndLastIteration = true, @idOfLastIteration, -1) order by iteration.name; |
src/main/webapp/queries/varying_sprint_length.sql | ||
---|---|---|
1 |
/* |
|
2 |
Anti-pattern name: Varying Sprint Length |
|
3 |
|
|
4 |
Description: The length of the sprint changes very often. |
|
5 |
It is clear that iterations will be different |
|
6 |
lengths at the beginning and end of the project, |
|
7 |
but the length of the sprint should not change |
|
8 |
during the project. |
|
9 |
|
|
10 |
|
|
11 |
Detection: Detect sprint lengths throughout the project |
|
12 |
and see if they are too different. Possibility to |
|
13 |
eliminate the first and last sprint. It could be |
|
14 |
otherwise long. Detection would be similar to |
|
15 |
Too Long sprint anti-pattern. |
|
16 |
*/ |
|
17 |
|
|
18 |
/* Init project id */ |
|
19 |
set @projectId = ?; |
|
20 |
/* Exclude first and last iteration? */ |
|
21 |
set @excludeFirstAndLastIteration = true; |
|
22 |
/* Id of first iteration */ |
|
23 |
set @idOfFirstIteration = (select id from iteration where iteration.superProjectId = @projectId order by name limit 1); |
|
24 |
/* Id of last iteration */ |
|
25 |
set @idOfLastIteration = (select id from iteration where iteration.superProjectId = @projectId order by name desc limit 1); |
|
26 |
/* Select all iterations with their length */ |
|
27 |
select datediff(endDate, startDate) as `iterationLength` from iteration where iteration.superProjectId = @projectId and iteration.id != if(@excludeFirstAndLastIteration = true, @idOfFirstIteration, -1) and iteration.id != if(@excludeFirstAndLastIteration = true, @idOfLastIteration, -1) order by iteration.name; |
Také k dispozici: Unified diff
#9 Split SQL scripts
- all queries in the files are split into separate queries
- each AP has a list of all the queries it needs to evaluate
- all queries from the file are loaded at application startup
- mineor changes in PositiveNUmber formating
- minor fix