1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
(function() {
define(['jquery.mockjax'], function() {
jQuery.mockjaxSettings.contentType = 'text/json';
jQuery.mockjaxSettings.responseTime = 250;
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/app",
responseText: JSON.stringify({
qualityprofiles: [
{
key: 'sonarway',
name: 'Sonar Way',
parent: null
}, {
key: 'qualityprofile1',
name: 'Quality Profile 1',
parent: 'sonarway'
}, {
key: 'qualityprofile2',
name: 'Quality Profile 2',
parent: 'sonarway'
}, {
key: 'qualityprofile3',
name: 'Quality Profile 3',
parent: null
}
],
languages: {
java: 'Java',
javascript: 'JavaScript'
},
repositories: {
'checkstyle': 'Checkstyle',
'common-java': 'Common SonarQube',
'findbugs': 'FindBugs',
'pmd': 'PMD',
'pmd-unit-tests': 'PMD Unit Tests',
'squid': 'SonarQube'
},
statuses: {
'BETA': 'Beta',
'DEPRECATED': 'Deprecated',
'READY': 'Ready'
},
tags: {
'brain-overload': 'brain-overload',
'bug': 'bug',
'comment': 'comment',
'convention': 'convention',
'error-handling': 'error-handling',
'formatting': 'formatting',
'java8': 'java8',
'multithreading': 'multithreading',
'naming': 'naming',
'pitfall': 'pitfall',
'security': 'security',
'size': 'size',
'unused': 'unused',
'unused-code': 'unused-code'
},
messages: {
'all': 'All',
'any': 'Any',
'apply': 'Apply',
'bulk_change': 'Bulk Change',
'cancel': 'Cancel',
'change': 'Change',
'delete': 'Delete',
'done': 'Done',
'edit': 'Edit',
'moreCriteria': '+ More Criteria',
'search_verb': 'Search',
'severity': 'Severity',
'update': 'Update',
'severity.BLOCKER': 'Blocker',
'severity.CRITICAL': 'Critical',
'severity.MAJOR': 'Major',
'severity.MINOR': 'Minor',
'severity.INFO': 'Info',
'coding_rules.activate': 'Activate',
'coding_rules.activate_quality_profile': 'Activate Quality Profile',
'coding_rules.add_note': 'Add Note',
'coding_rules.available_since': 'Available Since',
'coding_rules.bulk_change': 'Bulk Change',
'coding_rules.extend_description': 'Extend Description',
'coding_rules.deactivate_quality_profile': 'Deactivate',
'coding_rules.found': 'Found',
'coding_rules.inherits': 'Inherits',
'coding_rules.key': 'Key:',
'coding_rules.new_search': 'New Search',
'coding_rules.no_results': 'No Coding Rules',
'coding_rules.order': 'Order',
'coding_rules.ordered_by': 'Ordered By',
'coding_rules.original': 'Original:',
'coding_rules.page': 'Coding Rules',
'coding_rules.parameters': 'Parameters',
'coding_rules.parameters.default_value': 'Default Value:',
'coding_rules.quality_profiles': 'Quality Profiles',
'coding_rules.quality_profile': 'Quality Profile',
'coding_rules.repository': 'Repository:',
'coding_rules.revert_to_parent_definition': 'Revert to Parent Definition',
'coding_rules._rules': 'rule(s)',
'coding_rules.select_tag': 'Select Tag',
'coding_rules.filters.availableSince': 'Available Since',
'coding_rules.filters.description': 'Description',
'coding_rules.filters.in_quality_profile': 'In Quality Profile',
'coding_rules.filters.inheritance': 'Inheritance',
'coding_rules.filters.inheritance.inactive': 'Inheritance criteria is available when an inherited quality profile is selected',
'coding_rules.filters.inheritance.any': 'Any',
'coding_rules.filters.inheritance.not_inherited': 'Not Inherited',
'coding_rules.filters.inheritance.inherited': 'Inherited',
'coding_rules.filters.inheritance.overriden': 'Overriden',
'coding_rules.filters.key': 'Key',
'coding_rules.filters.language': 'Language',
'coding_rules.filters.name': 'Name',
'coding_rules.filters.out_of_quality_profile': 'Out of Quality Profile',
'coding_rules.filters.repository': 'Repository',
'coding_rules.filters.severity': 'Severity',
'coding_rules.filters.status': 'Status',
'coding_rules.filters.tag': 'Tag',
'coding_rules.sort.creation_date': 'Creation Date',
'coding_rules.sort.name': 'Name'
}
})
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/search",
responseText: JSON.stringify({
codingrules: [
{
name: 'Array designators "[]" should be located after the type in method signatures',
language: 'Java',
severity: 'MAJOR',
status: 'DEPRECATED'
}, {
name: 'Avoid Array Loops',
language: 'Java',
severity: 'CRITICAL',
status: 'READY'
}, {
name: 'Bad practice - Abstract class defines covariant compareTo() method',
language: 'Java',
severity: 'MAJOR',
status: 'READY'
}, {
name: 'Correctness - Use of class without a hashCode() method in a hashed data structure',
language: 'Java',
severity: 'MINOR',
status: 'BETA'
}, {
name: 'Useless Operation On Immutable',
language: 'Java',
severity: 'MAJOR',
status: 'READY'
}
],
paging: {
total: 5,
fTotal: '5'
}
})
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/show",
responseText: JSON.stringify({
codingrule: {
name: 'Array designators "[]" should be located after the type in method signatures',
language: 'Java',
tags: ['bug', 'comment', 'java8'],
creationDate: '2013-10-15',
fCreationDate: 'Oct 15, 2013',
status: 'DEPRECATED',
repository: 'squid',
key: 'S1190',
parameters: [
{
key: 'someParameter',
type: 'INT',
"default": 4,
description: 'Some parameter description'
}, {
key: 'boolParameter',
type: 'BOOL',
description: 'Bool parameter description'
}
],
description: '<p>\nAccording to the Java Language Specification:\n</p>\n\n<pre>For compatibility with older versions of the Java SE platform,\nthe declaration of a method that returns an array is allowed to place (some or all of)\nthe empty bracket pairs that form the declaration of the array type after\nthe formal parameter list. This obsolescent syntax should not be used in new code.\n</pre>\n\n<p>The following code snippet illustrates this rule:</p>\n\n<pre>public int getVector()[] { /* ... */ } // Non-Compliant\n\npublic int[] getVector() { /* ... */ } // Compliant\n\npublic int[] getMatrix()[] { /* ... */ } // Non-Compliant\n\npublic int[][] getMatrix() { /* ... */ } // Compliant\n</pre>',
extra: '<p>This note is here <b>only for test purposes</b>.</p>',
extraRaw: 'This note is here *only for test purposes*.',
qualityProfiles: [
{
name: 'SonarWay',
key: 'sonarway',
severity: 'MINOR',
canDeactivate: true,
canUpdate: true,
parameters: [
{
key: 'someParameter',
value: 8
}
]
}, {
name: 'Quality Profile 1',
key: 'qualityprofile1',
severity: 'MAJOR',
canDeactivate: false,
canUpdate: false,
parameters: [
{
key: 'someParameter',
value: 6
}
],
inherits: 'sonarway',
note: {
username: 'Admin Admin',
html: '<p>This note is here <b>only for test purposes</b>.</p>',
raw: 'This note is here *only for test purposes*.',
fCreationDate: 'less than a minute'
}
}
]
}
})
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/extend_description",
responseText: JSON.stringify({
extra: '<p>This note is here <i>only for test purposes</i>.</p>',
extraRaw: 'This note is here *only for test purposes*.'
})
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/bulk_change"
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/set_tags"
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/activate"
});
jQuery.mockjax({
url: "" + baseUrl + "/api/codingrules/note",
responseText: JSON.stringify({
note: {
username: 'Admin Admin',
html: '<p>This note is here <b>only for test purposes</b>.</p>',
raw: 'This note is here *only for test purposes*.',
fCreationDate: 'less than a minute'
}
})
});
jQuery.mockjax({
url: "" + baseUrl + "/api/qualityprofiles/list",
responseText: JSON.stringify({
more: false,
results: [
{
id: 'sonarway',
text: 'Sonar Way',
parent: null
}, {
id: 'qp1',
text: 'Quality Profile 1',
parent: 'sonarway'
}, {
id: 'qp2',
text: 'Quality Profile 2',
parent: 'sonarway'
}, {
id: 'qp3',
text: 'Quality Profile 3',
parent: null
}
]
})
});
return jQuery.mockjax({
url: "" + baseUrl + "/api/qualityprofiles/show",
responseText: JSON.stringify({
qualityprofile: {
id: 'sonarway',
text: 'Sonar Way',
parent: null
}
})
});
});
}).call(this);
|