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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. reserved 2; // organization drop
  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. reserved 4; // deprecated_branch (legacy branches feature)
  31. int32 root_component_ref = 5;
  32. bool cross_project_duplication_activated = 6;
  33. map<string, QProfile> qprofiles_per_language = 7;
  34. map<string, Plugin> plugins_by_key = 8;
  35. string branch_name = 9;
  36. BranchType branch_type = 10;
  37. string reference_branch_name = 11;
  38. string relative_path_from_scm_root = 12;
  39. string scm_revision_id = 13;
  40. string pull_request_key = 14;
  41. map<string, string> modules_project_relative_path_by_key = 15;
  42. string projectVersion = 16;
  43. string buildString = 17;
  44. string target_branch_name = 18;
  45. int64 forkDate = 19;
  46. map<string, int32> not_analyzed_files_by_language = 20;
  47. message QProfile {
  48. string key = 1;
  49. string name = 2;
  50. string language = 3;
  51. int64 rulesUpdatedAt = 4;
  52. }
  53. message Plugin {
  54. string key = 1;
  55. int64 updatedAt = 2;
  56. }
  57. enum BranchType {
  58. UNSET = 0;
  59. BRANCH = 1;
  60. PULL_REQUEST = 2;
  61. }
  62. }
  63. message ContextProperty {
  64. string key = 1;
  65. string value = 2;
  66. }
  67. message ActiveRule {
  68. string rule_repository = 1;
  69. string rule_key = 2;
  70. Severity severity = 3;
  71. map<string,string> params_by_key = 4;
  72. int64 createdAt = 5;
  73. int64 updatedAt = 6;
  74. string q_profile_key = 7;
  75. }
  76. message ComponentLink {
  77. ComponentLinkType type = 1;
  78. string href = 2;
  79. enum ComponentLinkType {
  80. UNSET = 0;
  81. HOME = 1;
  82. SCM = 2;
  83. // SCM_DEV is no more set since 7.1. See SONAR-10299
  84. IGNORED_SCM_DEV = 3;
  85. ISSUE = 4;
  86. CI = 5;
  87. }
  88. }
  89. message Component {
  90. int32 ref = 1;
  91. string name = 3;
  92. ComponentType type = 4;
  93. bool is_test = 5;
  94. string language = 6;
  95. repeated int32 child_ref = 7 [packed = true];
  96. repeated ComponentLink link = 8;
  97. // Only available on PROJECT and MODULE types
  98. // TODO rename this property -> moduleKey ?
  99. string key = 10;
  100. // Only available on FILE type, should always be at least 1
  101. int32 lines = 11;
  102. // Only available on PROJECT and MODULE types
  103. string description = 12;
  104. FileStatus status = 13;
  105. // Path relative to project base directory
  106. string project_relative_path = 14;
  107. enum ComponentType {
  108. UNSET = 0;
  109. PROJECT = 1;
  110. MODULE = 2 [deprecated=true];
  111. DIRECTORY = 3 [deprecated=true];
  112. FILE = 4;
  113. }
  114. enum FileStatus {
  115. UNAVAILABLE = 0;
  116. SAME = 1;
  117. CHANGED = 2;
  118. ADDED = 3;
  119. }
  120. }
  121. message Measure {
  122. string metric_key = 1;
  123. oneof value {
  124. BoolValue boolean_value = 2;
  125. IntValue int_value = 3;
  126. LongValue long_value = 4;
  127. DoubleValue double_value = 5;
  128. StringValue string_value = 6;
  129. }
  130. message BoolValue {
  131. bool value = 1;
  132. string data = 2;
  133. }
  134. message IntValue {
  135. int32 value = 1;
  136. string data = 2;
  137. }
  138. message LongValue {
  139. int64 value = 1;
  140. string data = 2;
  141. }
  142. message DoubleValue {
  143. double value = 1;
  144. string data = 2;
  145. }
  146. message StringValue {
  147. string value = 1;
  148. }
  149. }
  150. message Issue {
  151. string rule_repository = 1;
  152. string rule_key = 2;
  153. // Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
  154. string msg = 3;
  155. Severity severity = 4;
  156. double gap = 5;
  157. // Only when issue component is a file. Can also be empty for a file if this is an issue global to the file.
  158. // Will be identical to the first location of the first flow
  159. TextRange text_range = 6;
  160. repeated Flow flow = 7;
  161. }
  162. message ExternalIssue {
  163. string engine_id = 1;
  164. string rule_id = 2;
  165. string msg = 3;
  166. Severity severity = 4;
  167. int64 effort = 5;
  168. TextRange text_range = 6;
  169. repeated Flow flow = 7;
  170. IssueType type = 8;
  171. }
  172. message AdHocRule {
  173. string engine_id = 1;
  174. string rule_id = 2;
  175. string name = 3;
  176. string description = 4;
  177. Severity severity = 5;
  178. IssueType type = 6;
  179. }
  180. enum IssueType {
  181. UNSET = 0;
  182. CODE_SMELL = 1;
  183. BUG = 2;
  184. VULNERABILITY = 3;
  185. SECURITY_HOTSPOT = 4;
  186. }
  187. message IssueLocation {
  188. int32 component_ref = 1;
  189. // Only when component is a file. Can be empty for a file if this is an issue global to the file.
  190. TextRange text_range = 2;
  191. string msg = 3;
  192. }
  193. message Flow {
  194. repeated IssueLocation location = 1;
  195. }
  196. message Changesets {
  197. int32 component_ref = 1;
  198. // If set to true then it means changeset attribute is empty and compute engine should copy data from previous analysis
  199. bool copy_from_previous = 2;
  200. repeated Changeset changeset = 3;
  201. // if changesetIndexByLine[5] = 2 then it means that changeset[2] is the last one on line 6
  202. repeated int32 changesetIndexByLine = 4 [packed = true];
  203. message Changeset {
  204. string revision = 1;
  205. string author = 2;
  206. int64 date = 3;
  207. }
  208. }
  209. message Duplicate {
  210. // Will be 0 when duplicate is in the same file
  211. int32 other_file_ref = 1;
  212. // Only start_line and end_line are provided since we dont support "precise" duplication location.
  213. TextRange range = 2;
  214. }
  215. message Duplication {
  216. // Origin position in current file. Only start_line and end_line are provided since we dont support "precise" duplication location.
  217. TextRange origin_position = 1;
  218. repeated Duplicate duplicate = 2;
  219. }
  220. // Used for cross project duplication
  221. message CpdTextBlock {
  222. string hash = 1;
  223. int32 start_line = 2;
  224. int32 end_line = 3;
  225. int32 start_token_index = 4;
  226. int32 end_token_index = 5;
  227. }
  228. // Lines start at 1 and line offsets start at 0
  229. message TextRange {
  230. int32 start_line = 1;
  231. // End line (inclusive)
  232. int32 end_line = 2;
  233. int32 start_offset = 3;
  234. int32 end_offset = 4;
  235. }
  236. message LineSgnificantCode {
  237. int32 line = 1;
  238. int32 start_offset = 2;
  239. int32 end_offset = 3;
  240. }
  241. message ChangedLines {
  242. repeated int32 line = 1;
  243. }
  244. message Symbol {
  245. TextRange declaration = 1;
  246. repeated TextRange reference = 2;
  247. }
  248. // Only FILE component has coverage information, and only executable lines should contains this information.
  249. message LineCoverage {
  250. int32 line = 1;
  251. // Number of conditions to cover (if set, the value must be greater than 0)
  252. int32 conditions = 2;
  253. // Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
  254. oneof has_hits {
  255. bool hits = 3;
  256. }
  257. // Number of conditions covered by tests
  258. oneof has_covered_conditions {
  259. int32 covered_conditions = 5;
  260. }
  261. }
  262. // Must be sorted by line and start offset
  263. message SyntaxHighlightingRule {
  264. TextRange range = 1;
  265. HighlightingType type = 2;
  266. enum HighlightingType {
  267. UNSET = 0;
  268. ANNOTATION = 1;
  269. CONSTANT = 2;
  270. COMMENT = 3;
  271. CPP_DOC = 4;
  272. STRUCTURED_COMMENT = 5;
  273. KEYWORD = 6;
  274. HIGHLIGHTING_STRING = 7;
  275. KEYWORD_LIGHT = 8;
  276. PREPROCESS_DIRECTIVE = 9;
  277. }
  278. }
  279. message AnalysisWarning {
  280. string text = 1;
  281. int64 timestamp = 2;
  282. }