You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

scanner_report.proto 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. // SonarQube, open source software quality management tool.
  2. // Copyright (C) 2008-2016 SonarSource
  3. // mailto:contact AT sonarsource DOT com
  4. //
  5. // SonarQube is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU Lesser General Public
  7. // License as published by the Free Software Foundation; either
  8. // version 3 of the License, or (at your option) any later version.
  9. //
  10. // SonarQube is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. // Lesser General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU Lesser General Public License
  16. // along with this program; if not, write to the Free Software Foundation,
  17. // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. // IMPORTANT
  19. // This is beta version of specification. It will evolve during next
  20. // releases and is not forward-compatible yet.
  21. syntax = "proto3";
  22. import "constants.proto";
  23. option java_package = "org.sonar.scanner.protocol.output";
  24. option optimize_for = SPEED;
  25. message Metadata {
  26. int64 analysis_date = 1;
  27. string organization_key = 2;
  28. // TODO should we keep this project_key here or not ? Because it's a duplication of Component.key
  29. string project_key = 3;
  30. // maps the property sonar.branch
  31. string deprecated_branch = 4;
  32. int32 root_component_ref = 5;
  33. bool cross_project_duplication_activated = 6;
  34. map<string, QProfile> qprofiles_per_language = 7;
  35. map<string, Plugin> plugins_by_key = 8;
  36. string branch_name = 9;
  37. BranchType branch_type = 10;
  38. string merge_branch_name = 11;
  39. string relative_path_from_scm_root = 12;
  40. string scm_revision_id = 13;
  41. string pull_request_key = 14;
  42. map<string, string> modules_project_relative_path_by_key = 15;
  43. string projectVersion = 16;
  44. string buildString = 17;
  45. message QProfile {
  46. string key = 1;
  47. string name = 2;
  48. string language = 3;
  49. int64 rulesUpdatedAt = 4;
  50. }
  51. message Plugin {
  52. string key = 1;
  53. int64 updatedAt = 2;
  54. }
  55. enum BranchType {
  56. UNSET = 0;
  57. LONG = 1;
  58. SHORT = 2;
  59. PULL_REQUEST = 3;
  60. }
  61. }
  62. message ContextProperty {
  63. string key = 1;
  64. string value = 2;
  65. }
  66. message ActiveRule {
  67. string rule_repository = 1;
  68. string rule_key = 2;
  69. Severity severity = 3;
  70. map<string,string> params_by_key = 4;
  71. int64 createdAt = 5;
  72. int64 updatedAt = 6;
  73. string q_profile_key = 7;
  74. }
  75. message ComponentLink {
  76. ComponentLinkType type = 1;
  77. string href = 2;
  78. enum ComponentLinkType {
  79. UNSET = 0;
  80. HOME = 1;
  81. SCM = 2;
  82. // SCM_DEV is no more set since 7.1. See SONAR-10299
  83. IGNORED_SCM_DEV = 3;
  84. ISSUE = 4;
  85. CI = 5;
  86. }
  87. }
  88. message Component {
  89. int32 ref = 1;
  90. string name = 3;
  91. ComponentType type = 4;
  92. bool is_test = 5;
  93. string language = 6;
  94. repeated int32 child_ref = 7 [packed = true];
  95. repeated ComponentLink link = 8;
  96. // Only available on PROJECT and MODULE types
  97. // TODO rename this property -> moduleKey ?
  98. string key = 10;
  99. // Only available on FILE type, should always be at least 1
  100. int32 lines = 11;
  101. // Only available on PROJECT and MODULE types
  102. string description = 12;
  103. FileStatus status = 13;
  104. // Path relative to project base directory
  105. string project_relative_path = 14;
  106. enum ComponentType {
  107. UNSET = 0;
  108. PROJECT = 1;
  109. MODULE = 2 [deprecated=true];
  110. DIRECTORY = 3 [deprecated=true];
  111. FILE = 4;
  112. }
  113. enum FileStatus {
  114. UNAVAILABLE = 0;
  115. SAME = 1;
  116. CHANGED = 2;
  117. ADDED = 3;
  118. }
  119. }
  120. message Measure {
  121. string metric_key = 1;
  122. oneof value {
  123. BoolValue boolean_value = 2;
  124. IntValue int_value = 3;
  125. LongValue long_value = 4;
  126. DoubleValue double_value = 5;
  127. StringValue string_value = 6;
  128. }
  129. message BoolValue {
  130. bool value = 1;
  131. string data = 2;
  132. }
  133. message IntValue {
  134. int32 value = 1;
  135. string data = 2;
  136. }
  137. message LongValue {
  138. int64 value = 1;
  139. string data = 2;
  140. }
  141. message DoubleValue {
  142. double value = 1;
  143. string data = 2;
  144. }
  145. message StringValue {
  146. string value = 1;
  147. }
  148. }
  149. message Issue {
  150. string rule_repository = 1;
  151. string rule_key = 2;
  152. // Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
  153. string msg = 3;
  154. Severity severity = 4;
  155. double gap = 5;
  156. // Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
  157. // Will be identical to the first location of the first flow
  158. TextRange text_range = 6;
  159. repeated Flow flow = 7;
  160. }
  161. message ExternalIssue {
  162. string engine_id = 1;
  163. string rule_id = 2;
  164. string msg = 3;
  165. Severity severity = 4;
  166. int64 effort = 5;
  167. TextRange text_range = 6;
  168. repeated Flow flow = 7;
  169. IssueType type = 8;
  170. }
  171. message AdHocRule {
  172. string engine_id = 1;
  173. string rule_id = 2;
  174. string name = 3;
  175. string description = 4;
  176. Severity severity = 5;
  177. IssueType type = 6;
  178. }
  179. enum IssueType {
  180. UNSET = 0;
  181. CODE_SMELL = 1;
  182. BUG = 2;
  183. VULNERABILITY = 3;
  184. SECURITY_HOTSPOT = 4;
  185. }
  186. message IssueLocation {
  187. int32 component_ref = 1;
  188. // Only when component is a file. Can be empty for a file if this is an issue global to the file.
  189. TextRange text_range = 2;
  190. string msg = 3;
  191. }
  192. message Flow {
  193. repeated IssueLocation location = 1;
  194. }
  195. message Changesets {
  196. int32 component_ref = 1;
  197. // If set to true then it means changeset attribute is empty and compute engine should copy data from previous analysis
  198. bool copy_from_previous = 2;
  199. repeated Changeset changeset = 3;
  200. // if changesetIndexByLine[5] = 2 then it means that changeset[2] is the last one on line 6
  201. repeated int32 changesetIndexByLine = 4 [packed = true];
  202. message Changeset {
  203. string revision = 1;
  204. string author = 2;
  205. int64 date = 3;
  206. }
  207. }
  208. message Duplicate {
  209. // Will be 0 when duplicate is in the same file
  210. int32 other_file_ref = 1;
  211. // Only start_line and end_line are provided since we dont support "precise" duplication location.
  212. TextRange range = 2;
  213. }
  214. message Duplication {
  215. // Origin position in current file. Only start_line and end_line are provided since we dont support "precise" duplication location.
  216. TextRange origin_position = 1;
  217. repeated Duplicate duplicate = 2;
  218. }
  219. // Used for cross project duplication
  220. message CpdTextBlock {
  221. string hash = 1;
  222. int32 start_line = 2;
  223. int32 end_line = 3;
  224. int32 start_token_index = 4;
  225. int32 end_token_index = 5;
  226. }
  227. // Lines start at 1 and line offsets start at 0
  228. message TextRange {
  229. int32 start_line = 1;
  230. // End line (inclusive)
  231. int32 end_line = 2;
  232. int32 start_offset = 3;
  233. int32 end_offset = 4;
  234. }
  235. message LineSgnificantCode {
  236. int32 line = 1;
  237. int32 start_offset = 2;
  238. int32 end_offset = 3;
  239. }
  240. message ChangedLines {
  241. repeated int32 line = 1;
  242. }
  243. message Symbol {
  244. TextRange declaration = 1;
  245. repeated TextRange reference = 2;
  246. }
  247. // Only FILE component has coverage information, and only executable lines should contains this information.
  248. message LineCoverage {
  249. int32 line = 1;
  250. // Number of conditions to cover (if set, the value must be greater than 0)
  251. int32 conditions = 2;
  252. // Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
  253. oneof has_hits {
  254. bool hits = 3;
  255. }
  256. // Number of conditions covered by tests
  257. oneof has_covered_conditions {
  258. int32 covered_conditions = 5;
  259. }
  260. }
  261. // Must be sorted by line and start offset
  262. message SyntaxHighlightingRule {
  263. TextRange range = 1;
  264. HighlightingType type = 2;
  265. enum HighlightingType {
  266. UNSET = 0;
  267. ANNOTATION = 1;
  268. CONSTANT = 2;
  269. COMMENT = 3;
  270. CPP_DOC = 4;
  271. STRUCTURED_COMMENT = 5;
  272. KEYWORD = 6;
  273. HIGHLIGHTING_STRING = 7;
  274. KEYWORD_LIGHT = 8;
  275. PREPROCESS_DIRECTIVE = 9;
  276. }
  277. }
  278. message AnalysisWarning {
  279. string text = 1;
  280. int64 timestamp = 2;
  281. }