Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_code_inspector.clas.abap class zcl_abapgit_code_inspector { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'ZCL_ABAPGIT_CODE_INSPECTOR'; static IMPLEMENTED_INTERFACES = ["ZIF_ABAPGIT_CODE_INSPECTOR"]; static ATTRIBUTES = {"GT_CODE_INSPECTOR": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"HASHED","isUnique":true,"keyFields":["PACKAGE"]},"secondary":[]}, "zcl_abapgit_code_inspector=>ty_code_inspector_packs");}, "visibility": "I", "is_constant": " ", "is_class": "X"}, "MV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "visibility": "O", "is_constant": " ", "is_class": " "}, "MV_SUCCESS": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "MV_SUMMARY": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "MO_INSPECTION": {"type": () => {return (() => { throw new Error("Void type: cl_ci_inspection") })();}, "visibility": "I", "is_constant": " ", "is_class": " "}, "MV_NAME": {"type": () => {return (() => { throw new Error("Void type: SCI_OBJS") })();}, "visibility": "I", "is_constant": " ", "is_class": " "}, "MV_RUN_MODE": {"type": () => {return new abap.types.Character(1, {});}, "visibility": "I", "is_constant": " ", "is_class": " "}, "CO_RUN_MODE": {"type": () => {return new abap.types.Structure({ "run_with_popup": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_after_popup": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_via_rfc": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_in_batch": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_loc_parallel": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_direct": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"})}, undefined, undefined, {}, {});}, "visibility": "I", "is_constant": "X", "is_class": "X"}}; static METHODS = {"CREATE_OBJECTSET": {"visibility": "I", "parameters": {"RO_SET": {"type": () => {return (() => { throw new Error("Void type: cl_ci_objectset") })();}, "is_optional": " "}}}, "RUN_INSPECTION": {"visibility": "I", "parameters": {"RT_LIST": {"type": () => {return (() => { throw new Error("Void type: SCIT_ALVLIST") })();}, "is_optional": " "}, "IO_INSPECTION": {"type": () => {return (() => { throw new Error("Void type: cl_ci_inspection") })();}, "is_optional": " "}}}, "CREATE_INSPECTION": {"visibility": "I", "parameters": {"RO_INSPECTION": {"type": () => {return (() => { throw new Error("Void type: cl_ci_inspection") })();}, "is_optional": " "}, "IO_SET": {"type": () => {return (() => { throw new Error("Void type: cl_ci_objectset") })();}, "is_optional": " "}, "IO_VARIANT": {"type": () => {return (() => { throw new Error("Void type: cl_ci_checkvariant") })();}, "is_optional": " "}}}, "DECIDE_RUN_MODE": {"visibility": "I", "parameters": {"RV_RUN_MODE": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"});}, "is_optional": " "}}}, "FILTER_INSPECTION": {"visibility": "I", "parameters": {"CT_LIST": {"type": () => {return (() => { throw new Error("Void type: SCIT_ALVLIST") })();}, "is_optional": " "}}}, "CREATE_VARIANT": {"visibility": "O", "parameters": {"RO_VARIANT": {"type": () => {return (() => { throw new Error("Void type: cl_ci_checkvariant") })();}, "is_optional": " "}, "IV_VARIANT": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"SCI_CHKV","ddicName":"SCI_CHKV","description":"SCI_CHKV"});}, "is_optional": " "}}}, "CLEANUP": {"visibility": "O", "parameters": {"IO_SET": {"type": () => {return (() => { throw new Error("Void type: cl_ci_objectset") })();}, "is_optional": " "}}}, "SKIP_OBJECT": {"visibility": "O", "parameters": {"RV_SKIP": {"type": () => {return new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"});}, "is_optional": " "}, "IS_OBJ": {"type": () => {return (() => { throw new Error("Void type: SCIR_OBJS") })();}, "is_optional": " "}}}, "CONSTRUCTOR": {"visibility": "U", "parameters": {"IV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}}}, "GET_CODE_INSPECTOR": {"visibility": "U", "parameters": {"RI_CODE_INSPECTOR": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"});}, "is_optional": " "}, "IV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}}}, "SET_CODE_INSPECTOR": {"visibility": "U", "parameters": {"IV_PACKAGE": {"type": () => {return new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"});}, "is_optional": " "}, "II_CODE_INSPECTOR": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"});}, "is_optional": " "}}}}; #gt_code_inspector; #mv_success; #mv_summary; #mo_inspection; #mv_name; #mv_run_mode; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "create_objectset": this.#create_objectset.bind(this), "run_inspection": this.#run_inspection.bind(this), "create_inspection": this.#create_inspection.bind(this), "decide_run_mode": this.#decide_run_mode.bind(this), "filter_inspection": this.#filter_inspection.bind(this), "create_variant": this.create_variant.bind(this), "cleanup": this.cleanup.bind(this), "skip_object": this.skip_object.bind(this), }; this.gt_code_inspector = zcl_abapgit_code_inspector.gt_code_inspector; this.mv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}); this.#mv_success = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); this.FRIENDS_ACCESS_INSTANCE["mv_success"] = this.#mv_success; this.#mv_summary = new abap.types.String({qualifiedName: "STRING"}); this.FRIENDS_ACCESS_INSTANCE["mv_summary"] = this.#mv_summary; this.#mo_inspection = (() => { throw new Error("Void type: cl_ci_inspection") })(); this.FRIENDS_ACCESS_INSTANCE["mo_inspection"] = this.#mo_inspection; this.#mv_name = (() => { throw new Error("Void type: SCI_OBJS") })(); this.FRIENDS_ACCESS_INSTANCE["mv_name"] = this.#mv_name; this.#mv_run_mode = new abap.types.Character(1, {}); this.FRIENDS_ACCESS_INSTANCE["mv_run_mode"] = this.#mv_run_mode; this.co_run_mode = zcl_abapgit_code_inspector.co_run_mode; } async cleanup(INPUT) { let io_set = INPUT?.io_set; if (io_set === undefined) { io_set = (() => { throw new Error("Void type: cl_ci_objectset") })().set(INPUT.io_set); } if (abap.compare.initial(this.#mo_inspection) === false) { try { await this.#mo_inspection.get().delete(); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "LOCKED": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_IN_ENQUEUE": abap.builtin.sy.get().subrc.set(2); break; case "NOT_AUTHORIZED": abap.builtin.sy.get().subrc.set(3); break; case "EXCEPTN_APPL_EXISTS": abap.builtin.sy.get().subrc.set(4); break; default: abap.builtin.sy.get().subrc.set(5); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Couldn't delete inspection. Subrc = ${abap.templateFormatting(abap.builtin.sy.get().subrc)}`)}); } } try { await io_set.get().delete(); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "EXISTS_IN_INSP": abap.builtin.sy.get().subrc.set(1); break; case "LOCKED": abap.builtin.sy.get().subrc.set(2); break; case "ERROR_IN_ENQUEUE": abap.builtin.sy.get().subrc.set(3); break; case "NOT_AUTHORIZED": abap.builtin.sy.get().subrc.set(4); break; case "EXISTS_IN_OBJS": abap.builtin.sy.get().subrc.set(5); break; default: abap.builtin.sy.get().subrc.set(6); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Couldn't delete objectset. Subrc = ${abap.templateFormatting(abap.builtin.sy.get().subrc)}`)}); } } async constructor_(INPUT) { let iv_package = INPUT?.iv_package; if (iv_package?.getQualifiedName === undefined || iv_package.getQualifiedName() !== "DEVCLASS") { iv_package = undefined; } if (iv_package === undefined) { iv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_package); } if (abap.compare.initial(iv_package)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Please supply package`)}); } this.mv_package.set(iv_package); this.#mv_name.set(new abap.types.String().set(`${abap.templateFormatting(abap.builtin.sy.get().uname)}_${abap.templateFormatting(abap.builtin.sy.get().datum)}_${abap.templateFormatting(abap.builtin.sy.get().uzeit)}`)); this.#mv_run_mode.set((await this.#decide_run_mode())); return this; } async #create_inspection(INPUT) { let ro_inspection = (() => { throw new Error("Void type: cl_ci_inspection") })(); let io_set = INPUT?.io_set; if (io_set === undefined) { io_set = (() => { throw new Error("Void type: cl_ci_objectset") })().set(INPUT.io_set); } let io_variant = INPUT?.io_variant; if (io_variant === undefined) { io_variant = (() => { throw new Error("Void type: cl_ci_checkvariant") })().set(INPUT.io_variant); } try { ro_inspection.set(await abap.Classes['CL_CI_INSPECTION'].create({p_user: abap.builtin.sy.get().uname, p_name: this.#mv_name})); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "LOCKED": abap.builtin.sy.get().subrc.set(1); break; case "ERROR_IN_ENQUEUE": abap.builtin.sy.get().subrc.set(2); break; case "NOT_AUTHORIZED": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Failed to create inspection. Subrc = ${abap.templateFormatting(abap.builtin.sy.get().subrc)}`)}); } await ro_inspection.get().set({p_chkv: io_variant, p_objs: io_set}); try { await ro_inspection.get().save(); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "MISSING_INFORMATION": abap.builtin.sy.get().subrc.set(1); break; case "INSP_NO_NAME": abap.builtin.sy.get().subrc.set(2); break; case "NOT_ENQUEUED": abap.builtin.sy.get().subrc.set(3); break; default: abap.builtin.sy.get().subrc.set(4); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Failed to save inspection. Subrc = ${abap.templateFormatting(abap.builtin.sy.get().subrc)}`)}); } return ro_inspection; } async #create_objectset() { let ro_set = (() => { throw new Error("Void type: cl_ci_objectset") })(); let lt_objs = (() => { throw new Error("Void type: SCIT_OBJS") })(); let ls_obj = (() => { throw new Error("Void type: SCIR_OBJS") })(); let lt_objs_check = (() => { throw new Error("Void type: SCIT_OBJS") })(); let ls_item = new abap.types.Structure({ "obj_type": new abap.types.Character(4, {}), "obj_name": new abap.types.Character(40, {}), "devclass": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "srcsystem": new abap.types.Character(5, {}), "origlang": new abap.types.Character(1, {}), "inactive": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}), "abap_language_version": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_aff_types_v1=>ty_abap_language_version"})}, "zif_abapgit_definitions=>ty_item", undefined, {}, {}); let lt_packages = abap.types.TableFactory.construct(new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_sap_package=>ty_devclass_tt"); lt_packages.set((await (await abap.Classes['ZCL_ABAPGIT_FACTORY'].get_sap_package({iv_package: this.mv_package})).get().zif_abapgit_sap_package$list_subpackages())); abap.statements.insertInternal({data: this.mv_package, table: lt_packages}); if (lt_packages.array().length === 0) { throw new Error("FAE, todo, empty table"); } else { const unique247 = lt_packages.array(); lt_objs.clear(); for await (const unique246 of unique247) { await abap.statements.select(lt_objs, {select: "SELECT \"object\"AS objtype , \"obj_name\"AS objname FROM " + abap.buildDbTableName("tadir") + " WHERE \"devclass\" = '" + unique246.get() + "' AND \"delflag\" = '" + abap.builtin.abap_false.get() + "' AND \"pgmid\" = 'R3TR'", primaryKey: ["pgmid","object","obj_name"]}, {appending: true}); } if (!(lt_objs instanceof abap.types.HashedTable) && lt_objs.getOptions()?.primaryKey?.type !== "SORTED") { abap.statements.sort(lt_objs, {by: ["pgmid","object","obj_name"].map(k => { return {component: k}; })}); await abap.statements.deleteInternal(lt_objs, {adjacent: true, by: ["pgmid","object","obj_name"]}); } abap.builtin.sy.get().dbcnt.set(lt_objs.getArrayLength()); } for await (const unique248 of abap.statements.loop(lt_objs)) { ls_obj.set(unique248); if (abap.compare.eq((await this.skip_object({is_obj: ls_obj})), abap.builtin.abap_true)) { continue; } ls_item.get().obj_type.set(ls_obj.get().objtype); ls_item.get().obj_name.set(ls_obj.get().objname); if (abap.compare.eq((await abap.Classes['ZCL_ABAPGIT_OBJECTS'].exists({is_item: ls_item})), abap.builtin.abap_false)) { continue; } abap.statements.insertInternal({data: ls_obj, table: lt_objs_check}); } ro_set.set((await abap.Classes['CL_CI_OBJECTSET'].save_from_list({p_name: this.#mv_name, p_objects: lt_objs_check}))); return ro_set; } async create_variant(INPUT) { let ro_variant = (() => { throw new Error("Void type: cl_ci_checkvariant") })(); let iv_variant = INPUT?.iv_variant; if (iv_variant?.getQualifiedName === undefined || iv_variant.getQualifiedName() !== "SCI_CHKV") { iv_variant = undefined; } if (iv_variant === undefined) { iv_variant = new abap.types.Character(30, {"qualifiedName":"SCI_CHKV","ddicName":"SCI_CHKV","description":"SCI_CHKV"}).set(INPUT.iv_variant); } if (abap.compare.initial(iv_variant)) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`No check variant supplied.`)}); } try { ro_variant.set(await abap.Classes['CL_CI_CHECKVARIANT'].get_ref({p_user: abap.CharacterFactory.get(1, ''), p_name: iv_variant})); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CHKV_NOT_EXISTS": abap.builtin.sy.get().subrc.set(1); break; case "MISSING_PARAMETER": abap.builtin.sy.get().subrc.set(2); break; default: abap.builtin.sy.get().subrc.set(3); break; } } else { throw e; } } let unique249 = abap.builtin.sy.get().subrc; if (abap.compare.eq(unique249, abap.IntegerFactory.get(1))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Check variant ${abap.templateFormatting(iv_variant)} doesn't exist`)}); } else if (abap.compare.eq(unique249, abap.IntegerFactory.get(2))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Parameter missing for check variant ${abap.templateFormatting(iv_variant)}`)}); } return ro_variant; } async #decide_run_mode() { let rv_run_mode = new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}); let lo_settings = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_SETTINGS", RTTIName: "\\CLASS=ZCL_ABAPGIT_SETTINGS"}); lo_settings.set((await (await abap.Classes['ZCL_ABAPGIT_PERSIST_FACTORY'].get_settings()).get().zif_abapgit_persist_settings$read())); if (abap.compare.eq(abap.builtin.sy.get().batch, abap.builtin.abap_true)) { rv_run_mode.set(zcl_abapgit_code_inspector.co_run_mode.get().run_via_rfc); } else if (abap.compare.eq((await lo_settings.get().get_parallel_proc_disabled()), abap.builtin.abap_false)) { rv_run_mode.set(zcl_abapgit_code_inspector.co_run_mode.get().run_loc_parallel); } else { rv_run_mode.set(zcl_abapgit_code_inspector.co_run_mode.get().run_via_rfc); } return rv_run_mode; } async #filter_inspection(INPUT) { let ct_list = (() => { throw new Error("Void type: SCIT_ALVLIST") })(); if (INPUT && INPUT.ct_list) {ct_list = INPUT.ct_list;} await abap.statements.deleteInternal(ct_list,{where: async (I) => {return abap.compare.eq(I.sobjtype, abap.CharacterFactory.get(4, 'PROG')) && abap.compare.cp(I.sobjname, abap.CharacterFactory.get(6, 'LSVIM*'));}}); } async get_code_inspector(INPUT) { return zcl_abapgit_code_inspector.get_code_inspector(INPUT); } static async get_code_inspector(INPUT) { let ri_code_inspector = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"}); let iv_package = INPUT?.iv_package; if (iv_package?.getQualifiedName === undefined || iv_package.getQualifiedName() !== "DEVCLASS") { iv_package = undefined; } if (iv_package === undefined) { iv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_package); } let ls_code_inspector = new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {}); let fs_ls_code_inspector_ = new abap.types.FieldSymbol(new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {})); abap.statements.readTable(zcl_abapgit_code_inspector.gt_code_inspector,{withTableKey: true, assigning: fs_ls_code_inspector_, withKey: (i) => {return abap.compare.eq(i.package, iv_package);}, withKeyValue: [{key: (i) => {return i.package}, value: iv_package}], usesTableLine: false, withKeySimple: {"package": iv_package}}); if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { ls_code_inspector.get().package.set(iv_package); ls_code_inspector.get().instance.set(await (new abap.Classes['ZCL_ABAPGIT_CODE_INSPECTOR']()).constructor_({iv_package: iv_package})); abap.statements.insertInternal({data: ls_code_inspector, assigning: fs_ls_code_inspector_, table: zcl_abapgit_code_inspector.gt_code_inspector}); } ri_code_inspector.set(fs_ls_code_inspector_.get().instance); return ri_code_inspector; } async #run_inspection(INPUT) { let rt_list = (() => { throw new Error("Void type: SCIT_ALVLIST") })(); let io_inspection = INPUT?.io_inspection; if (io_inspection === undefined) { io_inspection = (() => { throw new Error("Void type: cl_ci_inspection") })().set(INPUT.io_inspection); } try { await io_inspection.get().run({p_howtorun: this.#mv_run_mode}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "INVALID_CHECK_VERSION": abap.builtin.sy.get().subrc.set(1); break; default: abap.builtin.sy.get().subrc.set(2); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`Code inspector run failed. Subrc = ${abap.templateFormatting(abap.builtin.sy.get().subrc)}`)}); } await io_inspection.get().plain_list({p_list: rt_list}); await this.#filter_inspection({ct_list: rt_list}); abap.statements.sort(rt_list,{by: [{component: "objtype"},{component: "objname"},{component: "test"},{component: "code"},{component: "sobjtype"},{component: "sobjname"},{component: "line"},{component: "col"}]}); await abap.statements.deleteInternal(rt_list,{adjacent: true}); return rt_list; } async set_code_inspector(INPUT) { return zcl_abapgit_code_inspector.set_code_inspector(INPUT); } static async set_code_inspector(INPUT) { let iv_package = INPUT?.iv_package; if (iv_package?.getQualifiedName === undefined || iv_package.getQualifiedName() !== "DEVCLASS") { iv_package = undefined; } if (iv_package === undefined) { iv_package = new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}).set(INPUT.iv_package); } let ii_code_inspector = INPUT?.ii_code_inspector; if (ii_code_inspector?.getQualifiedName === undefined || ii_code_inspector.getQualifiedName() !== "ZIF_ABAPGIT_CODE_INSPECTOR") { ii_code_inspector = undefined; } if (ii_code_inspector === undefined) { ii_code_inspector = new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"}).set(INPUT.ii_code_inspector); } let ls_code_inspector = new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {}); let fs_ls_code_inspector_ = new abap.types.FieldSymbol(new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {})); abap.statements.readTable(zcl_abapgit_code_inspector.gt_code_inspector,{withTableKey: true, assigning: fs_ls_code_inspector_, withKey: (i) => {return abap.compare.eq(i.package, iv_package);}, withKeyValue: [{key: (i) => {return i.package}, value: iv_package}], usesTableLine: false, withKeySimple: {"package": iv_package}}); if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { ls_code_inspector.get().package.set(iv_package); abap.statements.insertInternal({data: ls_code_inspector, assigning: fs_ls_code_inspector_, table: zcl_abapgit_code_inspector.gt_code_inspector}); } fs_ls_code_inspector_.get().instance.set(ii_code_inspector); } async skip_object(INPUT) { let rv_skip = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); let is_obj = INPUT?.is_obj; if (is_obj === undefined) { is_obj = (() => { throw new Error("Void type: SCIR_OBJS") })().set(INPUT.is_obj); } let ls_program_type = (() => { throw new Error("Void type: SUBC") })(); let unique250 = is_obj.get().objtype; if (abap.compare.eq(unique250, abap.CharacterFactory.get(4, 'PROG'))) { await abap.statements.select(ls_program_type, {select: "SELECT subc FROM " + abap.buildDbTableName("trdir") + " WHERE \"name\" = '" + is_obj.get().objname.get() + "' UP TO 1 ROWS"}); rv_skip.set(abap.builtin.boolc(abap.compare.eq(ls_program_type, abap.CharacterFactory.get(1, 'I')))); } else { rv_skip.set(abap.builtin.abap_false); } return rv_skip; } async zif_abapgit_code_inspector$get_summary() { let rv_summary = new abap.types.String({qualifiedName: "STRING"}); rv_summary.set(this.#mv_summary); return rv_summary; } async zif_abapgit_code_inspector$is_successful() { let rv_success = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); rv_success.set(this.#mv_success); return rv_success; } async zif_abapgit_code_inspector$list_global_variants() { let rt_list = abap.types.TableFactory.construct(new abap.types.Structure({ "name": new abap.types.Character(30, {"qualifiedName":"SCI_CHKV","ddicName":"SCI_CHKV","description":"SCI_CHKV"}), "description": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR=>TY_VARIANT-DESCRIPTION"})}, "zif_abapgit_code_inspector=>ty_variant", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_code_inspector=>ty_variants"); await abap.statements.select(rt_list, {select: "SELECT \"scichkv_hd\".\"checkvname\"AS name , \"scichkv_tx\".\"text\"AS description FROM " + abap.buildDbTableName("scichkv_hd") + " LEFT OUTER JOIN " + abap.buildDbTableName("scichkv_tx") + " ON \"scichkv_hd\".\"checkvid\" = scichkv_tx~checkvid AND \"scichkv_hd\".\"ciuser\" = scichkv_tx~ciuser AND \"scichkv_tx\".\"language\" = '" + abap.builtin.sy.get().langu.get() + "' WHERE \"scichkv_hd\".\"ciuser\" = '" + abap.builtin.space.get() + "' ORDER BY \"name\""}); return rt_list; } async zif_abapgit_code_inspector$run(INPUT) { let rt_list = abap.types.TableFactory.construct(new abap.types.Structure({ "objtype": new abap.types.Character(4, {}), "objname": new abap.types.Character(40, {}), "sobjtype": new abap.types.Character(4, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-sobjtype"}), "sobjname": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-sobjname"}), "kind": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-kind"}), "line": new abap.types.Numc({length: 6, qualifiedName: "zif_abapgit_code_inspector=>ty_result-line"}), "col": new abap.types.Numc({length: 4, qualifiedName: "zif_abapgit_code_inspector=>ty_result-col"}), "code": new abap.types.Character(10, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-code"}), "test": new abap.types.Character(30, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-test"}), "text": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR=>TY_RESULT-TEXT"}), "param1": new abap.types.Character(80, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param1"}), "param2": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param2"}), "param3": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param3"}), "param4": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param4"}), "detail": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR=>TY_RESULT-DETAIL"}), "author": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-author"})}, "zif_abapgit_code_inspector=>ty_result", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zif_abapgit_code_inspector=>ty_results"); let iv_variant = INPUT?.iv_variant; if (iv_variant?.getQualifiedName === undefined || iv_variant.getQualifiedName() !== "SCI_CHKV") { iv_variant = undefined; } if (iv_variant === undefined) { iv_variant = new abap.types.Character(30, {"qualifiedName":"SCI_CHKV","ddicName":"SCI_CHKV","description":"SCI_CHKV"}).set(INPUT.iv_variant); } let iv_save = new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}); if (INPUT && INPUT.iv_save) {iv_save.set(INPUT.iv_save);} if (INPUT === undefined || INPUT.iv_save === undefined) {iv_save = abap.builtin.abap_false;} let lo_set = (() => { throw new Error("Void type: cl_ci_objectset") })(); let lo_variant = (() => { throw new Error("Void type: cl_ci_checkvariant") })(); let lv_count = new abap.types.Integer({qualifiedName: "I"}); let lt_list = (() => { throw new Error("Void type: SCIT_ALVLIST") })(); let ls_list = (() => { throw new Error("Void type: SCIT_ALVLIST") })(); let ls_result = new abap.types.Structure({ "objtype": new abap.types.Character(4, {}), "objname": new abap.types.Character(40, {}), "sobjtype": new abap.types.Character(4, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-sobjtype"}), "sobjname": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-sobjname"}), "kind": new abap.types.Character(1, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-kind"}), "line": new abap.types.Numc({length: 6, qualifiedName: "zif_abapgit_code_inspector=>ty_result-line"}), "col": new abap.types.Numc({length: 4, qualifiedName: "zif_abapgit_code_inspector=>ty_result-col"}), "code": new abap.types.Character(10, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-code"}), "test": new abap.types.Character(30, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-test"}), "text": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR=>TY_RESULT-TEXT"}), "param1": new abap.types.Character(80, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param1"}), "param2": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param2"}), "param3": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param3"}), "param4": new abap.types.Character(20, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-param4"}), "detail": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR=>TY_RESULT-DETAIL"}), "author": new abap.types.Character(12, {"qualifiedName":"zif_abapgit_code_inspector=>ty_result-author"})}, "zif_abapgit_code_inspector=>ty_result", undefined, {}, {}); let lo_timer = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_TIMER", RTTIName: "\\CLASS=ZCL_ABAPGIT_TIMER"}); let lx_error = new abap.types.ABAPObject({qualifiedName: "ZCX_ABAPGIT_EXCEPTION", RTTIName: "\\CLASS=ZCX_ABAPGIT_EXCEPTION"}); try { lo_set.set((await this.#create_objectset())); lv_count.set(abap.builtin.lines({val: lo_set.get().iobjlst.get().objects})); if (abap.compare.eq(lv_count, abap.IntegerFactory.get(0))) { return rt_list; } lo_timer.set((await (await abap.Classes['ZCL_ABAPGIT_TIMER'].create({iv_count: lv_count})).get().start())); lo_variant.set((await this.create_variant({iv_variant: iv_variant}))); this.#mo_inspection.set((await this.#create_inspection({io_set: lo_set, io_variant: lo_variant}))); lt_list.set((await this.#run_inspection({io_inspection: this.#mo_inspection}))); await this.cleanup({io_set: lo_set}); for await (const unique251 of abap.statements.loop(lt_list)) { ls_list.set(unique251); abap.statements.moveCorresponding(ls_list, ls_result); abap.statements.insertInternal({data: ls_result, table: rt_list}); } if (abap.compare.eq(iv_save, abap.builtin.abap_true)) { abap.statements.readTable(rt_list,{withKey: (i) => {return abap.compare.eq(i.kind, abap.CharacterFactory.get(1, 'E'));}, withKeyValue: [{key: (i) => {return i.kind}, value: abap.CharacterFactory.get(1, 'E')}], usesTableLine: false, withKeySimple: {"kind": abap.CharacterFactory.get(1, 'E')}}); this.#mv_success.set(abap.builtin.boolc(abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0)))); } } catch (e) { if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) { lx_error.set(e); await this.cleanup({io_set: lo_set}); await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise_with_text({ix_previous: lx_error}); } else { throw e; } } this.#mv_summary.set((await lo_timer.get().end())); return rt_list; } async zif_abapgit_code_inspector$validate_check_variant(INPUT) { let iv_check_variant_name = INPUT?.iv_check_variant_name; if (iv_check_variant_name?.getQualifiedName === undefined || iv_check_variant_name.getQualifiedName() !== "SCI_CHKV") { iv_check_variant_name = undefined; } if (iv_check_variant_name === undefined) { iv_check_variant_name = new abap.types.Character(30, {"qualifiedName":"SCI_CHKV","ddicName":"SCI_CHKV","description":"SCI_CHKV"}).set(INPUT.iv_check_variant_name); } try { await abap.Classes['CL_CI_CHECKVARIANT'].get_ref({p_user: abap.CharacterFactory.get(1, ''), p_name: iv_check_variant_name}); abap.builtin.sy.get().subrc.set(0); } catch (e) { if (e.classic) { switch (e.classic.toUpperCase()) { case "CHKV_NOT_EXISTS": abap.builtin.sy.get().subrc.set(1); break; case "MISSING_PARAMETER": abap.builtin.sy.get().subrc.set(2); break; default: abap.builtin.sy.get().subrc.set(3); break; } } else { throw e; } } if (abap.compare.ne(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0))) { await abap.Classes['ZCX_ABAPGIT_EXCEPTION'].raise({iv_text: new abap.types.String().set(`No valid check variant ${abap.templateFormatting(iv_check_variant_name)}`)}); } } } abap.Classes['ZCL_ABAPGIT_CODE_INSPECTOR'] = zcl_abapgit_code_inspector; zcl_abapgit_code_inspector.gt_code_inspector = abap.types.TableFactory.construct(new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"HASHED","isUnique":true,"keyFields":["PACKAGE"]},"secondary":[]}, "zcl_abapgit_code_inspector=>ty_code_inspector_packs"); zcl_abapgit_code_inspector.co_run_mode = new abap.types.Structure({ "run_with_popup": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_after_popup": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_via_rfc": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_in_batch": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_loc_parallel": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}), "run_direct": new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"})}, undefined, undefined, {}, {}); zcl_abapgit_code_inspector.co_run_mode.get().run_with_popup.set('P'); zcl_abapgit_code_inspector.co_run_mode.get().run_after_popup.set('A'); zcl_abapgit_code_inspector.co_run_mode.get().run_via_rfc.set('R'); zcl_abapgit_code_inspector.co_run_mode.get().run_in_batch.set('B'); zcl_abapgit_code_inspector.co_run_mode.get().run_loc_parallel.set('L'); zcl_abapgit_code_inspector.co_run_mode.get().run_direct.set('L'); zcl_abapgit_code_inspector.ty_code_inspector_pack = new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {}); zcl_abapgit_code_inspector.ty_code_inspector_packs = abap.types.TableFactory.construct(new abap.types.Structure({ "package": new abap.types.Character(30, {"qualifiedName":"DEVCLASS","ddicName":"DEVCLASS","description":"DEVCLASS"}), "instance": new abap.types.ABAPObject({qualifiedName: "ZIF_ABAPGIT_CODE_INSPECTOR", RTTIName: "\\INTERFACE=ZIF_ABAPGIT_CODE_INSPECTOR"})}, "zcl_abapgit_code_inspector=>ty_code_inspector_pack", undefined, {}, {}), {"withHeader":false,"keyType":"USER","primaryKey":{"name":"primary_key","type":"HASHED","isUnique":true,"keyFields":["PACKAGE"]},"secondary":[]}, "zcl_abapgit_code_inspector=>ty_code_inspector_packs"); zcl_abapgit_code_inspector.ty_run_mode = new abap.types.Character(1, {"qualifiedName":"zcl_abapgit_code_inspector=>ty_run_mode"}); export {zcl_abapgit_code_inspector}; |