@abaplint/cli 2.120.73 → 2.120.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +2895 -397
- package/package.json +2 -2
package/build/cli.js
CHANGED
|
@@ -1875,6 +1875,9 @@ const Tokens = __importStar(__webpack_require__(/*! ../1_lexer/tokens */ "../cor
|
|
|
1875
1875
|
const nodes_1 = __webpack_require__(/*! ../nodes */ "../core/build/src/abap/nodes/index.js");
|
|
1876
1876
|
const version_1 = __webpack_require__(/*! ../../version */ "../core/build/src/version.js");
|
|
1877
1877
|
const result_1 = __webpack_require__(/*! ./result */ "../core/build/src/abap/2_statements/result.js");
|
|
1878
|
+
// shared result for "nothing matched", frozen so accidental mutation throws instead of leaking between calls.
|
|
1879
|
+
// Returned arrays are never mutated by callers, which allows returning shared/input arrays as is
|
|
1880
|
+
const EMPTY = Object.freeze([]);
|
|
1878
1881
|
class Regex {
|
|
1879
1882
|
constructor(r) {
|
|
1880
1883
|
this.regexp = r;
|
|
@@ -1886,17 +1889,23 @@ class Regex {
|
|
|
1886
1889
|
return [];
|
|
1887
1890
|
}
|
|
1888
1891
|
run(r) {
|
|
1889
|
-
|
|
1892
|
+
let result = undefined;
|
|
1890
1893
|
for (const input of r) {
|
|
1891
1894
|
if (input.remainingLength() === 0) {
|
|
1892
1895
|
continue;
|
|
1893
1896
|
}
|
|
1894
1897
|
const token = input.peek();
|
|
1895
1898
|
if (this.regexp.test(token.getStr()) === true) {
|
|
1896
|
-
|
|
1899
|
+
const shifted = input.shift(new nodes_1.TokenNodeRegex(token));
|
|
1900
|
+
if (result === undefined) {
|
|
1901
|
+
result = [shifted];
|
|
1902
|
+
}
|
|
1903
|
+
else {
|
|
1904
|
+
result.push(shifted);
|
|
1905
|
+
}
|
|
1897
1906
|
}
|
|
1898
1907
|
}
|
|
1899
|
-
return result;
|
|
1908
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
1900
1909
|
}
|
|
1901
1910
|
railroad() {
|
|
1902
1911
|
return "Railroad.Terminal(\"" + this.regexp.source.replace(/\\/g, "\\\\").replace(/"/g, "\\\"") + "\")";
|
|
@@ -1919,15 +1928,20 @@ class Word {
|
|
|
1919
1928
|
return [];
|
|
1920
1929
|
}
|
|
1921
1930
|
run(r) {
|
|
1922
|
-
|
|
1931
|
+
let result = undefined;
|
|
1923
1932
|
for (const input of r) {
|
|
1924
1933
|
if (input.remainingLength() !== 0
|
|
1925
1934
|
&& input.peek().getUpperStr() === this.s) {
|
|
1926
|
-
|
|
1927
|
-
result
|
|
1935
|
+
const shifted = input.shift(new nodes_1.TokenNode(input.peek()));
|
|
1936
|
+
if (result === undefined) {
|
|
1937
|
+
result = [shifted];
|
|
1938
|
+
}
|
|
1939
|
+
else {
|
|
1940
|
+
result.push(shifted);
|
|
1941
|
+
}
|
|
1928
1942
|
}
|
|
1929
1943
|
}
|
|
1930
|
-
return result;
|
|
1944
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
1931
1945
|
}
|
|
1932
1946
|
railroad() {
|
|
1933
1947
|
return "Railroad.Terminal('\"" + this.s + "\"')";
|
|
@@ -1951,14 +1965,20 @@ class Token {
|
|
|
1951
1965
|
return [];
|
|
1952
1966
|
}
|
|
1953
1967
|
run(r) {
|
|
1954
|
-
|
|
1968
|
+
let result = undefined;
|
|
1955
1969
|
for (const input of r) {
|
|
1956
1970
|
if (input.remainingLength() !== 0
|
|
1957
1971
|
&& input.peek().constructor === this.tokenType) {
|
|
1958
|
-
|
|
1972
|
+
const shifted = input.shift(new nodes_1.TokenNode(input.peek()));
|
|
1973
|
+
if (result === undefined) {
|
|
1974
|
+
result = [shifted];
|
|
1975
|
+
}
|
|
1976
|
+
else {
|
|
1977
|
+
result.push(shifted);
|
|
1978
|
+
}
|
|
1959
1979
|
}
|
|
1960
1980
|
}
|
|
1961
|
-
return result;
|
|
1981
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
1962
1982
|
}
|
|
1963
1983
|
railroad() {
|
|
1964
1984
|
let text = this.name;
|
|
@@ -1996,9 +2016,9 @@ class Vers {
|
|
|
1996
2016
|
if (this.also === AlsoIn.OpenABAP) {
|
|
1997
2017
|
return this.runnable.run(r);
|
|
1998
2018
|
}
|
|
1999
|
-
return (0, version_1.releaseAtLeast)(version_1.Release.v702, this.release) ? this.runnable.run(r) :
|
|
2019
|
+
return (0, version_1.releaseAtLeast)(version_1.Release.v702, this.release) ? this.runnable.run(r) : EMPTY;
|
|
2000
2020
|
}
|
|
2001
|
-
return (0, version_1.releaseAtLeast)(Combi.getRelease(), this.release) ? this.runnable.run(r) :
|
|
2021
|
+
return (0, version_1.releaseAtLeast)(Combi.getRelease(), this.release) ? this.runnable.run(r) : EMPTY;
|
|
2002
2022
|
}
|
|
2003
2023
|
getUsing() {
|
|
2004
2024
|
return this.runnable.getUsing();
|
|
@@ -2046,7 +2066,7 @@ class LangVers {
|
|
|
2046
2066
|
return this.runnable.run(r);
|
|
2047
2067
|
}
|
|
2048
2068
|
else {
|
|
2049
|
-
return
|
|
2069
|
+
return EMPTY;
|
|
2050
2070
|
}
|
|
2051
2071
|
}
|
|
2052
2072
|
railroad() {
|
|
@@ -2079,7 +2099,7 @@ class LangVersNot {
|
|
|
2079
2099
|
return this.runnable.run(r);
|
|
2080
2100
|
}
|
|
2081
2101
|
else {
|
|
2082
|
-
return
|
|
2102
|
+
return EMPTY;
|
|
2083
2103
|
}
|
|
2084
2104
|
}
|
|
2085
2105
|
railroad() {
|
|
@@ -2107,6 +2127,22 @@ class OptionalPriority {
|
|
|
2107
2127
|
return this.optional.getUsing();
|
|
2108
2128
|
}
|
|
2109
2129
|
run(r) {
|
|
2130
|
+
if (r.length === 1) {
|
|
2131
|
+
// single input, pass and return the input array without wrapping
|
|
2132
|
+
const res = this.optional.run(r);
|
|
2133
|
+
if (res.length > 1) {
|
|
2134
|
+
return res;
|
|
2135
|
+
}
|
|
2136
|
+
else if (res.length === 0) {
|
|
2137
|
+
return r;
|
|
2138
|
+
}
|
|
2139
|
+
else if (res[0].remainingLength() < r[0].remainingLength()) {
|
|
2140
|
+
return res;
|
|
2141
|
+
}
|
|
2142
|
+
else {
|
|
2143
|
+
return r;
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2110
2146
|
const result = [];
|
|
2111
2147
|
for (const input of r) {
|
|
2112
2148
|
const res = this.optional.run([input]);
|
|
@@ -2146,6 +2182,11 @@ class Optional {
|
|
|
2146
2182
|
return this.optional.getUsing();
|
|
2147
2183
|
}
|
|
2148
2184
|
run(r) {
|
|
2185
|
+
if (r.length === 1) {
|
|
2186
|
+
// single input, pass and return the input array without wrapping
|
|
2187
|
+
const res = this.optional.run(r);
|
|
2188
|
+
return res.length === 0 ? r : r.concat(res);
|
|
2189
|
+
}
|
|
2149
2190
|
const result = [];
|
|
2150
2191
|
for (const input of r) {
|
|
2151
2192
|
result.push(input);
|
|
@@ -2183,14 +2224,16 @@ class Star {
|
|
|
2183
2224
|
let result = r;
|
|
2184
2225
|
try {
|
|
2185
2226
|
let res = r;
|
|
2186
|
-
let input = [];
|
|
2187
2227
|
for (;;) {
|
|
2188
|
-
|
|
2189
|
-
res = this.sta.run(input);
|
|
2228
|
+
res = this.sta.run(res);
|
|
2190
2229
|
if (res.length === 0) {
|
|
2191
2230
|
break;
|
|
2192
2231
|
}
|
|
2193
|
-
if (
|
|
2232
|
+
if (result === r) {
|
|
2233
|
+
// copy on first match, the input array must not be mutated
|
|
2234
|
+
result = r.concat(res);
|
|
2235
|
+
}
|
|
2236
|
+
else if (res.length > 1000) {
|
|
2194
2237
|
// avoid stack overflow
|
|
2195
2238
|
result = result.concat(res);
|
|
2196
2239
|
}
|
|
@@ -2332,6 +2375,17 @@ class Sequence {
|
|
|
2332
2375
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2333
2376
|
}
|
|
2334
2377
|
run(r) {
|
|
2378
|
+
if (r.length === 1) {
|
|
2379
|
+
// single input, pass it down without wrapping and return the last result as is
|
|
2380
|
+
let temp = r;
|
|
2381
|
+
for (const sequence of this.list) {
|
|
2382
|
+
temp = sequence.run(temp);
|
|
2383
|
+
if (temp.length === 0) {
|
|
2384
|
+
return EMPTY;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
return temp;
|
|
2388
|
+
}
|
|
2335
2389
|
let result = [];
|
|
2336
2390
|
for (const input of r) {
|
|
2337
2391
|
let temp = [input];
|
|
@@ -2409,12 +2463,33 @@ class Expression {
|
|
|
2409
2463
|
this.runnable = undefined;
|
|
2410
2464
|
}
|
|
2411
2465
|
run(r) {
|
|
2412
|
-
const results = [];
|
|
2413
2466
|
if (this.runnable === undefined) {
|
|
2414
2467
|
this.runnable = this.getRunnable();
|
|
2415
2468
|
}
|
|
2469
|
+
if (r.length === 1) {
|
|
2470
|
+
// single input, pass it down without wrapping
|
|
2471
|
+
const input = r[0];
|
|
2472
|
+
const temp = this.runnable.run(r);
|
|
2473
|
+
if (temp.length === 0) {
|
|
2474
|
+
return EMPTY;
|
|
2475
|
+
}
|
|
2476
|
+
const results = new Array(temp.length);
|
|
2477
|
+
for (let i = 0; i < temp.length; i++) {
|
|
2478
|
+
const t = temp[i];
|
|
2479
|
+
const consumed = input.remainingLength() - t.remainingLength();
|
|
2480
|
+
results[i] = consumed > 0 ? t.wrapConsumed(consumed, new nodes_1.ExpressionNode(this)) : t;
|
|
2481
|
+
}
|
|
2482
|
+
return results;
|
|
2483
|
+
}
|
|
2484
|
+
let results = undefined;
|
|
2416
2485
|
for (const input of r) {
|
|
2417
2486
|
const temp = this.runnable.run([input]);
|
|
2487
|
+
if (temp.length === 0) {
|
|
2488
|
+
continue;
|
|
2489
|
+
}
|
|
2490
|
+
else if (results === undefined) {
|
|
2491
|
+
results = [];
|
|
2492
|
+
}
|
|
2418
2493
|
for (const t of temp) {
|
|
2419
2494
|
const consumed = input.remainingLength() - t.remainingLength();
|
|
2420
2495
|
if (consumed > 0) {
|
|
@@ -2426,8 +2501,7 @@ class Expression {
|
|
|
2426
2501
|
}
|
|
2427
2502
|
}
|
|
2428
2503
|
}
|
|
2429
|
-
|
|
2430
|
-
return results;
|
|
2504
|
+
return results !== null && results !== void 0 ? results : EMPTY;
|
|
2431
2505
|
}
|
|
2432
2506
|
listKeywords() {
|
|
2433
2507
|
// do not recurse, all Expressions are evaluated only on first level
|
|
@@ -2468,12 +2542,16 @@ class Permutation {
|
|
|
2468
2542
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2469
2543
|
}
|
|
2470
2544
|
run(r) {
|
|
2471
|
-
|
|
2472
|
-
|
|
2545
|
+
let result = undefined;
|
|
2546
|
+
let copy = undefined;
|
|
2473
2547
|
for (let index = 0; index < this.list.length; index++) {
|
|
2474
2548
|
const temp = this.list[index].run(r);
|
|
2475
2549
|
if (temp.length !== 0) {
|
|
2476
2550
|
// match
|
|
2551
|
+
if (result === undefined || copy === undefined) {
|
|
2552
|
+
result = [];
|
|
2553
|
+
copy = this.list.slice();
|
|
2554
|
+
}
|
|
2477
2555
|
result.push(...temp);
|
|
2478
2556
|
const left = copy;
|
|
2479
2557
|
left.splice(index, 1);
|
|
@@ -2485,7 +2563,7 @@ class Permutation {
|
|
|
2485
2563
|
}
|
|
2486
2564
|
}
|
|
2487
2565
|
}
|
|
2488
|
-
return result;
|
|
2566
|
+
return result !== null && result !== void 0 ? result : EMPTY;
|
|
2489
2567
|
}
|
|
2490
2568
|
railroad() {
|
|
2491
2569
|
const children = this.list.map((e) => { return e.railroad(); });
|
|
@@ -2562,17 +2640,31 @@ class Alternative {
|
|
|
2562
2640
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2563
2641
|
}
|
|
2564
2642
|
run(r) {
|
|
2565
|
-
|
|
2643
|
+
var _a;
|
|
2644
|
+
// only allocate a new array when more than one alternative matches
|
|
2645
|
+
let single = undefined;
|
|
2646
|
+
let result = undefined;
|
|
2566
2647
|
for (const sequ of this.list) {
|
|
2567
2648
|
const temp = sequ.run(r);
|
|
2568
|
-
if (temp.length ===
|
|
2569
|
-
|
|
2649
|
+
if (temp.length === 0) {
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
else if (result !== undefined) {
|
|
2653
|
+
if (temp.length === 1) {
|
|
2654
|
+
result.push(temp[0]);
|
|
2655
|
+
}
|
|
2656
|
+
else {
|
|
2657
|
+
result.push(...temp);
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
else if (single !== undefined) {
|
|
2661
|
+
result = single.concat(temp);
|
|
2570
2662
|
}
|
|
2571
2663
|
else {
|
|
2572
|
-
|
|
2664
|
+
single = temp;
|
|
2573
2665
|
}
|
|
2574
2666
|
}
|
|
2575
|
-
return result;
|
|
2667
|
+
return (_a = result !== null && result !== void 0 ? result : single) !== null && _a !== void 0 ? _a : EMPTY;
|
|
2576
2668
|
}
|
|
2577
2669
|
railroad() {
|
|
2578
2670
|
const children = this.list.map((e) => { return e.railroad(); });
|
|
@@ -2623,21 +2715,13 @@ class AlternativePriority {
|
|
|
2623
2715
|
return this.list.reduce((a, c) => { return a.concat(c.getUsing()); }, []);
|
|
2624
2716
|
}
|
|
2625
2717
|
run(r) {
|
|
2626
|
-
const result = [];
|
|
2627
2718
|
for (const sequ of this.list) {
|
|
2628
|
-
// console.log(seq.toStr());
|
|
2629
2719
|
const temp = sequ.run(r);
|
|
2630
2720
|
if (temp.length > 0) {
|
|
2631
|
-
|
|
2632
|
-
result.push(temp[0]);
|
|
2633
|
-
}
|
|
2634
|
-
else {
|
|
2635
|
-
result.push(...temp);
|
|
2636
|
-
}
|
|
2637
|
-
break;
|
|
2721
|
+
return temp;
|
|
2638
2722
|
}
|
|
2639
2723
|
}
|
|
2640
|
-
return
|
|
2724
|
+
return EMPTY;
|
|
2641
2725
|
}
|
|
2642
2726
|
railroad() {
|
|
2643
2727
|
const children = this.list.map((e) => { return e.railroad(); });
|
|
@@ -2843,18 +2927,21 @@ class StopBefore2 {
|
|
|
2843
2927
|
getUsing() { return []; }
|
|
2844
2928
|
run(r) {
|
|
2845
2929
|
var _a;
|
|
2846
|
-
|
|
2847
|
-
|
|
2930
|
+
// only copy when something is filtered out
|
|
2931
|
+
let result = undefined;
|
|
2932
|
+
for (let i = 0; i < r.length; i++) {
|
|
2933
|
+
const input = r[i];
|
|
2848
2934
|
const next = input.peek();
|
|
2849
|
-
if (next === undefined
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2935
|
+
if (next === undefined
|
|
2936
|
+
|| (next.getUpperStr() === this.t1 && ((_a = input.peekAt(1)) === null || _a === void 0 ? void 0 : _a.getUpperStr()) === this.t2)) {
|
|
2937
|
+
if (result === undefined) {
|
|
2938
|
+
result = r.slice(0, i);
|
|
2939
|
+
}
|
|
2853
2940
|
continue;
|
|
2854
2941
|
}
|
|
2855
|
-
result.push(input);
|
|
2942
|
+
result === null || result === void 0 ? void 0 : result.push(input);
|
|
2856
2943
|
}
|
|
2857
|
-
return result;
|
|
2944
|
+
return result !== null && result !== void 0 ? result : r;
|
|
2858
2945
|
}
|
|
2859
2946
|
railroad() { return "Railroad.Terminal('stopBefore(" + this.t1 + " " + this.t2 + ")')"; }
|
|
2860
2947
|
toStr() { return "stopBefore(" + this.t1 + "," + this.t2 + ")"; }
|
|
@@ -2869,15 +2956,20 @@ class StopBefore1 {
|
|
|
2869
2956
|
getUsing() { return []; }
|
|
2870
2957
|
run(r) {
|
|
2871
2958
|
var _a;
|
|
2872
|
-
|
|
2873
|
-
|
|
2959
|
+
// only copy when something is filtered out
|
|
2960
|
+
let result = undefined;
|
|
2961
|
+
for (let i = 0; i < r.length; i++) {
|
|
2962
|
+
const input = r[i];
|
|
2874
2963
|
const next = (_a = input.peek()) === null || _a === void 0 ? void 0 : _a.getUpperStr();
|
|
2875
2964
|
if (next !== undefined && this.words.includes(next)) {
|
|
2965
|
+
if (result === undefined) {
|
|
2966
|
+
result = r.slice(0, i);
|
|
2967
|
+
}
|
|
2876
2968
|
continue;
|
|
2877
2969
|
}
|
|
2878
|
-
result.push(input);
|
|
2970
|
+
result === null || result === void 0 ? void 0 : result.push(input);
|
|
2879
2971
|
}
|
|
2880
|
-
return result;
|
|
2972
|
+
return result !== null && result !== void 0 ? result : r;
|
|
2881
2973
|
}
|
|
2882
2974
|
railroad() { return "Railroad.Terminal('stopBefore(" + this.words.join("|") + ")')"; }
|
|
2883
2975
|
toStr() { return "stopBefore(" + this.words.join(",") + ")"; }
|
|
@@ -6623,7 +6715,9 @@ const combi_1 = __webpack_require__(/*! ../combi */ "../core/build/src/abap/2_st
|
|
|
6623
6715
|
const _1 = __webpack_require__(/*! . */ "../core/build/src/abap/2_statements/expressions/index.js");
|
|
6624
6716
|
class MethodParamOptional extends combi_1.Expression {
|
|
6625
6717
|
getRunnable() {
|
|
6626
|
-
|
|
6718
|
+
// not optPrio, a parameter named "optional" can follow one with a DEFAULT value:
|
|
6719
|
+
// "a TYPE i DEFAULT 5 optional TYPE i"
|
|
6720
|
+
return (0, combi_1.seq)(_1.MethodParam, (0, combi_1.opt)("OPTIONAL"));
|
|
6627
6721
|
}
|
|
6628
6722
|
}
|
|
6629
6723
|
exports.MethodParamOptional = MethodParamOptional;
|
|
@@ -28396,6 +28490,7 @@ const Types = __importStar(__webpack_require__(/*! ../types/basic */ "../core/bu
|
|
|
28396
28490
|
const _scope_type_1 = __webpack_require__(/*! ./_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
|
|
28397
28491
|
const _object_oriented_1 = __webpack_require__(/*! ./_object_oriented */ "../core/build/src/abap/5_syntax/_object_oriented.js");
|
|
28398
28492
|
const class_constant_1 = __webpack_require__(/*! ../types/class_constant */ "../core/build/src/abap/types/class_constant.js");
|
|
28493
|
+
const class_attribute_1 = __webpack_require__(/*! ../types/class_attribute */ "../core/build/src/abap/types/class_attribute.js");
|
|
28399
28494
|
const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
|
|
28400
28495
|
const _reference_1 = __webpack_require__(/*! ./_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
28401
28496
|
const basic_1 = __webpack_require__(/*! ../types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
@@ -29246,15 +29341,18 @@ class BasicTypes {
|
|
|
29246
29341
|
const firstName = firstToken.getStr();
|
|
29247
29342
|
if (firstNode.get() instanceof Expressions.Field) {
|
|
29248
29343
|
const found = this.input.scope.findVariable(firstName);
|
|
29249
|
-
|
|
29250
|
-
|
|
29251
|
-
this.input.
|
|
29252
|
-
return
|
|
29344
|
+
if (found === undefined) {
|
|
29345
|
+
const message = `"${firstName}" not found, findTop`;
|
|
29346
|
+
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, firstToken, message));
|
|
29347
|
+
return undefined;
|
|
29253
29348
|
}
|
|
29254
|
-
|
|
29255
|
-
|
|
29349
|
+
this.input.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
29350
|
+
if (this.isConstant(found) === false) {
|
|
29351
|
+
const message = `VALUE, ${expr.concatTokens().toLowerCase()} is not a constant`;
|
|
29352
|
+
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, firstToken, message));
|
|
29353
|
+
return undefined;
|
|
29256
29354
|
}
|
|
29257
|
-
return
|
|
29355
|
+
return this.constantValue(expr, found.getValue());
|
|
29258
29356
|
}
|
|
29259
29357
|
else if (firstNode.get() instanceof Expressions.ClassName
|
|
29260
29358
|
&& firstName.toLowerCase() === this.input.scope.getName().toLowerCase()
|
|
@@ -29263,12 +29361,18 @@ class BasicTypes {
|
|
|
29263
29361
|
const children = expr.getChildren();
|
|
29264
29362
|
const token = (_a = children[2]) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
29265
29363
|
const found = this.input.scope.findVariable(token.getStr());
|
|
29266
|
-
|
|
29267
|
-
|
|
29268
|
-
this.input.
|
|
29269
|
-
return
|
|
29364
|
+
if (found === undefined) {
|
|
29365
|
+
const message = `"${token.getStr()}" not found, findTop`;
|
|
29366
|
+
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, token, message));
|
|
29367
|
+
return undefined;
|
|
29270
29368
|
}
|
|
29271
|
-
|
|
29369
|
+
this.input.scope.addReference(firstToken, found, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
29370
|
+
if (this.isConstant(found) === false) {
|
|
29371
|
+
const message = `VALUE, ${expr.concatTokens().toLowerCase()} is not a constant`;
|
|
29372
|
+
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, token, message));
|
|
29373
|
+
return undefined;
|
|
29374
|
+
}
|
|
29375
|
+
return this.constantValue(expr, found.getValue());
|
|
29272
29376
|
}
|
|
29273
29377
|
else if (firstNode.get() instanceof Expressions.ClassName) {
|
|
29274
29378
|
const obj = this.input.scope.findObjectDefinition(firstName);
|
|
@@ -29291,24 +29395,58 @@ class BasicTypes {
|
|
|
29291
29395
|
if (c instanceof class_constant_1.ClassConstant) {
|
|
29292
29396
|
this.input.scope.addReference(firstToken, obj, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename, { ooName: obj.getName() });
|
|
29293
29397
|
this.input.scope.addReference(token, c, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
29294
|
-
|
|
29295
|
-
|
|
29296
|
-
|
|
29297
|
-
|
|
29298
|
-
|
|
29299
|
-
|
|
29300
|
-
|
|
29301
|
-
|
|
29302
|
-
|
|
29303
|
-
}
|
|
29398
|
+
return this.constantValue(expr, c.getValue());
|
|
29399
|
+
}
|
|
29400
|
+
const helper = new _object_oriented_1.ObjectOriented(this.input.scope);
|
|
29401
|
+
const attribute = helper.searchAttributeName(obj, attr);
|
|
29402
|
+
if (attribute) {
|
|
29403
|
+
this.input.scope.addReference(firstToken, obj, _reference_1.ReferenceType.ObjectOrientedReference, this.input.filename, { ooName: obj.getName() });
|
|
29404
|
+
this.input.scope.addReference(token, attribute, _reference_1.ReferenceType.DataReadReference, this.input.filename);
|
|
29405
|
+
const message = `VALUE, ${expr.concatTokens().toLowerCase()} is not a constant`;
|
|
29406
|
+
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, token, message));
|
|
29304
29407
|
return undefined;
|
|
29305
29408
|
}
|
|
29306
|
-
|
|
29409
|
+
const message = `Attribute or constant "${attr}" not found in "${obj.getName()}"`;
|
|
29410
|
+
this.input.issues.push((0, _syntax_input_1.syntaxIssue)(this.input, token, message));
|
|
29411
|
+
return undefined;
|
|
29307
29412
|
}
|
|
29308
29413
|
else {
|
|
29309
29414
|
throw new Error("resolveConstantValue, unexpected structure");
|
|
29310
29415
|
}
|
|
29311
29416
|
}
|
|
29417
|
+
isConstant(identifier) {
|
|
29418
|
+
if (identifier instanceof class_attribute_1.ClassAttribute) {
|
|
29419
|
+
return false;
|
|
29420
|
+
}
|
|
29421
|
+
const meta = identifier.getMeta();
|
|
29422
|
+
if (meta.includes("read_only" /* IdentifierMeta.ReadOnly */) === false) {
|
|
29423
|
+
return false;
|
|
29424
|
+
}
|
|
29425
|
+
if (meta.includes("static" /* IdentifierMeta.Static */)) {
|
|
29426
|
+
return true;
|
|
29427
|
+
}
|
|
29428
|
+
// Built-in constants and built-in system fields share ReadOnly/BuiltIn metadata.
|
|
29429
|
+
// Only the constants have a value; system fields such as SY-INDEX do not.
|
|
29430
|
+
return meta.includes("built-in" /* IdentifierMeta.BuiltIn */) && identifier.getValue() !== undefined;
|
|
29431
|
+
}
|
|
29432
|
+
constantValue(expr, value) {
|
|
29433
|
+
if (typeof value === "string") {
|
|
29434
|
+
return value;
|
|
29435
|
+
}
|
|
29436
|
+
else if (typeof value === "object" && value !== null) {
|
|
29437
|
+
let current = value;
|
|
29438
|
+
for (const child of expr.getChildren().slice(1)) {
|
|
29439
|
+
if (child instanceof nodes_1.ExpressionNode && child.get() instanceof Expressions.ComponentName) {
|
|
29440
|
+
if (typeof current !== "object" || current === null) {
|
|
29441
|
+
return undefined;
|
|
29442
|
+
}
|
|
29443
|
+
current = current[child.getFirstToken().getStr()];
|
|
29444
|
+
}
|
|
29445
|
+
}
|
|
29446
|
+
return typeof current === "string" ? current : undefined;
|
|
29447
|
+
}
|
|
29448
|
+
return undefined;
|
|
29449
|
+
}
|
|
29312
29450
|
resolveTypeRef(chain) {
|
|
29313
29451
|
var _a;
|
|
29314
29452
|
if (chain === undefined) {
|
|
@@ -37703,6 +37841,12 @@ class Append {
|
|
|
37703
37841
|
if (target) {
|
|
37704
37842
|
targetType = target_1.Target.runSyntax(target, input);
|
|
37705
37843
|
}
|
|
37844
|
+
// a hashed table has no index, APPEND adds at the end
|
|
37845
|
+
if (targetType instanceof basic_1.TableType && targetType.getAccessType() === basic_1.TableAccessType.hashed) {
|
|
37846
|
+
const message = "Implicit or explicit index operation on hashed table is not possible";
|
|
37847
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
37848
|
+
return;
|
|
37849
|
+
}
|
|
37706
37850
|
const fsTarget = node.findExpressionAfterToken("ASSIGNING");
|
|
37707
37851
|
if (fsTarget && fsTarget.get() instanceof Expressions.FSTarget) {
|
|
37708
37852
|
if (!(targetType instanceof basic_1.TableType) && !(targetType instanceof basic_1.VoidType) && !(targetType instanceof basic_1.UnknownType)) {
|
|
@@ -53971,6 +54115,7 @@ const Expressions = __importStar(__webpack_require__(/*! ../2_statements/express
|
|
|
53971
54115
|
const method_parameters_1 = __webpack_require__(/*! ./method_parameters */ "../core/build/src/abap/types/method_parameters.js");
|
|
53972
54116
|
const _identifier_1 = __webpack_require__(/*! ../4_file_information/_identifier */ "../core/build/src/abap/4_file_information/_identifier.js");
|
|
53973
54117
|
const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
54118
|
+
const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
53974
54119
|
class MethodDefinition extends _identifier_1.Identifier {
|
|
53975
54120
|
// todo: final flag
|
|
53976
54121
|
constructor(node, visibility, input) {
|
|
@@ -54012,6 +54157,7 @@ class MethodDefinition extends _identifier_1.Identifier {
|
|
|
54012
54157
|
this.static = true;
|
|
54013
54158
|
}
|
|
54014
54159
|
this.raising = [];
|
|
54160
|
+
this.checkRaisingParameter(node, input);
|
|
54015
54161
|
for (const r of ((_c = node.findDirectExpression(Expressions.MethodDefRaising)) === null || _c === void 0 ? void 0 : _c.findAllExpressions(Expressions.ClassName)) || []) {
|
|
54016
54162
|
const token = r.getFirstToken();
|
|
54017
54163
|
const name = token.getStr();
|
|
@@ -54036,6 +54182,26 @@ class MethodDefinition extends _identifier_1.Identifier {
|
|
|
54036
54182
|
this.visibility = visibility;
|
|
54037
54183
|
this.parameters = new method_parameters_1.MethodParameters(node, input, this.abstract);
|
|
54038
54184
|
}
|
|
54185
|
+
// A system reads a parameter named RAISING as the RAISING addition, measured on 758:
|
|
54186
|
+
// "IMPORTING a TYPE i raising TYPE i" fails with 'Type "TYPE" is unknown'
|
|
54187
|
+
checkRaisingParameter(node, input) {
|
|
54188
|
+
const raising = node.findDirectExpression(Expressions.MethodDefRaising);
|
|
54189
|
+
const first = raising === null || raising === void 0 ? void 0 : raising.getChildren()[1];
|
|
54190
|
+
if (raising === undefined
|
|
54191
|
+
|| first === undefined
|
|
54192
|
+
|| !(first.get() instanceof Expressions.ClassName)
|
|
54193
|
+
|| ["TYPE", "LIKE"].includes(first.getFirstToken().getStr().toUpperCase()) === false) {
|
|
54194
|
+
return;
|
|
54195
|
+
}
|
|
54196
|
+
if (node.findDirectExpression(Expressions.MethodDefImporting) === undefined
|
|
54197
|
+
&& node.findDirectExpression(Expressions.MethodDefExporting) === undefined
|
|
54198
|
+
&& node.findDirectExpression(Expressions.MethodDefChanging) === undefined) {
|
|
54199
|
+
return;
|
|
54200
|
+
}
|
|
54201
|
+
const token = raising.getFirstToken();
|
|
54202
|
+
const message = "Parameter \"" + token.getStr() + "\" is read as the RAISING addition, rename it or escape it as !" + token.getStr();
|
|
54203
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, token, message));
|
|
54204
|
+
}
|
|
54039
54205
|
getVisibility() {
|
|
54040
54206
|
return this.visibility;
|
|
54041
54207
|
}
|
|
@@ -54303,6 +54469,12 @@ const _reference_1 = __webpack_require__(/*! ../5_syntax/_reference */ "../core/
|
|
|
54303
54469
|
const identifier_1 = __webpack_require__(/*! ../1_lexer/tokens/identifier */ "../core/build/src/abap/1_lexer/tokens/identifier.js");
|
|
54304
54470
|
const _scope_type_1 = __webpack_require__(/*! ../5_syntax/_scope_type */ "../core/build/src/abap/5_syntax/_scope_type.js");
|
|
54305
54471
|
const _syntax_input_1 = __webpack_require__(/*! ../5_syntax/_syntax_input */ "../core/build/src/abap/5_syntax/_syntax_input.js");
|
|
54472
|
+
// the keywords that can follow a parameter in each section, a plain parameter name is read as them
|
|
54473
|
+
const KEYWORDS_AFTER = {
|
|
54474
|
+
"IMPORTING": ["PREFERRED", "EXPORTING", "CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"],
|
|
54475
|
+
"EXPORTING": ["CHANGING", "RETURNING", "RAISING", "EXCEPTIONS"],
|
|
54476
|
+
"CHANGING": ["RETURNING", "RAISING", "EXCEPTIONS"],
|
|
54477
|
+
};
|
|
54306
54478
|
// todo:
|
|
54307
54479
|
// this.exceptions = [];
|
|
54308
54480
|
// also consider RAISING vs EXCEPTIONS
|
|
@@ -54547,6 +54719,7 @@ class MethodParameters {
|
|
|
54547
54719
|
}
|
|
54548
54720
|
add(target, source, input, meta, abstractMethod) {
|
|
54549
54721
|
var _a;
|
|
54722
|
+
this.checkKeywordNames(source, input);
|
|
54550
54723
|
for (const opt of source.findAllExpressions(Expressions.MethodParamOptional)) {
|
|
54551
54724
|
const p = opt.findDirectExpression(Expressions.MethodParam);
|
|
54552
54725
|
if (p === undefined) {
|
|
@@ -54587,6 +54760,56 @@ class MethodParameters {
|
|
|
54587
54760
|
target.push(method_param_1.MethodParam.runSyntax(param, input, [...meta, ...extraMeta]));
|
|
54588
54761
|
}
|
|
54589
54762
|
}
|
|
54763
|
+
// A system reads a plain parameter name as a keyword wherever that keyword can stand, measured on 758:
|
|
54764
|
+
// "val TYPE clike default TYPE i" makes default the DEFAULT addition of val, and then fails
|
|
54765
|
+
// with "Unable to interpret ..." on what follows. "!default" and "VALUE(default)" are names
|
|
54766
|
+
checkKeywordNames(section, input) {
|
|
54767
|
+
var _a;
|
|
54768
|
+
const following = KEYWORDS_AFTER[section.getFirstToken().getStr().toUpperCase()];
|
|
54769
|
+
if (following === undefined) {
|
|
54770
|
+
return;
|
|
54771
|
+
}
|
|
54772
|
+
// undefined: no parameter before in this section, true: the one before has OPTIONAL or DEFAULT
|
|
54773
|
+
let previousHasAddition = undefined;
|
|
54774
|
+
for (const child of section.getChildren()) {
|
|
54775
|
+
if (!(child instanceof nodes_1.ExpressionNode)) {
|
|
54776
|
+
continue;
|
|
54777
|
+
}
|
|
54778
|
+
let param = undefined;
|
|
54779
|
+
let optional = false;
|
|
54780
|
+
if (child.get() instanceof Expressions.MethodParamOptional) {
|
|
54781
|
+
param = child.findDirectExpression(Expressions.MethodParam);
|
|
54782
|
+
optional = child.findDirectTokenByText("OPTIONAL") !== undefined;
|
|
54783
|
+
}
|
|
54784
|
+
else if (child.get() instanceof Expressions.MethodParam) {
|
|
54785
|
+
param = child;
|
|
54786
|
+
}
|
|
54787
|
+
else if (child.get() instanceof Expressions.MethodParamName) {
|
|
54788
|
+
// "TYPE ANY STRUCTURE", not measured, so never reported after it
|
|
54789
|
+
previousHasAddition = true;
|
|
54790
|
+
continue;
|
|
54791
|
+
}
|
|
54792
|
+
if (param === undefined) {
|
|
54793
|
+
continue;
|
|
54794
|
+
}
|
|
54795
|
+
const first = param.getFirstToken();
|
|
54796
|
+
const name = first.getStr().toUpperCase();
|
|
54797
|
+
if (((_a = param.getChildren()[0]) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.MethodParamName) {
|
|
54798
|
+
let readAs = undefined;
|
|
54799
|
+
if (following.includes(name)) {
|
|
54800
|
+
readAs = "the " + (name === "PREFERRED" ? "PREFERRED PARAMETER" : name) + " addition";
|
|
54801
|
+
}
|
|
54802
|
+
else if ((name === "DEFAULT" || name === "OPTIONAL") && previousHasAddition === false) {
|
|
54803
|
+
readAs = "the " + name + " addition of the parameter before it";
|
|
54804
|
+
}
|
|
54805
|
+
if (readAs !== undefined) {
|
|
54806
|
+
const message = "Parameter \"" + first.getStr() + "\" is read as " + readAs + ", rename it or escape it as !" + first.getStr();
|
|
54807
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, first, message));
|
|
54808
|
+
}
|
|
54809
|
+
}
|
|
54810
|
+
previousHasAddition = optional || param.findFirstExpression(Expressions.Default) !== undefined;
|
|
54811
|
+
}
|
|
54812
|
+
}
|
|
54590
54813
|
isPassByValue(param) {
|
|
54591
54814
|
var _a;
|
|
54592
54815
|
// "!" is the identifier escape, generated code has eg. "IMPORTING !VALUE(iv_foo)"
|
|
@@ -57123,7 +57346,7 @@ class DDIC {
|
|
|
57123
57346
|
lookupDomain(name, dataElement, description) {
|
|
57124
57347
|
const found = this.reg.getObject("DOMA", name);
|
|
57125
57348
|
if (found) {
|
|
57126
|
-
return { type: found.
|
|
57349
|
+
return { type: found.parseDomainType(this.reg, dataElement, description), object: found };
|
|
57127
57350
|
}
|
|
57128
57351
|
else if (this.reg.inErrorNamespace(name)) {
|
|
57129
57352
|
return { type: new Types.UnknownType(name + ", lookupDomain"), object: undefined };
|
|
@@ -63395,6 +63618,8 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
63395
63618
|
super(...arguments);
|
|
63396
63619
|
this.parserError = undefined;
|
|
63397
63620
|
this.parsedData = undefined;
|
|
63621
|
+
this.typeCache = undefined;
|
|
63622
|
+
this.typeCacheData = undefined;
|
|
63398
63623
|
}
|
|
63399
63624
|
getType() {
|
|
63400
63625
|
return "DDLS";
|
|
@@ -63422,7 +63647,11 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
63422
63647
|
}
|
|
63423
63648
|
parseType(reg) {
|
|
63424
63649
|
this.parse();
|
|
63425
|
-
|
|
63650
|
+
if (this.typeCache === undefined || this.typeCacheData !== this.parsedData) {
|
|
63651
|
+
this.typeCacheData = this.parsedData;
|
|
63652
|
+
this.typeCache = new cds_determine_types_1.CDSDetermineTypes().parseType(reg, this.parsedData, this.getName());
|
|
63653
|
+
}
|
|
63654
|
+
return this.typeCache;
|
|
63426
63655
|
}
|
|
63427
63656
|
getParsedData() {
|
|
63428
63657
|
return this.parsedData;
|
|
@@ -63434,6 +63663,8 @@ class DataDefinition extends _abstract_object_1.AbstractObject {
|
|
|
63434
63663
|
}
|
|
63435
63664
|
setDirty() {
|
|
63436
63665
|
this.parsedData = undefined;
|
|
63666
|
+
this.typeCache = undefined;
|
|
63667
|
+
this.typeCacheData = undefined;
|
|
63437
63668
|
this.parserError = undefined;
|
|
63438
63669
|
super.setDirty();
|
|
63439
63670
|
}
|
|
@@ -64087,7 +64318,10 @@ class Domain extends _abstract_object_1.AbstractObject {
|
|
|
64087
64318
|
this.parsedXML = undefined;
|
|
64088
64319
|
super.setDirty();
|
|
64089
64320
|
}
|
|
64090
|
-
parseType(reg
|
|
64321
|
+
parseType(reg) {
|
|
64322
|
+
return this.parseDomainType(reg);
|
|
64323
|
+
}
|
|
64324
|
+
parseDomainType(reg, dataElement, description) {
|
|
64091
64325
|
// dont cache the DOMA parsed type, they are cached on DTEL level
|
|
64092
64326
|
// also note that the type carries the name of the DTEL
|
|
64093
64327
|
if (this.parsedXML === undefined) {
|
|
@@ -70708,7 +70942,7 @@ class Registry {
|
|
|
70708
70942
|
}
|
|
70709
70943
|
static abaplintVersion() {
|
|
70710
70944
|
// magic, see build script "version.js"
|
|
70711
|
-
return "2.120.
|
|
70945
|
+
return "2.120.75";
|
|
70712
70946
|
}
|
|
70713
70947
|
getDDICReferences() {
|
|
70714
70948
|
return this.ddicReferences;
|
|
@@ -71370,10 +71604,10 @@ exports.Abapdoc = Abapdoc;
|
|
|
71370
71604
|
|
|
71371
71605
|
/***/ },
|
|
71372
71606
|
|
|
71373
|
-
/***/ "../core/build/src/rules/
|
|
71374
|
-
|
|
71375
|
-
!*** ../core/build/src/rules/
|
|
71376
|
-
|
|
71607
|
+
/***/ "../core/build/src/rules/abapdoc_html_tag.js"
|
|
71608
|
+
/*!***************************************************!*\
|
|
71609
|
+
!*** ../core/build/src/rules/abapdoc_html_tag.js ***!
|
|
71610
|
+
\***************************************************/
|
|
71377
71611
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71378
71612
|
|
|
71379
71613
|
"use strict";
|
|
@@ -71412,49 +71646,45 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
71412
71646
|
};
|
|
71413
71647
|
})();
|
|
71414
71648
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71415
|
-
exports.
|
|
71649
|
+
exports.AbapdocHtmlTag = exports.AbapdocHtmlTagConf = void 0;
|
|
71650
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
71416
71651
|
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
71417
71652
|
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
71418
71653
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
71419
|
-
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
71420
|
-
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
71421
71654
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
71422
|
-
|
|
71655
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
71656
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
71657
|
+
class AbapdocHtmlTagConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71423
71658
|
}
|
|
71424
|
-
exports.
|
|
71425
|
-
|
|
71659
|
+
exports.AbapdocHtmlTagConf = AbapdocHtmlTagConf;
|
|
71660
|
+
const ALLOWED = new Set(["p", "em", "strong", "ul", "ol", "li", "br", "h1", "h2", "h3"]);
|
|
71661
|
+
class AbapdocHtmlTag extends _abap_rule_1.ABAPRule {
|
|
71426
71662
|
constructor() {
|
|
71427
71663
|
super(...arguments);
|
|
71428
|
-
this.conf = new
|
|
71664
|
+
this.conf = new AbapdocHtmlTagConf();
|
|
71429
71665
|
}
|
|
71430
71666
|
getMetadata() {
|
|
71431
71667
|
return {
|
|
71432
|
-
key: "
|
|
71433
|
-
title: "
|
|
71434
|
-
shortDescription: `
|
|
71435
|
-
|
|
71436
|
-
|
|
71437
|
-
PUBLIC SECTION.
|
|
71438
|
-
PROTECTED SECTION.
|
|
71439
|
-
PRIVATE SECTION.
|
|
71440
|
-
METHODS test FOR TESTING RAISING cx_static_check.
|
|
71441
|
-
ENDCLASS.
|
|
71668
|
+
key: "abapdoc_html_tag",
|
|
71669
|
+
title: "Unsupported HTML tag in ABAP Doc",
|
|
71670
|
+
shortDescription: `Reports tag-like tokens in ABAP Doc which are not ABAP Doc HTML tags.`,
|
|
71671
|
+
extendedInformation: `ABAP Doc is parsed as HTML, a field symbol or a placeholder written as <name> is an
|
|
71672
|
+
unsupported and unclosed tag, the system warns and the rendered documentation drops the word.
|
|
71442
71673
|
|
|
71443
|
-
|
|
71444
|
-
METHOD test.
|
|
71445
|
-
ENDMETHOD.
|
|
71446
|
-
ENDCLASS.`,
|
|
71447
|
-
goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
71448
|
-
PUBLIC SECTION.
|
|
71449
|
-
PROTECTED SECTION.
|
|
71450
|
-
PRIVATE SECTION.
|
|
71451
|
-
METHODS test FOR TESTING RAISING cx_static_check.
|
|
71452
|
-
ENDCLASS.
|
|
71674
|
+
Supported tags are p, em, strong, ul, ol, li, br, h1, h2 and h3, also as closing tags and with attributes.
|
|
71453
71675
|
|
|
71454
|
-
|
|
71455
|
-
|
|
71456
|
-
|
|
71457
|
-
|
|
71676
|
+
Write <name> to show the angle brackets. A "<" which is not followed by a letter, like "a < b", is not reported.
|
|
71677
|
+
|
|
71678
|
+
Only checks ABAP Doc inside class definitions and interfaces.`,
|
|
71679
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
71680
|
+
badExample: `INTERFACE zif_foo PUBLIC.
|
|
71681
|
+
"! Returns the <name> of the selected row
|
|
71682
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
71683
|
+
ENDINTERFACE.`,
|
|
71684
|
+
goodExample: `INTERFACE zif_foo PUBLIC.
|
|
71685
|
+
"! Returns the <name> of the selected row
|
|
71686
|
+
METHODS name RETURNING VALUE(result) TYPE string.
|
|
71687
|
+
ENDINTERFACE.`,
|
|
71458
71688
|
};
|
|
71459
71689
|
}
|
|
71460
71690
|
getConfig() {
|
|
@@ -71465,120 +71695,543 @@ ENDCLASS.`,
|
|
|
71465
71695
|
}
|
|
71466
71696
|
runParsed(file) {
|
|
71467
71697
|
const issues = [];
|
|
71468
|
-
|
|
71469
|
-
|
|
71470
|
-
|
|
71471
|
-
|
|
71472
|
-
|
|
71473
|
-
const cdef = classStructure.findFirstStatement(Statements.ClassDefinition);
|
|
71474
|
-
if (cdef === undefined) {
|
|
71698
|
+
let definition = false;
|
|
71699
|
+
for (const statement of file.getStatements()) {
|
|
71700
|
+
const type = statement.get();
|
|
71701
|
+
if (type instanceof Statements.ClassDefinition || type instanceof Statements.Interface) {
|
|
71702
|
+
definition = true;
|
|
71475
71703
|
continue;
|
|
71476
71704
|
}
|
|
71477
|
-
|
|
71478
|
-
|
|
71705
|
+
else if (type instanceof Statements.EndClass || type instanceof Statements.EndInterface) {
|
|
71706
|
+
definition = false;
|
|
71479
71707
|
continue;
|
|
71480
71708
|
}
|
|
71481
|
-
|
|
71482
|
-
const hasRiskLevel = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" RISK LEVEL ");
|
|
71483
|
-
if (hasDuration === true && hasRiskLevel === true) {
|
|
71709
|
+
else if (definition === false || !(type instanceof _statement_1.Comment)) {
|
|
71484
71710
|
continue;
|
|
71485
71711
|
}
|
|
71486
|
-
|
|
71487
|
-
|
|
71488
|
-
|
|
71489
|
-
if (concat.includes(" FOR TESTING")) {
|
|
71490
|
-
hasTestMethod = true;
|
|
71491
|
-
}
|
|
71492
|
-
}
|
|
71493
|
-
if (hasTestMethod === false) {
|
|
71712
|
+
const token = statement.getFirstToken();
|
|
71713
|
+
const str = token.getStr();
|
|
71714
|
+
if (str.startsWith(`"!`) === false) {
|
|
71494
71715
|
continue;
|
|
71495
71716
|
}
|
|
71496
|
-
|
|
71497
|
-
|
|
71498
|
-
|
|
71499
|
-
|
|
71500
|
-
|
|
71717
|
+
const regex = /<\/?([a-zA-Z][\w-]*)(\s[^<>]*)?\/?>/g;
|
|
71718
|
+
let match;
|
|
71719
|
+
while ((match = regex.exec(str)) !== null) {
|
|
71720
|
+
const name = match[1];
|
|
71721
|
+
if (ALLOWED.has(name.toLowerCase())) {
|
|
71722
|
+
continue;
|
|
71723
|
+
}
|
|
71724
|
+
const row = token.getStart().getRow();
|
|
71725
|
+
const col = token.getStart().getCol() + match.index;
|
|
71726
|
+
const start = new position_1.Position(row, col);
|
|
71727
|
+
const end = new position_1.Position(row, col + match[0].length);
|
|
71728
|
+
const message = `HTML tag <${name}> is not supported in ABAP Doc, write <${name}>`;
|
|
71729
|
+
issues.push(issue_1.Issue.atRange(file, start, end, message, this.getMetadata().key, this.conf.severity));
|
|
71501
71730
|
}
|
|
71502
71731
|
}
|
|
71503
71732
|
return issues;
|
|
71504
71733
|
}
|
|
71505
71734
|
}
|
|
71506
|
-
exports.
|
|
71507
|
-
//# sourceMappingURL=
|
|
71508
|
-
|
|
71509
|
-
/***/ },
|
|
71510
|
-
|
|
71511
|
-
/***/ "../core/build/src/rules/aff_and_xml.js"
|
|
71512
|
-
/*!**********************************************!*\
|
|
71513
|
-
!*** ../core/build/src/rules/aff_and_xml.js ***!
|
|
71514
|
-
\**********************************************/
|
|
71515
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71516
|
-
|
|
71517
|
-
"use strict";
|
|
71518
|
-
|
|
71519
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71520
|
-
exports.AFFAndXML = exports.AFFAndXMLConf = void 0;
|
|
71521
|
-
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
71522
|
-
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
71523
|
-
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
71524
|
-
class AFFAndXMLConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71525
|
-
}
|
|
71526
|
-
exports.AFFAndXMLConf = AFFAndXMLConf;
|
|
71527
|
-
class AFFAndXML {
|
|
71528
|
-
constructor() {
|
|
71529
|
-
this.conf = new AFFAndXMLConf();
|
|
71530
|
-
}
|
|
71531
|
-
getMetadata() {
|
|
71532
|
-
return {
|
|
71533
|
-
key: "aff_and_xml",
|
|
71534
|
-
title: "AFF and XML",
|
|
71535
|
-
shortDescription: `Checks for objects that have both AFF (.json) and XML (.xml) files`,
|
|
71536
|
-
extendedInformation: `If an object has both an ABAP file format JSON file and an XML file, the XML file should be removed`,
|
|
71537
|
-
tags: [_irule_1.RuleTag.Syntax],
|
|
71538
|
-
};
|
|
71539
|
-
}
|
|
71540
|
-
getConfig() {
|
|
71541
|
-
return this.conf;
|
|
71542
|
-
}
|
|
71543
|
-
setConfig(conf) {
|
|
71544
|
-
this.conf = conf;
|
|
71545
|
-
}
|
|
71546
|
-
initialize(_reg) {
|
|
71547
|
-
return this;
|
|
71548
|
-
}
|
|
71549
|
-
run(obj) {
|
|
71550
|
-
const files = obj.getFiles();
|
|
71551
|
-
let hasJSON = false;
|
|
71552
|
-
let hasXML = false;
|
|
71553
|
-
const type = obj.getType().toLowerCase();
|
|
71554
|
-
for (const file of files) {
|
|
71555
|
-
const filename = file.getFilename().toLowerCase();
|
|
71556
|
-
if (filename.endsWith("." + type + ".json")) {
|
|
71557
|
-
hasJSON = true;
|
|
71558
|
-
}
|
|
71559
|
-
else if (filename.endsWith("." + type + ".xml")) {
|
|
71560
|
-
hasXML = true;
|
|
71561
|
-
}
|
|
71562
|
-
}
|
|
71563
|
-
if (hasJSON && hasXML) {
|
|
71564
|
-
const xmlFile = obj.getXMLFile();
|
|
71565
|
-
if (xmlFile) {
|
|
71566
|
-
const message = "Object has both AFF JSON and XML files, remove the XML";
|
|
71567
|
-
return [issue_1.Issue.atRow(xmlFile, 1, message, this.getMetadata().key, this.conf.severity)];
|
|
71568
|
-
}
|
|
71569
|
-
}
|
|
71570
|
-
return [];
|
|
71571
|
-
}
|
|
71572
|
-
}
|
|
71573
|
-
exports.AFFAndXML = AFFAndXML;
|
|
71574
|
-
//# sourceMappingURL=aff_and_xml.js.map
|
|
71735
|
+
exports.AbapdocHtmlTag = AbapdocHtmlTag;
|
|
71736
|
+
//# sourceMappingURL=abapdoc_html_tag.js.map
|
|
71575
71737
|
|
|
71576
71738
|
/***/ },
|
|
71577
71739
|
|
|
71578
|
-
/***/ "../core/build/src/rules/
|
|
71579
|
-
|
|
71580
|
-
!*** ../core/build/src/rules/
|
|
71581
|
-
|
|
71740
|
+
/***/ "../core/build/src/rules/abapdoc_leading_at.js"
|
|
71741
|
+
/*!*****************************************************!*\
|
|
71742
|
+
!*** ../core/build/src/rules/abapdoc_leading_at.js ***!
|
|
71743
|
+
\*****************************************************/
|
|
71744
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71745
|
+
|
|
71746
|
+
"use strict";
|
|
71747
|
+
|
|
71748
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
71749
|
+
if (k2 === undefined) k2 = k;
|
|
71750
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
71751
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
71752
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
71753
|
+
}
|
|
71754
|
+
Object.defineProperty(o, k2, desc);
|
|
71755
|
+
}) : (function(o, m, k, k2) {
|
|
71756
|
+
if (k2 === undefined) k2 = k;
|
|
71757
|
+
o[k2] = m[k];
|
|
71758
|
+
}));
|
|
71759
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
71760
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
71761
|
+
}) : function(o, v) {
|
|
71762
|
+
o["default"] = v;
|
|
71763
|
+
});
|
|
71764
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
71765
|
+
var ownKeys = function(o) {
|
|
71766
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
71767
|
+
var ar = [];
|
|
71768
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
71769
|
+
return ar;
|
|
71770
|
+
};
|
|
71771
|
+
return ownKeys(o);
|
|
71772
|
+
};
|
|
71773
|
+
return function (mod) {
|
|
71774
|
+
if (mod && mod.__esModule) return mod;
|
|
71775
|
+
var result = {};
|
|
71776
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
71777
|
+
__setModuleDefault(result, mod);
|
|
71778
|
+
return result;
|
|
71779
|
+
};
|
|
71780
|
+
})();
|
|
71781
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71782
|
+
exports.AbapdocLeadingAt = exports.AbapdocLeadingAtConf = void 0;
|
|
71783
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
71784
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
71785
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
71786
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
71787
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
71788
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
71789
|
+
class AbapdocLeadingAtConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71790
|
+
}
|
|
71791
|
+
exports.AbapdocLeadingAtConf = AbapdocLeadingAtConf;
|
|
71792
|
+
class AbapdocLeadingAt extends _abap_rule_1.ABAPRule {
|
|
71793
|
+
constructor() {
|
|
71794
|
+
super(...arguments);
|
|
71795
|
+
this.conf = new AbapdocLeadingAtConf();
|
|
71796
|
+
}
|
|
71797
|
+
getMetadata() {
|
|
71798
|
+
return {
|
|
71799
|
+
key: "abapdoc_leading_at",
|
|
71800
|
+
title: "ABAP Doc line starting with @",
|
|
71801
|
+
shortDescription: `Reports ABAP Doc lines starting with "@" which is not followed by a command.`,
|
|
71802
|
+
extendedInformation: `In ABAP Doc, "@" at the start of a line introduces a command, the commands are
|
|
71803
|
+
@parameter, @raising and @exception. Any other text after a leading "@", like a CDS annotation,
|
|
71804
|
+
gives the syntax warning 'A command was expected after ABAP Doc symbol "@"'.
|
|
71805
|
+
|
|
71806
|
+
An "@" in the middle of a line is plain text and not reported.
|
|
71807
|
+
|
|
71808
|
+
Only checks ABAP Doc inside class definitions and interfaces.`,
|
|
71809
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
71810
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
71811
|
+
PUBLIC SECTION.
|
|
71812
|
+
"! the first of
|
|
71813
|
+
"! @UI.presentationVariant sortOrder
|
|
71814
|
+
DATA mv_sort_field TYPE string.
|
|
71815
|
+
ENDCLASS.`,
|
|
71816
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
71817
|
+
PUBLIC SECTION.
|
|
71818
|
+
"! the first of @UI.presentationVariant
|
|
71819
|
+
"! sortOrder
|
|
71820
|
+
DATA mv_sort_field TYPE string.
|
|
71821
|
+
ENDCLASS.`,
|
|
71822
|
+
};
|
|
71823
|
+
}
|
|
71824
|
+
getConfig() {
|
|
71825
|
+
return this.conf;
|
|
71826
|
+
}
|
|
71827
|
+
setConfig(conf) {
|
|
71828
|
+
this.conf = conf;
|
|
71829
|
+
}
|
|
71830
|
+
runParsed(file) {
|
|
71831
|
+
const issues = [];
|
|
71832
|
+
let definition = false;
|
|
71833
|
+
for (const statement of file.getStatements()) {
|
|
71834
|
+
const type = statement.get();
|
|
71835
|
+
if (type instanceof Statements.ClassDefinition || type instanceof Statements.Interface) {
|
|
71836
|
+
definition = true;
|
|
71837
|
+
continue;
|
|
71838
|
+
}
|
|
71839
|
+
else if (type instanceof Statements.EndClass || type instanceof Statements.EndInterface) {
|
|
71840
|
+
definition = false;
|
|
71841
|
+
continue;
|
|
71842
|
+
}
|
|
71843
|
+
else if (definition === false || !(type instanceof _statement_1.Comment)) {
|
|
71844
|
+
continue;
|
|
71845
|
+
}
|
|
71846
|
+
const token = statement.getFirstToken();
|
|
71847
|
+
const str = token.getStr();
|
|
71848
|
+
if (str.startsWith(`"!`) === false) {
|
|
71849
|
+
continue;
|
|
71850
|
+
}
|
|
71851
|
+
const text = str.substring(2).trimStart();
|
|
71852
|
+
if (text.startsWith("@") === false
|
|
71853
|
+
|| text.match(/^@(parameter|raising|exception)(\s|$)/i) !== null) {
|
|
71854
|
+
continue;
|
|
71855
|
+
}
|
|
71856
|
+
const message = `A command was expected after ABAP Doc symbol "@", move the "@" away from the start of the line`;
|
|
71857
|
+
issues.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
71858
|
+
}
|
|
71859
|
+
return issues;
|
|
71860
|
+
}
|
|
71861
|
+
}
|
|
71862
|
+
exports.AbapdocLeadingAt = AbapdocLeadingAt;
|
|
71863
|
+
//# sourceMappingURL=abapdoc_leading_at.js.map
|
|
71864
|
+
|
|
71865
|
+
/***/ },
|
|
71866
|
+
|
|
71867
|
+
/***/ "../core/build/src/rules/abapdoc_parameter_names.js"
|
|
71868
|
+
/*!**********************************************************!*\
|
|
71869
|
+
!*** ../core/build/src/rules/abapdoc_parameter_names.js ***!
|
|
71870
|
+
\**********************************************************/
|
|
71871
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71872
|
+
|
|
71873
|
+
"use strict";
|
|
71874
|
+
|
|
71875
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
71876
|
+
if (k2 === undefined) k2 = k;
|
|
71877
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
71878
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
71879
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
71880
|
+
}
|
|
71881
|
+
Object.defineProperty(o, k2, desc);
|
|
71882
|
+
}) : (function(o, m, k, k2) {
|
|
71883
|
+
if (k2 === undefined) k2 = k;
|
|
71884
|
+
o[k2] = m[k];
|
|
71885
|
+
}));
|
|
71886
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
71887
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
71888
|
+
}) : function(o, v) {
|
|
71889
|
+
o["default"] = v;
|
|
71890
|
+
});
|
|
71891
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
71892
|
+
var ownKeys = function(o) {
|
|
71893
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
71894
|
+
var ar = [];
|
|
71895
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
71896
|
+
return ar;
|
|
71897
|
+
};
|
|
71898
|
+
return ownKeys(o);
|
|
71899
|
+
};
|
|
71900
|
+
return function (mod) {
|
|
71901
|
+
if (mod && mod.__esModule) return mod;
|
|
71902
|
+
var result = {};
|
|
71903
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
71904
|
+
__setModuleDefault(result, mod);
|
|
71905
|
+
return result;
|
|
71906
|
+
};
|
|
71907
|
+
})();
|
|
71908
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71909
|
+
exports.AbapdocParameterNames = exports.AbapdocParameterNamesConf = void 0;
|
|
71910
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
71911
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
71912
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
71913
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
71914
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
71915
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
71916
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
71917
|
+
class AbapdocParameterNamesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
71918
|
+
}
|
|
71919
|
+
exports.AbapdocParameterNamesConf = AbapdocParameterNamesConf;
|
|
71920
|
+
class AbapdocParameterNames extends _abap_rule_1.ABAPRule {
|
|
71921
|
+
constructor() {
|
|
71922
|
+
super(...arguments);
|
|
71923
|
+
this.conf = new AbapdocParameterNamesConf();
|
|
71924
|
+
}
|
|
71925
|
+
getMetadata() {
|
|
71926
|
+
return {
|
|
71927
|
+
key: "abapdoc_parameter_names",
|
|
71928
|
+
title: "ABAP Doc parameter names",
|
|
71929
|
+
shortDescription: `Checks that the parameters documented in ABAP Doc exist in the method definition.`,
|
|
71930
|
+
extendedInformation: `Reports "! @parameter lines in the ABAP Doc block in front of a METHODS or CLASS-METHODS
|
|
71931
|
+
definition when the parameter is not a parameter of the method, typically after a parameter was renamed or removed.
|
|
71932
|
+
Also reports a parameter documented twice.
|
|
71933
|
+
|
|
71934
|
+
Missing @parameter lines are not reported, documenting parameters is optional. @raising and @exception lines are not checked.
|
|
71935
|
+
|
|
71936
|
+
Only the block directly in front of the method is checked, a blank line or a plain comment ends the block,
|
|
71937
|
+
see rule wrong_abapdoc_position for misplaced ABAP Doc.`,
|
|
71938
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
71939
|
+
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
71940
|
+
PUBLIC SECTION.
|
|
71941
|
+
"! @parameter iv_bar | Bar
|
|
71942
|
+
METHODS foo IMPORTING iv_foo TYPE i.
|
|
71943
|
+
ENDCLASS.`,
|
|
71944
|
+
goodExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
71945
|
+
PUBLIC SECTION.
|
|
71946
|
+
"! @parameter iv_foo | Foo
|
|
71947
|
+
METHODS foo IMPORTING iv_foo TYPE i.
|
|
71948
|
+
ENDCLASS.`,
|
|
71949
|
+
};
|
|
71950
|
+
}
|
|
71951
|
+
getConfig() {
|
|
71952
|
+
return this.conf;
|
|
71953
|
+
}
|
|
71954
|
+
setConfig(conf) {
|
|
71955
|
+
this.conf = conf;
|
|
71956
|
+
}
|
|
71957
|
+
runParsed(file) {
|
|
71958
|
+
var _a;
|
|
71959
|
+
const issues = [];
|
|
71960
|
+
const statements = file.getStatements();
|
|
71961
|
+
for (let i = 0; i < statements.length; i++) {
|
|
71962
|
+
const def = statements[i];
|
|
71963
|
+
if (!(def.get() instanceof Statements.MethodDef)) {
|
|
71964
|
+
continue;
|
|
71965
|
+
}
|
|
71966
|
+
const name = def.findDirectExpression(Expressions.MethodName);
|
|
71967
|
+
if (name === undefined) {
|
|
71968
|
+
continue;
|
|
71969
|
+
}
|
|
71970
|
+
const abapdoc = [];
|
|
71971
|
+
let nextRow = undefined;
|
|
71972
|
+
for (let j = i - 1; j >= 0 && statements[j].get() instanceof _statement_1.Comment; j--) {
|
|
71973
|
+
const comment = statements[j];
|
|
71974
|
+
const start = comment.getStart();
|
|
71975
|
+
if (start.isAfter(name.getFirstToken().getStart())) {
|
|
71976
|
+
continue; // comment inside the statement, after the method name
|
|
71977
|
+
}
|
|
71978
|
+
nextRow = nextRow !== null && nextRow !== void 0 ? nextRow : (_a = def.getTokens().find(t => t.getStart().isAfter(start))) === null || _a === void 0 ? void 0 : _a.getStart().getRow();
|
|
71979
|
+
if (this.isAbapdoc(comment, def) === false || start.getRow() + 1 !== nextRow) {
|
|
71980
|
+
break; // a blank line or a plain comment ends the block
|
|
71981
|
+
}
|
|
71982
|
+
abapdoc.unshift(comment);
|
|
71983
|
+
nextRow = start.getRow();
|
|
71984
|
+
}
|
|
71985
|
+
if (abapdoc.length === 0) {
|
|
71986
|
+
continue;
|
|
71987
|
+
}
|
|
71988
|
+
const parameters = def.findAllExpressions(Expressions.MethodParamName)
|
|
71989
|
+
.map(p => p.getFirstToken().getStr().replace(/^!/, "").toUpperCase());
|
|
71990
|
+
const documented = new Set();
|
|
71991
|
+
for (const comment of abapdoc) {
|
|
71992
|
+
const match = comment.getFirstToken().getStr().match(/^"!\s*@parameter\s+!?([^\s|]+)/i);
|
|
71993
|
+
if (match === null) {
|
|
71994
|
+
continue;
|
|
71995
|
+
}
|
|
71996
|
+
const parameter = match[1].toUpperCase();
|
|
71997
|
+
let message = undefined;
|
|
71998
|
+
if (parameters.includes(parameter) === false) {
|
|
71999
|
+
message = `ABAP Doc parameter "${match[1]}" is not a parameter of method ${name.concatTokens()}`;
|
|
72000
|
+
}
|
|
72001
|
+
else if (documented.has(parameter) === true) {
|
|
72002
|
+
message = `ABAP Doc parameter "${match[1]}" documented more than once`;
|
|
72003
|
+
}
|
|
72004
|
+
documented.add(parameter);
|
|
72005
|
+
if (message !== undefined) {
|
|
72006
|
+
issues.push(issue_1.Issue.atStatement(file, comment, message, this.getMetadata().key, this.conf.severity));
|
|
72007
|
+
}
|
|
72008
|
+
}
|
|
72009
|
+
}
|
|
72010
|
+
return issues;
|
|
72011
|
+
}
|
|
72012
|
+
/** ABAP Doc in front of the method name, after the colon of a chain */
|
|
72013
|
+
isAbapdoc(comment, def) {
|
|
72014
|
+
if (comment.getFirstToken().getStr().startsWith(`"!`) === false) {
|
|
72015
|
+
return false;
|
|
72016
|
+
}
|
|
72017
|
+
const colon = def.getColon();
|
|
72018
|
+
return colon === undefined || comment.getStart().isAfter(colon.getStart());
|
|
72019
|
+
}
|
|
72020
|
+
}
|
|
72021
|
+
exports.AbapdocParameterNames = AbapdocParameterNames;
|
|
72022
|
+
//# sourceMappingURL=abapdoc_parameter_names.js.map
|
|
72023
|
+
|
|
72024
|
+
/***/ },
|
|
72025
|
+
|
|
72026
|
+
/***/ "../core/build/src/rules/add_test_attributes.js"
|
|
72027
|
+
/*!******************************************************!*\
|
|
72028
|
+
!*** ../core/build/src/rules/add_test_attributes.js ***!
|
|
72029
|
+
\******************************************************/
|
|
72030
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
72031
|
+
|
|
72032
|
+
"use strict";
|
|
72033
|
+
|
|
72034
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
72035
|
+
if (k2 === undefined) k2 = k;
|
|
72036
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
72037
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
72038
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
72039
|
+
}
|
|
72040
|
+
Object.defineProperty(o, k2, desc);
|
|
72041
|
+
}) : (function(o, m, k, k2) {
|
|
72042
|
+
if (k2 === undefined) k2 = k;
|
|
72043
|
+
o[k2] = m[k];
|
|
72044
|
+
}));
|
|
72045
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
72046
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
72047
|
+
}) : function(o, v) {
|
|
72048
|
+
o["default"] = v;
|
|
72049
|
+
});
|
|
72050
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
72051
|
+
var ownKeys = function(o) {
|
|
72052
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
72053
|
+
var ar = [];
|
|
72054
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
72055
|
+
return ar;
|
|
72056
|
+
};
|
|
72057
|
+
return ownKeys(o);
|
|
72058
|
+
};
|
|
72059
|
+
return function (mod) {
|
|
72060
|
+
if (mod && mod.__esModule) return mod;
|
|
72061
|
+
var result = {};
|
|
72062
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
72063
|
+
__setModuleDefault(result, mod);
|
|
72064
|
+
return result;
|
|
72065
|
+
};
|
|
72066
|
+
})();
|
|
72067
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72068
|
+
exports.AddTestAttributes = exports.AddTestAttributesConf = void 0;
|
|
72069
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
72070
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
72071
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
72072
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
72073
|
+
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
72074
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
72075
|
+
class AddTestAttributesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
72076
|
+
}
|
|
72077
|
+
exports.AddTestAttributesConf = AddTestAttributesConf;
|
|
72078
|
+
class AddTestAttributes extends _abap_rule_1.ABAPRule {
|
|
72079
|
+
constructor() {
|
|
72080
|
+
super(...arguments);
|
|
72081
|
+
this.conf = new AddTestAttributesConf();
|
|
72082
|
+
}
|
|
72083
|
+
getMetadata() {
|
|
72084
|
+
return {
|
|
72085
|
+
key: "add_test_attributes",
|
|
72086
|
+
title: "Add test attributes for tests classes with test methods",
|
|
72087
|
+
shortDescription: `Add test attributes DURATION and RISK LEVEL for tests classes with test methods`,
|
|
72088
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
72089
|
+
badExample: `CLASS ltcl_test1 DEFINITION FINAL FOR TESTING.
|
|
72090
|
+
PUBLIC SECTION.
|
|
72091
|
+
PROTECTED SECTION.
|
|
72092
|
+
PRIVATE SECTION.
|
|
72093
|
+
METHODS test FOR TESTING RAISING cx_static_check.
|
|
72094
|
+
ENDCLASS.
|
|
72095
|
+
|
|
72096
|
+
CLASS ltcl_test1 IMPLEMENTATION.
|
|
72097
|
+
METHOD test.
|
|
72098
|
+
ENDMETHOD.
|
|
72099
|
+
ENDCLASS.`,
|
|
72100
|
+
goodExample: `CLASS ltcl_test2 DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
|
72101
|
+
PUBLIC SECTION.
|
|
72102
|
+
PROTECTED SECTION.
|
|
72103
|
+
PRIVATE SECTION.
|
|
72104
|
+
METHODS test FOR TESTING RAISING cx_static_check.
|
|
72105
|
+
ENDCLASS.
|
|
72106
|
+
|
|
72107
|
+
CLASS ltcl_test2 IMPLEMENTATION.
|
|
72108
|
+
METHOD test.
|
|
72109
|
+
ENDMETHOD.
|
|
72110
|
+
ENDCLASS.`,
|
|
72111
|
+
};
|
|
72112
|
+
}
|
|
72113
|
+
getConfig() {
|
|
72114
|
+
return this.conf;
|
|
72115
|
+
}
|
|
72116
|
+
setConfig(conf) {
|
|
72117
|
+
this.conf = conf;
|
|
72118
|
+
}
|
|
72119
|
+
runParsed(file) {
|
|
72120
|
+
const issues = [];
|
|
72121
|
+
const stru = file.getStructure();
|
|
72122
|
+
if (stru === undefined) {
|
|
72123
|
+
return [];
|
|
72124
|
+
}
|
|
72125
|
+
for (const classStructure of stru.findAllStructures(Structures.ClassDefinition)) {
|
|
72126
|
+
const cdef = classStructure.findFirstStatement(Statements.ClassDefinition);
|
|
72127
|
+
if (cdef === undefined) {
|
|
72128
|
+
continue;
|
|
72129
|
+
}
|
|
72130
|
+
const cdefConcat = cdef === null || cdef === void 0 ? void 0 : cdef.concatTokens().toUpperCase();
|
|
72131
|
+
if ((cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" FOR TESTING")) === false) {
|
|
72132
|
+
continue;
|
|
72133
|
+
}
|
|
72134
|
+
const hasDuration = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" DURATION ");
|
|
72135
|
+
const hasRiskLevel = cdefConcat === null || cdefConcat === void 0 ? void 0 : cdefConcat.includes(" RISK LEVEL ");
|
|
72136
|
+
if (hasDuration === true && hasRiskLevel === true) {
|
|
72137
|
+
continue;
|
|
72138
|
+
}
|
|
72139
|
+
let hasTestMethod = false;
|
|
72140
|
+
for (const mdef of classStructure.findAllStatements(Statements.MethodDef)) {
|
|
72141
|
+
const concat = mdef.concatTokens().toUpperCase();
|
|
72142
|
+
if (concat.includes(" FOR TESTING")) {
|
|
72143
|
+
hasTestMethod = true;
|
|
72144
|
+
}
|
|
72145
|
+
}
|
|
72146
|
+
if (hasTestMethod === false) {
|
|
72147
|
+
continue;
|
|
72148
|
+
}
|
|
72149
|
+
if (hasDuration === false) {
|
|
72150
|
+
issues.push(issue_1.Issue.atStatement(file, cdef, "Add DURATION", this.getMetadata().key, this.getConfig().severity));
|
|
72151
|
+
}
|
|
72152
|
+
if (hasRiskLevel === false) {
|
|
72153
|
+
issues.push(issue_1.Issue.atStatement(file, cdef, "Add RISK LEVEL", this.getMetadata().key, this.getConfig().severity));
|
|
72154
|
+
}
|
|
72155
|
+
}
|
|
72156
|
+
return issues;
|
|
72157
|
+
}
|
|
72158
|
+
}
|
|
72159
|
+
exports.AddTestAttributes = AddTestAttributes;
|
|
72160
|
+
//# sourceMappingURL=add_test_attributes.js.map
|
|
72161
|
+
|
|
72162
|
+
/***/ },
|
|
72163
|
+
|
|
72164
|
+
/***/ "../core/build/src/rules/aff_and_xml.js"
|
|
72165
|
+
/*!**********************************************!*\
|
|
72166
|
+
!*** ../core/build/src/rules/aff_and_xml.js ***!
|
|
72167
|
+
\**********************************************/
|
|
72168
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
72169
|
+
|
|
72170
|
+
"use strict";
|
|
72171
|
+
|
|
72172
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
72173
|
+
exports.AFFAndXML = exports.AFFAndXMLConf = void 0;
|
|
72174
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
72175
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
72176
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
72177
|
+
class AFFAndXMLConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
72178
|
+
}
|
|
72179
|
+
exports.AFFAndXMLConf = AFFAndXMLConf;
|
|
72180
|
+
class AFFAndXML {
|
|
72181
|
+
constructor() {
|
|
72182
|
+
this.conf = new AFFAndXMLConf();
|
|
72183
|
+
}
|
|
72184
|
+
getMetadata() {
|
|
72185
|
+
return {
|
|
72186
|
+
key: "aff_and_xml",
|
|
72187
|
+
title: "AFF and XML",
|
|
72188
|
+
shortDescription: `Checks for objects that have both AFF (.json) and XML (.xml) files`,
|
|
72189
|
+
extendedInformation: `If an object has both an ABAP file format JSON file and an XML file, the XML file should be removed`,
|
|
72190
|
+
tags: [_irule_1.RuleTag.Syntax],
|
|
72191
|
+
};
|
|
72192
|
+
}
|
|
72193
|
+
getConfig() {
|
|
72194
|
+
return this.conf;
|
|
72195
|
+
}
|
|
72196
|
+
setConfig(conf) {
|
|
72197
|
+
this.conf = conf;
|
|
72198
|
+
}
|
|
72199
|
+
initialize(_reg) {
|
|
72200
|
+
return this;
|
|
72201
|
+
}
|
|
72202
|
+
run(obj) {
|
|
72203
|
+
const files = obj.getFiles();
|
|
72204
|
+
let hasJSON = false;
|
|
72205
|
+
let hasXML = false;
|
|
72206
|
+
const type = obj.getType().toLowerCase();
|
|
72207
|
+
for (const file of files) {
|
|
72208
|
+
const filename = file.getFilename().toLowerCase();
|
|
72209
|
+
if (filename.endsWith("." + type + ".json")) {
|
|
72210
|
+
hasJSON = true;
|
|
72211
|
+
}
|
|
72212
|
+
else if (filename.endsWith("." + type + ".xml")) {
|
|
72213
|
+
hasXML = true;
|
|
72214
|
+
}
|
|
72215
|
+
}
|
|
72216
|
+
if (hasJSON && hasXML) {
|
|
72217
|
+
const xmlFile = obj.getXMLFile();
|
|
72218
|
+
if (xmlFile) {
|
|
72219
|
+
const message = "Object has both AFF JSON and XML files, remove the XML";
|
|
72220
|
+
return [issue_1.Issue.atRow(xmlFile, 1, message, this.getMetadata().key, this.conf.severity)];
|
|
72221
|
+
}
|
|
72222
|
+
}
|
|
72223
|
+
return [];
|
|
72224
|
+
}
|
|
72225
|
+
}
|
|
72226
|
+
exports.AFFAndXML = AFFAndXML;
|
|
72227
|
+
//# sourceMappingURL=aff_and_xml.js.map
|
|
72228
|
+
|
|
72229
|
+
/***/ },
|
|
72230
|
+
|
|
72231
|
+
/***/ "../core/build/src/rules/align_parameters.js"
|
|
72232
|
+
/*!***************************************************!*\
|
|
72233
|
+
!*** ../core/build/src/rules/align_parameters.js ***!
|
|
72234
|
+
\***************************************************/
|
|
71582
72235
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
71583
72236
|
|
|
71584
72237
|
"use strict";
|
|
@@ -73670,10 +74323,10 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
73670
74323
|
let searchable;
|
|
73671
74324
|
for (const annotation of tree.findAllExpressionsRecursive(expressions_1.CDSAnnotation)) {
|
|
73672
74325
|
const normalized = annotation.concatTokens().replace(/\s/g, "").toUpperCase().replace(/^@</, "@");
|
|
73673
|
-
if (this.hasSearchAnnotation(normalized,
|
|
74326
|
+
if (this.hasSearchAnnotation(normalized, /[.{,]DEFAULTSEARCHELEMENT:TRUE/)) {
|
|
73674
74327
|
return;
|
|
73675
74328
|
}
|
|
73676
|
-
else if (searchable === undefined && this.hasSearchAnnotation(normalized,
|
|
74329
|
+
else if (searchable === undefined && this.hasSearchAnnotation(normalized, /[.{,]SEARCHABLE:TRUE/)) {
|
|
73677
74330
|
searchable = annotation;
|
|
73678
74331
|
}
|
|
73679
74332
|
}
|
|
@@ -73683,11 +74336,11 @@ Missing objects are only reported when their names match the configured errorNam
|
|
|
73683
74336
|
issues.push(issue_1.Issue.atToken(file, searchable.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
73684
74337
|
}
|
|
73685
74338
|
}
|
|
73686
|
-
hasSearchAnnotation(normalized,
|
|
74339
|
+
hasSearchAnnotation(normalized, annotation) {
|
|
73687
74340
|
if (normalized.startsWith("@SEARCH") === false) {
|
|
73688
74341
|
return false;
|
|
73689
74342
|
}
|
|
73690
|
-
return
|
|
74343
|
+
return annotation.test(normalized);
|
|
73691
74344
|
}
|
|
73692
74345
|
checkReservedNames(tree, issues, file) {
|
|
73693
74346
|
var _a, _b;
|
|
@@ -74505,147 +75158,393 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
74505
75158
|
};
|
|
74506
75159
|
})();
|
|
74507
75160
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
74508
|
-
exports.ChangeIfToCase = exports.ChangeIfToCaseConf = void 0;
|
|
74509
|
-
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
75161
|
+
exports.ChangeIfToCase = exports.ChangeIfToCaseConf = void 0;
|
|
75162
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
75163
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
75164
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
75165
|
+
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
75166
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
75167
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
75168
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
75169
|
+
class ChangeIfToCaseConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
75170
|
+
constructor() {
|
|
75171
|
+
super(...arguments);
|
|
75172
|
+
/** skip specific names, case insensitive regular expression
|
|
75173
|
+
* @uniqueItems true
|
|
75174
|
+
*/
|
|
75175
|
+
this.skipNames = [];
|
|
75176
|
+
}
|
|
75177
|
+
}
|
|
75178
|
+
exports.ChangeIfToCaseConf = ChangeIfToCaseConf;
|
|
75179
|
+
class ChangeIfToCase extends _abap_rule_1.ABAPRule {
|
|
75180
|
+
constructor() {
|
|
75181
|
+
super(...arguments);
|
|
75182
|
+
this.conf = new ChangeIfToCaseConf();
|
|
75183
|
+
this.skipNames = [];
|
|
75184
|
+
}
|
|
75185
|
+
getMetadata() {
|
|
75186
|
+
return {
|
|
75187
|
+
key: "change_if_to_case",
|
|
75188
|
+
title: "Change IF to CASE",
|
|
75189
|
+
shortDescription: `Finds IF constructs that can be changed to CASE`,
|
|
75190
|
+
// eslint-disable-next-line max-len
|
|
75191
|
+
extendedInformation: `https://github.com/SAP/styleguides/blob/main/clean-abap/CleanABAP.md#prefer-case-to-else-if-for-multiple-alternative-conditions
|
|
75192
|
+
|
|
75193
|
+
If the first comparison is a boolean compare, no issue is reported.`,
|
|
75194
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Styleguide],
|
|
75195
|
+
badExample: `IF l_fcat-fieldname EQ 'FOO'.
|
|
75196
|
+
ELSEIF l_fcat-fieldname = 'BAR'
|
|
75197
|
+
OR l_fcat-fieldname = 'MOO'.
|
|
75198
|
+
ENDIF.`,
|
|
75199
|
+
goodExample: `CASE l_fcat-fieldname.
|
|
75200
|
+
WHEN 'FOO'.
|
|
75201
|
+
WHEN 'BAR' OR 'MOO'.
|
|
75202
|
+
ENDCASE.`,
|
|
75203
|
+
};
|
|
75204
|
+
}
|
|
75205
|
+
getConfig() {
|
|
75206
|
+
return this.conf;
|
|
75207
|
+
}
|
|
75208
|
+
setConfig(conf) {
|
|
75209
|
+
this.conf = conf;
|
|
75210
|
+
this.skipNames = (this.conf.skipNames || []).map(skip => new RegExp(skip, "i"));
|
|
75211
|
+
}
|
|
75212
|
+
runParsed(file) {
|
|
75213
|
+
var _a;
|
|
75214
|
+
const issues = [];
|
|
75215
|
+
const stru = file.getStructure();
|
|
75216
|
+
if (stru === undefined) {
|
|
75217
|
+
return issues;
|
|
75218
|
+
}
|
|
75219
|
+
for (const i of stru.findAllStructuresRecursive(Structures.If)) {
|
|
75220
|
+
const conds = [];
|
|
75221
|
+
const ifStatement = i.findDirectStatement(Statements.If);
|
|
75222
|
+
if (ifStatement === undefined) {
|
|
75223
|
+
continue;
|
|
75224
|
+
}
|
|
75225
|
+
if (ifStatement.concatTokens().match(/ (abap_true|abap_false)\s*\./i)) {
|
|
75226
|
+
continue;
|
|
75227
|
+
}
|
|
75228
|
+
conds.push(ifStatement === null || ifStatement === void 0 ? void 0 : ifStatement.findDirectExpression(Expressions.Cond));
|
|
75229
|
+
for (const ei of i.findDirectStructures(Structures.ElseIf)) {
|
|
75230
|
+
conds.push((_a = ei.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond));
|
|
75231
|
+
}
|
|
75232
|
+
if (conds.length === 1) {
|
|
75233
|
+
continue;
|
|
75234
|
+
}
|
|
75235
|
+
const issue = this.analyze(conds);
|
|
75236
|
+
if (issue === true) {
|
|
75237
|
+
const message = "Change IF to CASE";
|
|
75238
|
+
issues.push(issue_1.Issue.atStatement(file, ifStatement, message, this.getMetadata().key, this.getConfig().severity));
|
|
75239
|
+
}
|
|
75240
|
+
}
|
|
75241
|
+
return issues;
|
|
75242
|
+
}
|
|
75243
|
+
analyze(conds) {
|
|
75244
|
+
var _a, _b, _c, _d, _e;
|
|
75245
|
+
const tuples = [];
|
|
75246
|
+
for (const c of conds) {
|
|
75247
|
+
if (c === undefined) {
|
|
75248
|
+
continue;
|
|
75249
|
+
}
|
|
75250
|
+
if (c.findFirstExpression(Expressions.CondSub)) {
|
|
75251
|
+
return false;
|
|
75252
|
+
}
|
|
75253
|
+
else if (c.findDirectTokenByText("AND") || c.findDirectTokenByText("EQUIV")) {
|
|
75254
|
+
return false;
|
|
75255
|
+
}
|
|
75256
|
+
for (const compare of c.findAllExpressions(Expressions.Compare)) {
|
|
75257
|
+
const op = (_a = compare.findDirectExpression(Expressions.CompareOperator)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
75258
|
+
if (compare.getChildren().length !== 3) {
|
|
75259
|
+
return false;
|
|
75260
|
+
}
|
|
75261
|
+
else if (op !== "=" && op !== "EQ") {
|
|
75262
|
+
return false;
|
|
75263
|
+
}
|
|
75264
|
+
const left = (_c = (_b = compare.getChildren()[0]) === null || _b === void 0 ? void 0 : _b.concatTokens()) === null || _c === void 0 ? void 0 : _c.toUpperCase();
|
|
75265
|
+
const right = (_e = (_d = compare.getChildren()[2]) === null || _d === void 0 ? void 0 : _d.concatTokens()) === null || _e === void 0 ? void 0 : _e.toUpperCase();
|
|
75266
|
+
tuples.push({ left, right });
|
|
75267
|
+
}
|
|
75268
|
+
}
|
|
75269
|
+
if (tuples.length === 1) {
|
|
75270
|
+
return false;
|
|
75271
|
+
}
|
|
75272
|
+
let chain;
|
|
75273
|
+
if (tuples[0].left === tuples[1].left) {
|
|
75274
|
+
chain = tuples[0].left;
|
|
75275
|
+
}
|
|
75276
|
+
else if (tuples[0].left === tuples[1].right) {
|
|
75277
|
+
chain = tuples[0].left;
|
|
75278
|
+
}
|
|
75279
|
+
else if (tuples[0].right === tuples[1].right) {
|
|
75280
|
+
chain = tuples[0].right;
|
|
75281
|
+
}
|
|
75282
|
+
else if (tuples[0].right === tuples[1].left) {
|
|
75283
|
+
chain = tuples[0].right;
|
|
75284
|
+
}
|
|
75285
|
+
else {
|
|
75286
|
+
return false;
|
|
75287
|
+
}
|
|
75288
|
+
for (const reg of this.skipNames) {
|
|
75289
|
+
if (chain.match(reg)) {
|
|
75290
|
+
return false;
|
|
75291
|
+
}
|
|
75292
|
+
}
|
|
75293
|
+
for (const t of tuples) {
|
|
75294
|
+
if (t.left !== chain && t.right !== chain) {
|
|
75295
|
+
return false;
|
|
75296
|
+
}
|
|
75297
|
+
}
|
|
75298
|
+
return true;
|
|
75299
|
+
}
|
|
75300
|
+
}
|
|
75301
|
+
exports.ChangeIfToCase = ChangeIfToCase;
|
|
75302
|
+
//# sourceMappingURL=change_if_to_case.js.map
|
|
75303
|
+
|
|
75304
|
+
/***/ },
|
|
75305
|
+
|
|
75306
|
+
/***/ "../core/build/src/rules/changing_sorted_line.js"
|
|
75307
|
+
/*!*******************************************************!*\
|
|
75308
|
+
!*** ../core/build/src/rules/changing_sorted_line.js ***!
|
|
75309
|
+
\*******************************************************/
|
|
75310
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
75311
|
+
|
|
75312
|
+
"use strict";
|
|
75313
|
+
|
|
75314
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
75315
|
+
if (k2 === undefined) k2 = k;
|
|
75316
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
75317
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
75318
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
75319
|
+
}
|
|
75320
|
+
Object.defineProperty(o, k2, desc);
|
|
75321
|
+
}) : (function(o, m, k, k2) {
|
|
75322
|
+
if (k2 === undefined) k2 = k;
|
|
75323
|
+
o[k2] = m[k];
|
|
75324
|
+
}));
|
|
75325
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
75326
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
75327
|
+
}) : function(o, v) {
|
|
75328
|
+
o["default"] = v;
|
|
75329
|
+
});
|
|
75330
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
75331
|
+
var ownKeys = function(o) {
|
|
75332
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
75333
|
+
var ar = [];
|
|
75334
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
75335
|
+
return ar;
|
|
75336
|
+
};
|
|
75337
|
+
return ownKeys(o);
|
|
75338
|
+
};
|
|
75339
|
+
return function (mod) {
|
|
75340
|
+
if (mod && mod.__esModule) return mod;
|
|
75341
|
+
var result = {};
|
|
75342
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
75343
|
+
__setModuleDefault(result, mod);
|
|
75344
|
+
return result;
|
|
75345
|
+
};
|
|
75346
|
+
})();
|
|
75347
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
75348
|
+
exports.ChangingSortedLine = exports.ChangingSortedLineConf = void 0;
|
|
74510
75349
|
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
74511
75350
|
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
74512
75351
|
const Structures = __importStar(__webpack_require__(/*! ../abap/3_structures/structures */ "../core/build/src/abap/3_structures/structures/index.js"));
|
|
74513
|
-
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
74514
75352
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
75353
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
74515
75354
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
74516
|
-
|
|
74517
|
-
|
|
74518
|
-
|
|
74519
|
-
|
|
74520
|
-
|
|
74521
|
-
|
|
74522
|
-
|
|
74523
|
-
}
|
|
75355
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
75356
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
75357
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
75358
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
75359
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
75360
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
75361
|
+
class ChangingSortedLineConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
74524
75362
|
}
|
|
74525
|
-
exports.
|
|
74526
|
-
class
|
|
75363
|
+
exports.ChangingSortedLineConf = ChangingSortedLineConf;
|
|
75364
|
+
class ChangingSortedLine {
|
|
74527
75365
|
constructor() {
|
|
74528
|
-
|
|
74529
|
-
this.conf = new ChangeIfToCaseConf();
|
|
75366
|
+
this.conf = new ChangingSortedLineConf();
|
|
74530
75367
|
}
|
|
74531
75368
|
getMetadata() {
|
|
74532
75369
|
return {
|
|
74533
|
-
key: "
|
|
74534
|
-
title: "
|
|
74535
|
-
shortDescription: `
|
|
74536
|
-
|
|
74537
|
-
|
|
74538
|
-
|
|
74539
|
-
|
|
74540
|
-
|
|
74541
|
-
|
|
74542
|
-
|
|
74543
|
-
|
|
74544
|
-
|
|
74545
|
-
|
|
74546
|
-
|
|
74547
|
-
|
|
74548
|
-
|
|
75370
|
+
key: "changing_sorted_line",
|
|
75371
|
+
title: "Line of a sorted or hashed table passed to CHANGING",
|
|
75372
|
+
shortDescription: `A field symbol on a whole line of a sorted or hashed table, passed to a CHANGING parameter of a method`,
|
|
75373
|
+
extendedInformation: `The key fields of a sorted or hashed table line are write-protected, so the line as a whole is
|
|
75374
|
+
write-protected. Binding it to a CHANGING parameter activates, but the call fails at runtime with
|
|
75375
|
+
CX_SY_DYN_CALL_ILLEGAL_TYPE, "the actual parameter for ... is write-protected", even when the method does not
|
|
75376
|
+
change the key.
|
|
75377
|
+
|
|
75378
|
+
Only field symbols assigned in the same method, form or function module are checked, via READ TABLE ... ASSIGNING,
|
|
75379
|
+
LOOP AT ... ASSIGNING, INSERT ... INTO TABLE ... ASSIGNING and ASSIGN itab[ ... ] TO.
|
|
75380
|
+
|
|
75381
|
+
Fix: read the line into a work area, pass the work area and MODIFY TABLE ... FROM it afterwards,
|
|
75382
|
+
or pass only the non-key fields the method needs.`,
|
|
75383
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
75384
|
+
badExample: `READ TABLE lt_sum WITH TABLE KEY app = lv_app ASSIGNING FIELD-SYMBOL(<sum>).
|
|
75385
|
+
add( CHANGING cs_sum = <sum> ).`,
|
|
75386
|
+
goodExample: `READ TABLE lt_sum WITH TABLE KEY app = lv_app INTO DATA(ls_sum).
|
|
75387
|
+
add( CHANGING cs_sum = ls_sum ).
|
|
75388
|
+
MODIFY TABLE lt_sum FROM ls_sum.`,
|
|
74549
75389
|
};
|
|
74550
75390
|
}
|
|
74551
75391
|
getConfig() {
|
|
74552
75392
|
return this.conf;
|
|
74553
75393
|
}
|
|
75394
|
+
initialize(reg) {
|
|
75395
|
+
this.reg = reg;
|
|
75396
|
+
return this;
|
|
75397
|
+
}
|
|
74554
75398
|
setConfig(conf) {
|
|
74555
75399
|
this.conf = conf;
|
|
74556
75400
|
}
|
|
74557
|
-
|
|
74558
|
-
|
|
74559
|
-
|
|
74560
|
-
const stru = file.getStructure();
|
|
74561
|
-
if (stru === undefined) {
|
|
74562
|
-
return issues;
|
|
75401
|
+
run(obj) {
|
|
75402
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
|
|
75403
|
+
return [];
|
|
74563
75404
|
}
|
|
74564
|
-
|
|
74565
|
-
|
|
74566
|
-
|
|
74567
|
-
|
|
74568
|
-
|
|
74569
|
-
}
|
|
74570
|
-
if (ifStatement.concatTokens().match(/ (abap_true|abap_false)\s*\./i)) {
|
|
74571
|
-
continue;
|
|
74572
|
-
}
|
|
74573
|
-
conds.push(ifStatement === null || ifStatement === void 0 ? void 0 : ifStatement.findDirectExpression(Expressions.Cond));
|
|
74574
|
-
for (const ei of i.findDirectStructures(Structures.ElseIf)) {
|
|
74575
|
-
conds.push((_a = ei.findDirectStatement(Statements.ElseIf)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.Cond));
|
|
74576
|
-
}
|
|
74577
|
-
if (conds.length === 1) {
|
|
75405
|
+
const issues = [];
|
|
75406
|
+
let spaghetti = undefined;
|
|
75407
|
+
for (const file of obj.getABAPFiles()) {
|
|
75408
|
+
const stru = file.getStructure();
|
|
75409
|
+
if (stru === undefined || stru.findFirstExpression(Expressions.MethodParameters) === undefined) {
|
|
74578
75410
|
continue;
|
|
74579
75411
|
}
|
|
74580
|
-
|
|
74581
|
-
|
|
74582
|
-
|
|
74583
|
-
|
|
75412
|
+
if (spaghetti === undefined) {
|
|
75413
|
+
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
75414
|
+
}
|
|
75415
|
+
const blocks = [...stru.findAllStructures(Structures.Method),
|
|
75416
|
+
...stru.findAllStructures(Structures.Form),
|
|
75417
|
+
...stru.findAllStructures(Structures.FunctionModule)];
|
|
75418
|
+
for (const block of blocks) {
|
|
75419
|
+
// field symbol name -> name of the sorted or hashed table it points into
|
|
75420
|
+
const lines = new Map();
|
|
75421
|
+
for (const statement of block.findAllStatementNodes()) {
|
|
75422
|
+
for (const p of statement.findAllExpressions(Expressions.MethodParameters)) {
|
|
75423
|
+
this.checkChanging(p, lines, spaghetti, file, issues);
|
|
75424
|
+
}
|
|
75425
|
+
this.updateAssigned(statement, lines, spaghetti, file);
|
|
75426
|
+
}
|
|
74584
75427
|
}
|
|
74585
75428
|
}
|
|
74586
75429
|
return issues;
|
|
74587
75430
|
}
|
|
74588
|
-
|
|
74589
|
-
|
|
74590
|
-
|
|
74591
|
-
|
|
74592
|
-
|
|
74593
|
-
|
|
74594
|
-
|
|
74595
|
-
|
|
74596
|
-
|
|
74597
|
-
|
|
74598
|
-
|
|
74599
|
-
|
|
74600
|
-
|
|
74601
|
-
|
|
74602
|
-
|
|
74603
|
-
|
|
74604
|
-
|
|
74605
|
-
|
|
74606
|
-
|
|
74607
|
-
|
|
75431
|
+
////////////////
|
|
75432
|
+
checkChanging(params, lines, spaghetti, file, issues) {
|
|
75433
|
+
var _a, _b;
|
|
75434
|
+
let changing = false;
|
|
75435
|
+
for (const child of params.getChildren()) {
|
|
75436
|
+
const str = child.concatTokens().toUpperCase();
|
|
75437
|
+
if (child instanceof nodes_1.ExpressionNode && changing === true && child.get() instanceof Expressions.ParameterListT) {
|
|
75438
|
+
for (const p of child.findDirectExpressions(Expressions.ParameterT)) {
|
|
75439
|
+
const target = p.findDirectExpression(Expressions.Target);
|
|
75440
|
+
const fs = (target === null || target === void 0 ? void 0 : target.getChildren().length) === 1 ? target.findDirectExpression(Expressions.TargetFieldSymbol) : undefined;
|
|
75441
|
+
if (fs === undefined) {
|
|
75442
|
+
continue;
|
|
75443
|
+
}
|
|
75444
|
+
const table = lines.get(fs.concatTokens().toUpperCase());
|
|
75445
|
+
const type = (_a = this.findReference(fs.getFirstToken().getStart(), spaghetti, file)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
75446
|
+
if (table === undefined || type === undefined || type.isGeneric()) {
|
|
75447
|
+
continue;
|
|
75448
|
+
}
|
|
75449
|
+
const name = (_b = p.findDirectExpression(Expressions.ParameterName)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
75450
|
+
const message = `Line of sorted or hashed table ${table} passed to CHANGING ${name} is write-protected, ` +
|
|
75451
|
+
`the call fails at runtime. Use a work area and MODIFY TABLE ... FROM, or pass only non-key fields`;
|
|
75452
|
+
issues.push(issue_1.Issue.atToken(file, fs.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
74608
75453
|
}
|
|
74609
|
-
const left = (_c = (_b = compare.getChildren()[0]) === null || _b === void 0 ? void 0 : _b.concatTokens()) === null || _c === void 0 ? void 0 : _c.toUpperCase();
|
|
74610
|
-
const right = (_e = (_d = compare.getChildren()[2]) === null || _d === void 0 ? void 0 : _d.concatTokens()) === null || _e === void 0 ? void 0 : _e.toUpperCase();
|
|
74611
|
-
tuples.push({ left, right });
|
|
74612
75454
|
}
|
|
75455
|
+
changing = str === "CHANGING";
|
|
74613
75456
|
}
|
|
74614
|
-
|
|
74615
|
-
|
|
75457
|
+
}
|
|
75458
|
+
/** Tracks which field symbols the last assignment pointed to a whole line of a sorted or hashed table */
|
|
75459
|
+
updateAssigned(statement, lines, spaghetti, file) {
|
|
75460
|
+
var _a, _b, _c;
|
|
75461
|
+
var _d;
|
|
75462
|
+
const get = statement.get();
|
|
75463
|
+
const fs = get instanceof Statements.Unassign
|
|
75464
|
+
? statement.findDirectExpression(Expressions.TargetFieldSymbol)
|
|
75465
|
+
: (_a = statement.findFirstExpression(Expressions.FSTarget)) === null || _a === void 0 ? void 0 : _a.findFirstExpression(Expressions.TargetFieldSymbol);
|
|
75466
|
+
if (fs === undefined) {
|
|
75467
|
+
return;
|
|
74616
75468
|
}
|
|
74617
|
-
|
|
74618
|
-
|
|
74619
|
-
|
|
75469
|
+
const name = fs.concatTokens().toUpperCase();
|
|
75470
|
+
let table = undefined;
|
|
75471
|
+
let isTableExpression = false;
|
|
75472
|
+
if (get instanceof Statements.ReadTable) {
|
|
75473
|
+
table = (_d = statement.findDirectExpression(Expressions.SimpleSource2)) !== null && _d !== void 0 ? _d : statement.findDirectExpression(Expressions.Source);
|
|
74620
75474
|
}
|
|
74621
|
-
else if (
|
|
74622
|
-
|
|
75475
|
+
else if (get instanceof Statements.Loop) {
|
|
75476
|
+
table = (_b = statement.findDirectExpression(Expressions.LoopSource)) === null || _b === void 0 ? void 0 : _b.getFirstChild();
|
|
74623
75477
|
}
|
|
74624
|
-
else if (
|
|
74625
|
-
|
|
75478
|
+
else if (get instanceof Statements.InsertInternal && statement.findDirectTokenByText("TABLE") !== undefined) {
|
|
75479
|
+
table = statement.findDirectExpression(Expressions.Target);
|
|
74626
75480
|
}
|
|
74627
|
-
else if (
|
|
74628
|
-
|
|
75481
|
+
else if (get instanceof Statements.Assign) {
|
|
75482
|
+
table = (_c = statement.findDirectExpression(Expressions.AssignSource)) === null || _c === void 0 ? void 0 : _c.getFirstChild();
|
|
75483
|
+
isTableExpression = true;
|
|
75484
|
+
}
|
|
75485
|
+
const tableType = table instanceof nodes_1.ExpressionNode ? this.findTableType(table, isTableExpression, spaghetti, file) : undefined;
|
|
75486
|
+
if (table instanceof nodes_1.ExpressionNode && tableType instanceof basic_1.TableType
|
|
75487
|
+
&& (tableType.getAccessType() === basic_1.TableAccessType.sorted || tableType.getAccessType() === basic_1.TableAccessType.hashed)) {
|
|
75488
|
+
lines.set(name, table.concatTokens().replace(/\[.*$/, "").trim());
|
|
74629
75489
|
}
|
|
74630
75490
|
else {
|
|
74631
|
-
|
|
75491
|
+
lines.delete(name);
|
|
74632
75492
|
}
|
|
74633
|
-
|
|
74634
|
-
|
|
74635
|
-
|
|
74636
|
-
|
|
75493
|
+
}
|
|
75494
|
+
/** The type of a table given by a plain field chain of names, components and attributes, else undefined.
|
|
75495
|
+
* With tableExpression, the chain must end with a table expression, and the type of the chain before it is returned */
|
|
75496
|
+
findTableType(node, tableExpression, spaghetti, file) {
|
|
75497
|
+
var _a, _b;
|
|
75498
|
+
if (!(node.get() instanceof Expressions.Target)) {
|
|
75499
|
+
const chain = node.getChildren().length === 1 ? node.findDirectExpression(Expressions.FieldChain) : undefined;
|
|
75500
|
+
if (chain === undefined) {
|
|
75501
|
+
return undefined;
|
|
74637
75502
|
}
|
|
75503
|
+
node = chain;
|
|
74638
75504
|
}
|
|
74639
|
-
|
|
74640
|
-
|
|
74641
|
-
|
|
75505
|
+
const children = [...node.getChildren()];
|
|
75506
|
+
if (tableExpression === true) {
|
|
75507
|
+
if (!(((_a = children.pop()) === null || _a === void 0 ? void 0 : _a.get()) instanceof Expressions.TableExpression)) {
|
|
75508
|
+
return undefined;
|
|
74642
75509
|
}
|
|
74643
75510
|
}
|
|
74644
|
-
|
|
75511
|
+
let type = undefined;
|
|
75512
|
+
for (const child of children) {
|
|
75513
|
+
const get = child.get();
|
|
75514
|
+
if (get instanceof Expressions.SourceField
|
|
75515
|
+
|| get instanceof Expressions.SourceFieldSymbol
|
|
75516
|
+
|| get instanceof Expressions.TargetField
|
|
75517
|
+
|| get instanceof Expressions.TargetFieldSymbol
|
|
75518
|
+
|| get instanceof Expressions.AttributeName) {
|
|
75519
|
+
type = (_b = this.findReference(child.getFirstToken().getStart(), spaghetti, file)) === null || _b === void 0 ? void 0 : _b.getType();
|
|
75520
|
+
}
|
|
75521
|
+
else if (get instanceof Expressions.ComponentName) {
|
|
75522
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
75523
|
+
}
|
|
75524
|
+
else if (get instanceof Expressions.ClassName || get instanceof tokens_1.StaticArrow) {
|
|
75525
|
+
continue;
|
|
75526
|
+
}
|
|
75527
|
+
else if (!(get instanceof tokens_1.Dash) && !(get instanceof tokens_1.InstanceArrow)) {
|
|
75528
|
+
return undefined;
|
|
75529
|
+
}
|
|
75530
|
+
if (type === undefined) {
|
|
75531
|
+
return undefined;
|
|
75532
|
+
}
|
|
75533
|
+
}
|
|
75534
|
+
return type;
|
|
75535
|
+
}
|
|
75536
|
+
findReference(start, spaghetti, file) {
|
|
75537
|
+
const scope = spaghetti.lookupPosition(start, file.getFilename());
|
|
75538
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
75539
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
75540
|
+
return r.resolved;
|
|
75541
|
+
}
|
|
75542
|
+
}
|
|
75543
|
+
return undefined;
|
|
74645
75544
|
}
|
|
74646
75545
|
}
|
|
74647
|
-
exports.
|
|
74648
|
-
//# sourceMappingURL=
|
|
75546
|
+
exports.ChangingSortedLine = ChangingSortedLine;
|
|
75547
|
+
//# sourceMappingURL=changing_sorted_line.js.map
|
|
74649
75548
|
|
|
74650
75549
|
/***/ },
|
|
74651
75550
|
|
|
@@ -75598,6 +76497,7 @@ class ClassAttributeNames extends _abap_rule_1.ABAPRule {
|
|
|
75598
76497
|
constructor() {
|
|
75599
76498
|
super(...arguments);
|
|
75600
76499
|
this.conf = new ClassAttributeNamesConf();
|
|
76500
|
+
this.regex = this.compile();
|
|
75601
76501
|
}
|
|
75602
76502
|
getMetadata() {
|
|
75603
76503
|
return {
|
|
@@ -75625,6 +76525,15 @@ ENDCLASS.`,
|
|
|
75625
76525
|
}
|
|
75626
76526
|
setConfig(conf) {
|
|
75627
76527
|
this.conf = conf;
|
|
76528
|
+
this.regex = this.compile();
|
|
76529
|
+
}
|
|
76530
|
+
compile() {
|
|
76531
|
+
return {
|
|
76532
|
+
statics: new RegExp(this.conf.statics, "i"),
|
|
76533
|
+
instance: new RegExp(this.conf.instance, "i"),
|
|
76534
|
+
constants: new RegExp(this.conf.constants, "i"),
|
|
76535
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
76536
|
+
};
|
|
75628
76537
|
}
|
|
75629
76538
|
runParsed(file, obj) {
|
|
75630
76539
|
if (this.conf.patternKind === undefined) {
|
|
@@ -75657,13 +76566,13 @@ ENDCLASS.`,
|
|
|
75657
76566
|
for (const a of attr) {
|
|
75658
76567
|
switch (a.level) {
|
|
75659
76568
|
case _abap_file_information_1.AttributeLevel.Instance:
|
|
75660
|
-
ret = ret.concat(this.checkName(a.identifier, this.conf.instance));
|
|
76569
|
+
ret = ret.concat(this.checkName(a.identifier, this.conf.instance, this.regex.instance));
|
|
75661
76570
|
break;
|
|
75662
76571
|
case _abap_file_information_1.AttributeLevel.Static:
|
|
75663
|
-
ret = ret.concat(this.checkName(a.identifier, this.conf.statics));
|
|
76572
|
+
ret = ret.concat(this.checkName(a.identifier, this.conf.statics, this.regex.statics));
|
|
75664
76573
|
break;
|
|
75665
76574
|
case _abap_file_information_1.AttributeLevel.Constant:
|
|
75666
|
-
ret = ret.concat(this.checkName(a.identifier, this.conf.constants));
|
|
76575
|
+
ret = ret.concat(this.checkName(a.identifier, this.conf.constants, this.regex.constants));
|
|
75667
76576
|
break;
|
|
75668
76577
|
default:
|
|
75669
76578
|
break;
|
|
@@ -75671,11 +76580,10 @@ ENDCLASS.`,
|
|
|
75671
76580
|
}
|
|
75672
76581
|
return ret;
|
|
75673
76582
|
}
|
|
75674
|
-
checkName(attr, expected) {
|
|
76583
|
+
checkName(attr, expected, regex) {
|
|
75675
76584
|
const ret = [];
|
|
75676
|
-
const regex = new RegExp(expected, "i");
|
|
75677
76585
|
const name = attr.getName();
|
|
75678
|
-
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {
|
|
76586
|
+
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf, this.regex.ignorePatterns)) {
|
|
75679
76587
|
const issue = issue_1.Issue.atIdentifier(attr, this.getDescription(name, expected), this.getMetadata().key, this.conf.severity);
|
|
75680
76588
|
ret.push(issue);
|
|
75681
76589
|
}
|
|
@@ -77505,6 +78413,179 @@ exports.DefinitionsTop = DefinitionsTop;
|
|
|
77505
78413
|
|
|
77506
78414
|
/***/ },
|
|
77507
78415
|
|
|
78416
|
+
/***/ "../core/build/src/rules/delete_index_in_loop.js"
|
|
78417
|
+
/*!*******************************************************!*\
|
|
78418
|
+
!*** ../core/build/src/rules/delete_index_in_loop.js ***!
|
|
78419
|
+
\*******************************************************/
|
|
78420
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
78421
|
+
|
|
78422
|
+
"use strict";
|
|
78423
|
+
|
|
78424
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
78425
|
+
if (k2 === undefined) k2 = k;
|
|
78426
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
78427
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
78428
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
78429
|
+
}
|
|
78430
|
+
Object.defineProperty(o, k2, desc);
|
|
78431
|
+
}) : (function(o, m, k, k2) {
|
|
78432
|
+
if (k2 === undefined) k2 = k;
|
|
78433
|
+
o[k2] = m[k];
|
|
78434
|
+
}));
|
|
78435
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
78436
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
78437
|
+
}) : function(o, v) {
|
|
78438
|
+
o["default"] = v;
|
|
78439
|
+
});
|
|
78440
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
78441
|
+
var ownKeys = function(o) {
|
|
78442
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
78443
|
+
var ar = [];
|
|
78444
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
78445
|
+
return ar;
|
|
78446
|
+
};
|
|
78447
|
+
return ownKeys(o);
|
|
78448
|
+
};
|
|
78449
|
+
return function (mod) {
|
|
78450
|
+
if (mod && mod.__esModule) return mod;
|
|
78451
|
+
var result = {};
|
|
78452
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
78453
|
+
__setModuleDefault(result, mod);
|
|
78454
|
+
return result;
|
|
78455
|
+
};
|
|
78456
|
+
})();
|
|
78457
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
78458
|
+
exports.DeleteIndexInLoop = exports.DeleteIndexInLoopConf = void 0;
|
|
78459
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
78460
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
78461
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
78462
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
78463
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
78464
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
78465
|
+
const token_node_1 = __webpack_require__(/*! ../abap/nodes/token_node */ "../core/build/src/abap/nodes/token_node.js");
|
|
78466
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
78467
|
+
class DeleteIndexInLoopConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
78468
|
+
}
|
|
78469
|
+
exports.DeleteIndexInLoopConf = DeleteIndexInLoopConf;
|
|
78470
|
+
class DeleteIndexInLoop extends _abap_rule_1.ABAPRule {
|
|
78471
|
+
constructor() {
|
|
78472
|
+
super(...arguments);
|
|
78473
|
+
this.conf = new DeleteIndexInLoopConf();
|
|
78474
|
+
}
|
|
78475
|
+
getMetadata() {
|
|
78476
|
+
return {
|
|
78477
|
+
key: "delete_index_in_loop",
|
|
78478
|
+
title: "DELETE INDEX sy-tabix inside a LOOP over the same table",
|
|
78479
|
+
shortDescription: `Reports DELETE itab INDEX sy-tabix inside a LOOP AT the same table`,
|
|
78480
|
+
extendedInformation: `sy-tabix is the index of the loop's current row only until another statement writes it.
|
|
78481
|
+
READ TABLE, APPEND, INSERT, COLLECT, a nested LOOP and any method called in the loop body
|
|
78482
|
+
all set sy-tabix. After that the DELETE removes a different row, and if sy-tabix is 0 it
|
|
78483
|
+
raises the runtime error TABLE_INVALID_INDEX.
|
|
78484
|
+
|
|
78485
|
+
Use DELETE itab WHERE ..., or collect the rows to keep in a second table.
|
|
78486
|
+
|
|
78487
|
+
Not reported: DELETE itab INDEX sy-tabix directly after READ TABLE itab, where sy-tabix
|
|
78488
|
+
is the index the READ just set.`,
|
|
78489
|
+
tags: [_irule_1.RuleTag.SingleFile],
|
|
78490
|
+
badExample: `LOOP AT tab INTO row.
|
|
78491
|
+
IF row-flag = abap_true.
|
|
78492
|
+
DELETE tab INDEX sy-tabix.
|
|
78493
|
+
ENDIF.
|
|
78494
|
+
ENDLOOP.`,
|
|
78495
|
+
goodExample: `DELETE tab WHERE flag = abap_true.`,
|
|
78496
|
+
};
|
|
78497
|
+
}
|
|
78498
|
+
getConfig() {
|
|
78499
|
+
return this.conf;
|
|
78500
|
+
}
|
|
78501
|
+
setConfig(conf) {
|
|
78502
|
+
this.conf = conf;
|
|
78503
|
+
}
|
|
78504
|
+
runParsed(file) {
|
|
78505
|
+
const issues = [];
|
|
78506
|
+
const statements = file.getStatements();
|
|
78507
|
+
for (let i = 0; i < statements.length; i++) {
|
|
78508
|
+
const statement = statements[i];
|
|
78509
|
+
if (!(statement.get() instanceof Statements.DeleteInternal) || this.byTabix(statement) === false) {
|
|
78510
|
+
continue;
|
|
78511
|
+
}
|
|
78512
|
+
// DELETE TABLE and DELETE ADJACENT DUPLICATES have a keyword before the target
|
|
78513
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
78514
|
+
if (target === undefined || statement.getChildren()[1] !== target) {
|
|
78515
|
+
continue;
|
|
78516
|
+
}
|
|
78517
|
+
const table = target.concatTokens().toUpperCase();
|
|
78518
|
+
if (this.previousReadsTable(i, statements, table) === true
|
|
78519
|
+
|| this.enclosingLoopTables(i, statements).includes(table) === false) {
|
|
78520
|
+
continue;
|
|
78521
|
+
}
|
|
78522
|
+
const message = `DELETE ${target.concatTokens()} INDEX sy-tabix inside LOOP AT the same table,`
|
|
78523
|
+
+ ` sy-tabix might not be the loop's current row`;
|
|
78524
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
|
|
78525
|
+
}
|
|
78526
|
+
return issues;
|
|
78527
|
+
}
|
|
78528
|
+
////////////////
|
|
78529
|
+
byTabix(statement) {
|
|
78530
|
+
const children = statement.getChildren();
|
|
78531
|
+
for (let i = 0; i < children.length - 1; i++) {
|
|
78532
|
+
const child = children[i];
|
|
78533
|
+
if (child instanceof token_node_1.TokenNode && child.getFirstToken().getStr().toUpperCase() === "INDEX") {
|
|
78534
|
+
return children[i + 1].concatTokens().toUpperCase() === "SY-TABIX";
|
|
78535
|
+
}
|
|
78536
|
+
}
|
|
78537
|
+
return false;
|
|
78538
|
+
}
|
|
78539
|
+
previousReadsTable(index, statements, table) {
|
|
78540
|
+
var _a;
|
|
78541
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
78542
|
+
const statement = statements[i];
|
|
78543
|
+
if (statement.get() instanceof _statement_1.Comment) {
|
|
78544
|
+
continue;
|
|
78545
|
+
}
|
|
78546
|
+
if (!(statement.get() instanceof Statements.ReadTable)) {
|
|
78547
|
+
return false;
|
|
78548
|
+
}
|
|
78549
|
+
const read = (_a = statement.findDirectExpression(Expressions.SimpleSource2)) !== null && _a !== void 0 ? _a : statement.findDirectExpression(Expressions.Source);
|
|
78550
|
+
return (read === null || read === void 0 ? void 0 : read.concatTokens().toUpperCase()) === table;
|
|
78551
|
+
}
|
|
78552
|
+
return false;
|
|
78553
|
+
}
|
|
78554
|
+
enclosingLoopTables(index, statements) {
|
|
78555
|
+
const tables = [];
|
|
78556
|
+
let depth = 0;
|
|
78557
|
+
for (let i = index - 1; i >= 0; i--) {
|
|
78558
|
+
const statement = statements[i];
|
|
78559
|
+
const s = statement.get();
|
|
78560
|
+
if (s instanceof Statements.EndLoop) {
|
|
78561
|
+
depth++;
|
|
78562
|
+
}
|
|
78563
|
+
else if (s instanceof Statements.Loop) {
|
|
78564
|
+
if (depth === 0) {
|
|
78565
|
+
const source = statement.findDirectExpression(Expressions.LoopSource);
|
|
78566
|
+
if (source !== undefined) {
|
|
78567
|
+
tables.push(source.concatTokens().toUpperCase());
|
|
78568
|
+
}
|
|
78569
|
+
}
|
|
78570
|
+
else {
|
|
78571
|
+
depth--;
|
|
78572
|
+
}
|
|
78573
|
+
}
|
|
78574
|
+
else if (s instanceof Statements.MethodImplementation
|
|
78575
|
+
|| s instanceof Statements.Form
|
|
78576
|
+
|| s instanceof Statements.FunctionModule
|
|
78577
|
+
|| s instanceof Statements.Module) {
|
|
78578
|
+
break;
|
|
78579
|
+
}
|
|
78580
|
+
}
|
|
78581
|
+
return tables;
|
|
78582
|
+
}
|
|
78583
|
+
}
|
|
78584
|
+
exports.DeleteIndexInLoop = DeleteIndexInLoop;
|
|
78585
|
+
//# sourceMappingURL=delete_index_in_loop.js.map
|
|
78586
|
+
|
|
78587
|
+
/***/ },
|
|
78588
|
+
|
|
77508
78589
|
/***/ "../core/build/src/rules/description_empty.js"
|
|
77509
78590
|
/*!****************************************************!*\
|
|
77510
78591
|
!*** ../core/build/src/rules/description_empty.js ***!
|
|
@@ -82352,6 +83433,94 @@ exports.Exporting = Exporting;
|
|
|
82352
83433
|
|
|
82353
83434
|
/***/ },
|
|
82354
83435
|
|
|
83436
|
+
/***/ "../core/build/src/rules/final_newline.js"
|
|
83437
|
+
/*!************************************************!*\
|
|
83438
|
+
!*** ../core/build/src/rules/final_newline.js ***!
|
|
83439
|
+
\************************************************/
|
|
83440
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
83441
|
+
|
|
83442
|
+
"use strict";
|
|
83443
|
+
|
|
83444
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
83445
|
+
exports.FinalNewline = exports.FinalNewlineConf = void 0;
|
|
83446
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
83447
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
83448
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
83449
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
83450
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
83451
|
+
const objects_1 = __webpack_require__(/*! ../objects */ "../core/build/src/objects/index.js");
|
|
83452
|
+
class FinalNewlineConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
83453
|
+
}
|
|
83454
|
+
exports.FinalNewlineConf = FinalNewlineConf;
|
|
83455
|
+
class FinalNewline {
|
|
83456
|
+
constructor() {
|
|
83457
|
+
this.conf = new FinalNewlineConf();
|
|
83458
|
+
}
|
|
83459
|
+
getMetadata() {
|
|
83460
|
+
return {
|
|
83461
|
+
key: "final_newline",
|
|
83462
|
+
title: "Final newline",
|
|
83463
|
+
shortDescription: `Checks that ABAP and XML files end with exactly one newline`,
|
|
83464
|
+
extendedInformation: `abapGit serializes every file with exactly one newline at the end. A file without it,
|
|
83465
|
+
or with empty lines at the end, is changed again on the next pull and shows up in every diff.
|
|
83466
|
+
|
|
83467
|
+
Empty files and files containing only line breaks are not checked. A carriage return before the
|
|
83468
|
+
newline is ignored, see rule line_break_style. SMIM and W3MI files and XSLT sources are not checked.`,
|
|
83469
|
+
tags: [_irule_1.RuleTag.Whitespace, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
83470
|
+
badExample: `WRITE 'hello'.`,
|
|
83471
|
+
goodExample: `WRITE 'hello'.\n`,
|
|
83472
|
+
};
|
|
83473
|
+
}
|
|
83474
|
+
getConfig() {
|
|
83475
|
+
return this.conf;
|
|
83476
|
+
}
|
|
83477
|
+
setConfig(conf) {
|
|
83478
|
+
this.conf = conf;
|
|
83479
|
+
}
|
|
83480
|
+
initialize(_reg) {
|
|
83481
|
+
return this;
|
|
83482
|
+
}
|
|
83483
|
+
run(obj) {
|
|
83484
|
+
const issues = [];
|
|
83485
|
+
if (obj instanceof objects_1.MIMEObject || obj instanceof objects_1.WebMIME) {
|
|
83486
|
+
return issues;
|
|
83487
|
+
}
|
|
83488
|
+
for (const file of obj.getFiles()) {
|
|
83489
|
+
const filename = file.getFilename();
|
|
83490
|
+
if ((filename.endsWith(".abap") || filename.endsWith(".xml")) && !filename.endsWith(".xslt.source.xml")) {
|
|
83491
|
+
const issue = this.checkFile(file);
|
|
83492
|
+
if (issue) {
|
|
83493
|
+
issues.push(issue);
|
|
83494
|
+
}
|
|
83495
|
+
}
|
|
83496
|
+
}
|
|
83497
|
+
return issues;
|
|
83498
|
+
}
|
|
83499
|
+
checkFile(file) {
|
|
83500
|
+
const rows = file.getRawRows();
|
|
83501
|
+
const last = rows[rows.length - 1];
|
|
83502
|
+
if (last !== "") {
|
|
83503
|
+
const end = new position_1.Position(rows.length, last.length + 1);
|
|
83504
|
+
const fix = edit_helper_1.EditHelper.insertAt(file, end, "\n");
|
|
83505
|
+
return issue_1.Issue.atPosition(file, end, "Add newline at end of file", this.getMetadata().key, this.conf.severity, fix);
|
|
83506
|
+
}
|
|
83507
|
+
let row = rows.length - 2;
|
|
83508
|
+
while (row >= 0 && (rows[row] === "" || rows[row] === "\r")) {
|
|
83509
|
+
row--;
|
|
83510
|
+
}
|
|
83511
|
+
if (row < 0 || row === rows.length - 2) {
|
|
83512
|
+
return undefined;
|
|
83513
|
+
}
|
|
83514
|
+
const start = new position_1.Position(row + 2, 1);
|
|
83515
|
+
const fix = edit_helper_1.EditHelper.deleteRange(file, start, new position_1.Position(rows.length, 1));
|
|
83516
|
+
return issue_1.Issue.atPosition(file, start, "Remove empty lines at end of file", this.getMetadata().key, this.conf.severity, fix);
|
|
83517
|
+
}
|
|
83518
|
+
}
|
|
83519
|
+
exports.FinalNewline = FinalNewline;
|
|
83520
|
+
//# sourceMappingURL=final_newline.js.map
|
|
83521
|
+
|
|
83522
|
+
/***/ },
|
|
83523
|
+
|
|
82355
83524
|
/***/ "../core/build/src/rules/fm_global_parameters_obsolete.js"
|
|
82356
83525
|
/*!****************************************************************!*\
|
|
82357
83526
|
!*** ../core/build/src/rules/fm_global_parameters_obsolete.js ***!
|
|
@@ -82476,6 +83645,7 @@ class ForbiddenIdentifier extends _abap_rule_1.ABAPRule {
|
|
|
82476
83645
|
constructor() {
|
|
82477
83646
|
super(...arguments);
|
|
82478
83647
|
this.conf = new ForbiddenIdentifierConf();
|
|
83648
|
+
this.checks = [];
|
|
82479
83649
|
}
|
|
82480
83650
|
getMetadata() {
|
|
82481
83651
|
return {
|
|
@@ -82495,9 +83665,10 @@ https://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530
|
|
|
82495
83665
|
if (this.conf.check === undefined) {
|
|
82496
83666
|
this.conf.check = [];
|
|
82497
83667
|
}
|
|
83668
|
+
this.checks = this.conf.check.map(c => new RegExp(c, "i"));
|
|
82498
83669
|
}
|
|
82499
83670
|
runParsed(file) {
|
|
82500
|
-
if (this.
|
|
83671
|
+
if (this.checks.length === 0) {
|
|
82501
83672
|
return [];
|
|
82502
83673
|
}
|
|
82503
83674
|
let ret = [];
|
|
@@ -82524,8 +83695,7 @@ https://github.com/abaplint/transpiler/blob/bda94b8b56e2b7f2f87be2168f12361aa530
|
|
|
82524
83695
|
check(token, file) {
|
|
82525
83696
|
const str = token.getStr();
|
|
82526
83697
|
const ret = [];
|
|
82527
|
-
for (const
|
|
82528
|
-
const reg = new RegExp(c, "i");
|
|
83698
|
+
for (const reg of this.checks) {
|
|
82529
83699
|
if (reg.exec(str)) {
|
|
82530
83700
|
const message = "Identifer \"" + str + "\" not allowed";
|
|
82531
83701
|
ret.push(issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity));
|
|
@@ -82751,6 +83921,7 @@ exports.ForbiddenVoidTypeConf = ForbiddenVoidTypeConf;
|
|
|
82751
83921
|
class ForbiddenVoidType {
|
|
82752
83922
|
constructor() {
|
|
82753
83923
|
this.conf = new ForbiddenVoidTypeConf();
|
|
83924
|
+
this.checks = [];
|
|
82754
83925
|
}
|
|
82755
83926
|
getMetadata() {
|
|
82756
83927
|
return {
|
|
@@ -82770,13 +83941,14 @@ DATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFE
|
|
|
82770
83941
|
if (this.conf.check === undefined) {
|
|
82771
83942
|
this.conf.check = [];
|
|
82772
83943
|
}
|
|
83944
|
+
this.checks = this.conf.check.map(c => new RegExp(c, "i"));
|
|
82773
83945
|
}
|
|
82774
83946
|
initialize(reg) {
|
|
82775
83947
|
this.reg = reg;
|
|
82776
83948
|
return this;
|
|
82777
83949
|
}
|
|
82778
83950
|
run(obj) {
|
|
82779
|
-
if (!(obj instanceof _abap_object_1.ABAPObject) || this.
|
|
83951
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || this.checks.length === 0) {
|
|
82780
83952
|
return [];
|
|
82781
83953
|
}
|
|
82782
83954
|
return this.traverse(new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop());
|
|
@@ -82819,14 +83991,7 @@ DATS, TIMS, DATUM, FLAG, INT4, NUMC3, NUMC4, SAP_BOOL, TEXT25, TEXT80, X255, XFE
|
|
|
82819
83991
|
if (name === undefined) {
|
|
82820
83992
|
return false;
|
|
82821
83993
|
}
|
|
82822
|
-
|
|
82823
|
-
const reg = new RegExp(c, "i");
|
|
82824
|
-
const match = reg.test(name);
|
|
82825
|
-
if (match === true) {
|
|
82826
|
-
return true;
|
|
82827
|
-
}
|
|
82828
|
-
}
|
|
82829
|
-
return false;
|
|
83994
|
+
return this.checks.some(reg => reg.test(name));
|
|
82830
83995
|
}
|
|
82831
83996
|
}
|
|
82832
83997
|
exports.ForbiddenVoidType = ForbiddenVoidType;
|
|
@@ -85437,6 +86602,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
85437
86602
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
85438
86603
|
__exportStar(__webpack_require__(/*! ./7bit_ascii */ "../core/build/src/rules/7bit_ascii.js"), exports);
|
|
85439
86604
|
__exportStar(__webpack_require__(/*! ./abapdoc */ "../core/build/src/rules/abapdoc.js"), exports);
|
|
86605
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_html_tag */ "../core/build/src/rules/abapdoc_html_tag.js"), exports);
|
|
86606
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_leading_at */ "../core/build/src/rules/abapdoc_leading_at.js"), exports);
|
|
86607
|
+
__exportStar(__webpack_require__(/*! ./abapdoc_parameter_names */ "../core/build/src/rules/abapdoc_parameter_names.js"), exports);
|
|
85440
86608
|
__exportStar(__webpack_require__(/*! ./add_test_attributes */ "../core/build/src/rules/add_test_attributes.js"), exports);
|
|
85441
86609
|
__exportStar(__webpack_require__(/*! ./aff_and_xml */ "../core/build/src/rules/aff_and_xml.js"), exports);
|
|
85442
86610
|
__exportStar(__webpack_require__(/*! ./align_parameters */ "../core/build/src/rules/align_parameters.js"), exports);
|
|
@@ -85459,6 +86627,7 @@ __exportStar(__webpack_require__(/*! ./cds_naming */ "../core/build/src/rules/cd
|
|
|
85459
86627
|
__exportStar(__webpack_require__(/*! ./cds_parser_error */ "../core/build/src/rules/cds_parser_error.js"), exports);
|
|
85460
86628
|
__exportStar(__webpack_require__(/*! ./chain_mainly_declarations */ "../core/build/src/rules/chain_mainly_declarations.js"), exports);
|
|
85461
86629
|
__exportStar(__webpack_require__(/*! ./change_if_to_case */ "../core/build/src/rules/change_if_to_case.js"), exports);
|
|
86630
|
+
__exportStar(__webpack_require__(/*! ./changing_sorted_line */ "../core/build/src/rules/changing_sorted_line.js"), exports);
|
|
85462
86631
|
__exportStar(__webpack_require__(/*! ./check_abstract */ "../core/build/src/rules/check_abstract.js"), exports);
|
|
85463
86632
|
__exportStar(__webpack_require__(/*! ./check_comments */ "../core/build/src/rules/check_comments.js"), exports);
|
|
85464
86633
|
__exportStar(__webpack_require__(/*! ./check_ddic */ "../core/build/src/rules/check_ddic.js"), exports);
|
|
@@ -85481,6 +86650,7 @@ __exportStar(__webpack_require__(/*! ./cyclomatic_complexity */ "../core/build/s
|
|
|
85481
86650
|
__exportStar(__webpack_require__(/*! ./dangerous_statement */ "../core/build/src/rules/dangerous_statement.js"), exports);
|
|
85482
86651
|
__exportStar(__webpack_require__(/*! ./db_operation_in_loop */ "../core/build/src/rules/db_operation_in_loop.js"), exports);
|
|
85483
86652
|
__exportStar(__webpack_require__(/*! ./definitions_top */ "../core/build/src/rules/definitions_top.js"), exports);
|
|
86653
|
+
__exportStar(__webpack_require__(/*! ./delete_index_in_loop */ "../core/build/src/rules/delete_index_in_loop.js"), exports);
|
|
85484
86654
|
__exportStar(__webpack_require__(/*! ./description_empty */ "../core/build/src/rules/description_empty.js"), exports);
|
|
85485
86655
|
__exportStar(__webpack_require__(/*! ./double_space */ "../core/build/src/rules/double_space.js"), exports);
|
|
85486
86656
|
__exportStar(__webpack_require__(/*! ./downport */ "../core/build/src/rules/downport.js"), exports);
|
|
@@ -85494,6 +86664,7 @@ __exportStar(__webpack_require__(/*! ./else_after_all_returns */ "../core/build/
|
|
|
85494
86664
|
__exportStar(__webpack_require__(/*! ./exit_or_check */ "../core/build/src/rules/exit_or_check.js"), exports);
|
|
85495
86665
|
__exportStar(__webpack_require__(/*! ./expand_macros */ "../core/build/src/rules/expand_macros.js"), exports);
|
|
85496
86666
|
__exportStar(__webpack_require__(/*! ./exporting */ "../core/build/src/rules/exporting.js"), exports);
|
|
86667
|
+
__exportStar(__webpack_require__(/*! ./final_newline */ "../core/build/src/rules/final_newline.js"), exports);
|
|
85497
86668
|
__exportStar(__webpack_require__(/*! ./fm_global_parameters_obsolete */ "../core/build/src/rules/fm_global_parameters_obsolete.js"), exports);
|
|
85498
86669
|
__exportStar(__webpack_require__(/*! ./forbidden_identifier */ "../core/build/src/rules/forbidden_identifier.js"), exports);
|
|
85499
86670
|
__exportStar(__webpack_require__(/*! ./forbidden_pseudo_and_pragma */ "../core/build/src/rules/forbidden_pseudo_and_pragma.js"), exports);
|
|
@@ -85517,6 +86688,7 @@ __exportStar(__webpack_require__(/*! ./in_statement_indentation */ "../core/buil
|
|
|
85517
86688
|
__exportStar(__webpack_require__(/*! ./indentation */ "../core/build/src/rules/indentation.js"), exports);
|
|
85518
86689
|
__exportStar(__webpack_require__(/*! ./index_completely_contained */ "../core/build/src/rules/index_completely_contained.js"), exports);
|
|
85519
86690
|
__exportStar(__webpack_require__(/*! ./inline_data_old_versions */ "../core/build/src/rules/inline_data_old_versions.js"), exports);
|
|
86691
|
+
__exportStar(__webpack_require__(/*! ./inline_packed_computation */ "../core/build/src/rules/inline_packed_computation.js"), exports);
|
|
85520
86692
|
__exportStar(__webpack_require__(/*! ./intf_referencing_clas */ "../core/build/src/rules/intf_referencing_clas.js"), exports);
|
|
85521
86693
|
__exportStar(__webpack_require__(/*! ./invalid_table_index */ "../core/build/src/rules/invalid_table_index.js"), exports);
|
|
85522
86694
|
__exportStar(__webpack_require__(/*! ./keep_single_parameter_on_one_line */ "../core/build/src/rules/keep_single_parameter_on_one_line.js"), exports);
|
|
@@ -85568,6 +86740,7 @@ __exportStar(__webpack_require__(/*! ./parser_missing_space */ "../core/build/sr
|
|
|
85568
86740
|
__exportStar(__webpack_require__(/*! ./pragma_style */ "../core/build/src/rules/pragma_style.js"), exports);
|
|
85569
86741
|
__exportStar(__webpack_require__(/*! ./prefer_corresponding */ "../core/build/src/rules/prefer_corresponding.js"), exports);
|
|
85570
86742
|
__exportStar(__webpack_require__(/*! ./prefer_inline */ "../core/build/src/rules/prefer_inline.js"), exports);
|
|
86743
|
+
__exportStar(__webpack_require__(/*! ./prefer_inline_cast */ "../core/build/src/rules/prefer_inline_cast.js"), exports);
|
|
85571
86744
|
__exportStar(__webpack_require__(/*! ./prefer_insert_into_table */ "../core/build/src/rules/prefer_insert_into_table.js"), exports);
|
|
85572
86745
|
__exportStar(__webpack_require__(/*! ./prefer_is_not */ "../core/build/src/rules/prefer_is_not.js"), exports);
|
|
85573
86746
|
__exportStar(__webpack_require__(/*! ./prefer_pragmas */ "../core/build/src/rules/prefer_pragmas.js"), exports);
|
|
@@ -85580,6 +86753,7 @@ __exportStar(__webpack_require__(/*! ./prefer_xsdbool */ "../core/build/src/rule
|
|
|
85580
86753
|
__exportStar(__webpack_require__(/*! ./preferred_compare_operator */ "../core/build/src/rules/preferred_compare_operator.js"), exports);
|
|
85581
86754
|
__exportStar(__webpack_require__(/*! ./preferred_parameter_ignored */ "../core/build/src/rules/preferred_parameter_ignored.js"), exports);
|
|
85582
86755
|
__exportStar(__webpack_require__(/*! ./prefix_is_current_class */ "../core/build/src/rules/prefix_is_current_class.js"), exports);
|
|
86756
|
+
__exportStar(__webpack_require__(/*! ./range_row_values */ "../core/build/src/rules/range_row_values.js"), exports);
|
|
85583
86757
|
__exportStar(__webpack_require__(/*! ./reduce_procedural_code */ "../core/build/src/rules/reduce_procedural_code.js"), exports);
|
|
85584
86758
|
__exportStar(__webpack_require__(/*! ./reduce_string_templates */ "../core/build/src/rules/reduce_string_templates.js"), exports);
|
|
85585
86759
|
__exportStar(__webpack_require__(/*! ./redundant_conversion */ "../core/build/src/rules/redundant_conversion.js"), exports);
|
|
@@ -85596,6 +86770,7 @@ __exportStar(__webpack_require__(/*! ./short_case */ "../core/build/src/rules/sh
|
|
|
85596
86770
|
__exportStar(__webpack_require__(/*! ./sicf_consistency */ "../core/build/src/rules/sicf_consistency.js"), exports);
|
|
85597
86771
|
__exportStar(__webpack_require__(/*! ./slow_parameter_passing */ "../core/build/src/rules/slow_parameter_passing.js"), exports);
|
|
85598
86772
|
__exportStar(__webpack_require__(/*! ./smim_consistency */ "../core/build/src/rules/smim_consistency.js"), exports);
|
|
86773
|
+
__exportStar(__webpack_require__(/*! ./sort_empty_key */ "../core/build/src/rules/sort_empty_key.js"), exports);
|
|
85599
86774
|
__exportStar(__webpack_require__(/*! ./space_before_colon */ "../core/build/src/rules/space_before_colon.js"), exports);
|
|
85600
86775
|
__exportStar(__webpack_require__(/*! ./space_before_dot */ "../core/build/src/rules/space_before_dot.js"), exports);
|
|
85601
86776
|
__exportStar(__webpack_require__(/*! ./sql_escape_host_variables */ "../core/build/src/rules/sql_escape_host_variables.js"), exports);
|
|
@@ -85603,6 +86778,7 @@ __exportStar(__webpack_require__(/*! ./sql_value_conversion */ "../core/build/sr
|
|
|
85603
86778
|
__exportStar(__webpack_require__(/*! ./start_at_tab */ "../core/build/src/rules/start_at_tab.js"), exports);
|
|
85604
86779
|
__exportStar(__webpack_require__(/*! ./static_call_via_instance */ "../core/build/src/rules/static_call_via_instance.js"), exports);
|
|
85605
86780
|
__exportStar(__webpack_require__(/*! ./strict_sql */ "../core/build/src/rules/strict_sql.js"), exports);
|
|
86781
|
+
__exportStar(__webpack_require__(/*! ./subrc_after_assign */ "../core/build/src/rules/subrc_after_assign.js"), exports);
|
|
85606
86782
|
__exportStar(__webpack_require__(/*! ./superclass_final */ "../core/build/src/rules/superclass_final.js"), exports);
|
|
85607
86783
|
__exportStar(__webpack_require__(/*! ./superfluous_value */ "../core/build/src/rules/superfluous_value.js"), exports);
|
|
85608
86784
|
__exportStar(__webpack_require__(/*! ./sy_modification */ "../core/build/src/rules/sy_modification.js"), exports);
|
|
@@ -85825,6 +87001,236 @@ exports.InlineDataOldVersions = InlineDataOldVersions;
|
|
|
85825
87001
|
|
|
85826
87002
|
/***/ },
|
|
85827
87003
|
|
|
87004
|
+
/***/ "../core/build/src/rules/inline_packed_computation.js"
|
|
87005
|
+
/*!************************************************************!*\
|
|
87006
|
+
!*** ../core/build/src/rules/inline_packed_computation.js ***!
|
|
87007
|
+
\************************************************************/
|
|
87008
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
87009
|
+
|
|
87010
|
+
"use strict";
|
|
87011
|
+
|
|
87012
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
87013
|
+
if (k2 === undefined) k2 = k;
|
|
87014
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
87015
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
87016
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
87017
|
+
}
|
|
87018
|
+
Object.defineProperty(o, k2, desc);
|
|
87019
|
+
}) : (function(o, m, k, k2) {
|
|
87020
|
+
if (k2 === undefined) k2 = k;
|
|
87021
|
+
o[k2] = m[k];
|
|
87022
|
+
}));
|
|
87023
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
87024
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
87025
|
+
}) : function(o, v) {
|
|
87026
|
+
o["default"] = v;
|
|
87027
|
+
});
|
|
87028
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
87029
|
+
var ownKeys = function(o) {
|
|
87030
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
87031
|
+
var ar = [];
|
|
87032
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
87033
|
+
return ar;
|
|
87034
|
+
};
|
|
87035
|
+
return ownKeys(o);
|
|
87036
|
+
};
|
|
87037
|
+
return function (mod) {
|
|
87038
|
+
if (mod && mod.__esModule) return mod;
|
|
87039
|
+
var result = {};
|
|
87040
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
87041
|
+
__setModuleDefault(result, mod);
|
|
87042
|
+
return result;
|
|
87043
|
+
};
|
|
87044
|
+
})();
|
|
87045
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87046
|
+
exports.InlinePackedComputation = exports.InlinePackedComputationConf = void 0;
|
|
87047
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
87048
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
87049
|
+
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
87050
|
+
const constant_1 = __webpack_require__(/*! ../abap/5_syntax/expressions/constant */ "../core/build/src/abap/5_syntax/expressions/constant.js");
|
|
87051
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
87052
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
87053
|
+
const types_1 = __webpack_require__(/*! ../abap/types */ "../core/build/src/abap/types/index.js");
|
|
87054
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
87055
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
87056
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
87057
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
87058
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
87059
|
+
class InlinePackedComputationConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
87060
|
+
}
|
|
87061
|
+
exports.InlinePackedComputationConf = InlinePackedComputationConf;
|
|
87062
|
+
class InlinePackedComputation {
|
|
87063
|
+
constructor() {
|
|
87064
|
+
this.conf = new InlinePackedComputationConf();
|
|
87065
|
+
}
|
|
87066
|
+
getMetadata() {
|
|
87067
|
+
return {
|
|
87068
|
+
key: "inline_packed_computation",
|
|
87069
|
+
title: "Inline declaration from a packed computation",
|
|
87070
|
+
shortDescription: `Finds inline declarations whose value is an arithmetic expression with calculation type p`,
|
|
87071
|
+
extendedInformation: `The result of a computation with calculation type p has no length and number of decimals
|
|
87072
|
+
that a declaration could take over, so DATA( ) or FINAL( ) gets the type p LENGTH 8 DECIMALS 0 and the
|
|
87073
|
+
syntax check warns "For the result of a computation with type P, the type P(8,0) is used here implicitly".
|
|
87074
|
+
Decimals of the operands are lost, and so are digits beyond the length.
|
|
87075
|
+
|
|
87076
|
+
Reported when at least one operand is packed and all other operands are of type i, int8 or p. Operands
|
|
87077
|
+
of other types, generic or unknown types, and the operator ** are not reported.
|
|
87078
|
+
|
|
87079
|
+
Declare the variable with the operands' type, or name the type with CONV.`,
|
|
87080
|
+
tags: [],
|
|
87081
|
+
badExample: `DATA a TYPE p LENGTH 8 DECIMALS 2.
|
|
87082
|
+
DATA b TYPE p LENGTH 8 DECIMALS 2.
|
|
87083
|
+
DATA(diff) = a - b.`,
|
|
87084
|
+
goodExample: `DATA a TYPE p LENGTH 8 DECIMALS 2.
|
|
87085
|
+
DATA b TYPE p LENGTH 8 DECIMALS 2.
|
|
87086
|
+
DATA diff LIKE a.
|
|
87087
|
+
diff = a - b.`,
|
|
87088
|
+
};
|
|
87089
|
+
}
|
|
87090
|
+
getConfig() {
|
|
87091
|
+
return this.conf;
|
|
87092
|
+
}
|
|
87093
|
+
setConfig(conf) {
|
|
87094
|
+
this.conf = conf;
|
|
87095
|
+
}
|
|
87096
|
+
initialize(reg) {
|
|
87097
|
+
this.reg = reg;
|
|
87098
|
+
return this;
|
|
87099
|
+
}
|
|
87100
|
+
run(obj) {
|
|
87101
|
+
var _a, _b;
|
|
87102
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
87103
|
+
return [];
|
|
87104
|
+
}
|
|
87105
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
87106
|
+
if (syntax.issues.length > 0) {
|
|
87107
|
+
return [];
|
|
87108
|
+
}
|
|
87109
|
+
const issues = [];
|
|
87110
|
+
for (const file of obj.getABAPFiles()) {
|
|
87111
|
+
for (const statement of file.getStatements()) {
|
|
87112
|
+
if (!(statement.get() instanceof Statements.Move)) {
|
|
87113
|
+
continue;
|
|
87114
|
+
}
|
|
87115
|
+
const inline = (_a = statement.findDirectExpression(Expressions.Target)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.InlineData);
|
|
87116
|
+
const name = (_b = inline === null || inline === void 0 ? void 0 : inline.findDirectExpression(Expressions.TargetField)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
87117
|
+
const source = statement.findDirectExpression(Expressions.Source);
|
|
87118
|
+
if (name === undefined
|
|
87119
|
+
|| source === undefined
|
|
87120
|
+
|| source.findDirectExpression(Expressions.ArithOperator) === undefined) {
|
|
87121
|
+
continue;
|
|
87122
|
+
}
|
|
87123
|
+
const scope = syntax.spaghetti.lookupPosition(name.getStart(), file.getFilename());
|
|
87124
|
+
if (scope === undefined) {
|
|
87125
|
+
continue;
|
|
87126
|
+
}
|
|
87127
|
+
const operands = this.operandTypes(source, scope);
|
|
87128
|
+
if (operands === undefined || operands.some(t => t instanceof basic_1.PackedType) === false) {
|
|
87129
|
+
continue;
|
|
87130
|
+
}
|
|
87131
|
+
const message = `"${name.getStr()}" gets type p LENGTH 8 DECIMALS 0 from this packed computation, ` +
|
|
87132
|
+
`declare it with the operands' type or use CONV`;
|
|
87133
|
+
issues.push(issue_1.Issue.atToken(file, name, message, this.getMetadata().key, this.conf.severity));
|
|
87134
|
+
}
|
|
87135
|
+
}
|
|
87136
|
+
return issues;
|
|
87137
|
+
}
|
|
87138
|
+
/** The types of the operands of an arithmetic expression, undefined when an operand is not of type
|
|
87139
|
+
* i, int8 or p, or is not known */
|
|
87140
|
+
operandTypes(source, scope) {
|
|
87141
|
+
const ret = [];
|
|
87142
|
+
for (const child of source.getChildren()) {
|
|
87143
|
+
let found = undefined;
|
|
87144
|
+
if (child instanceof nodes_1.TokenNode) {
|
|
87145
|
+
// parentheses and a sign, anything else is a constructor expression or a string operator
|
|
87146
|
+
if (["(", ")", "+", "-"].includes(child.getFirstToken().getStr()) === false) {
|
|
87147
|
+
return undefined;
|
|
87148
|
+
}
|
|
87149
|
+
continue;
|
|
87150
|
+
}
|
|
87151
|
+
else if (child.get() instanceof Expressions.ArithOperator) {
|
|
87152
|
+
if (["+", "-", "*", "/", "DIV", "MOD"].includes(child.concatTokens().toUpperCase()) === false) {
|
|
87153
|
+
return undefined;
|
|
87154
|
+
}
|
|
87155
|
+
continue;
|
|
87156
|
+
}
|
|
87157
|
+
else if (child.get() instanceof Expressions.Source) {
|
|
87158
|
+
const nested = this.operandTypes(child, scope);
|
|
87159
|
+
if (nested === undefined) {
|
|
87160
|
+
return undefined;
|
|
87161
|
+
}
|
|
87162
|
+
ret.push(...nested);
|
|
87163
|
+
continue;
|
|
87164
|
+
}
|
|
87165
|
+
else if (child.get() instanceof Expressions.FieldChain) {
|
|
87166
|
+
found = this.fieldChainType(child, scope);
|
|
87167
|
+
}
|
|
87168
|
+
else if (child.get() instanceof Expressions.MethodCallChain) {
|
|
87169
|
+
found = this.methodCallType(child, scope);
|
|
87170
|
+
}
|
|
87171
|
+
else if (child.get() instanceof Expressions.Constant) {
|
|
87172
|
+
found = constant_1.Constant.runSyntax(child);
|
|
87173
|
+
}
|
|
87174
|
+
if (found === undefined
|
|
87175
|
+
|| found.isGeneric()
|
|
87176
|
+
|| !(found instanceof basic_1.PackedType || found instanceof basic_1.IntegerType || found instanceof basic_1.Integer8Type)) {
|
|
87177
|
+
return undefined;
|
|
87178
|
+
}
|
|
87179
|
+
ret.push(found);
|
|
87180
|
+
}
|
|
87181
|
+
return ret;
|
|
87182
|
+
}
|
|
87183
|
+
methodCallType(chain, scope) {
|
|
87184
|
+
var _a, _b, _c;
|
|
87185
|
+
const last = chain.getLastChild();
|
|
87186
|
+
if (!(last instanceof nodes_1.ExpressionNode) || !(last.get() instanceof Expressions.MethodCall)) {
|
|
87187
|
+
return undefined;
|
|
87188
|
+
}
|
|
87189
|
+
const name = (_a = last.findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
87190
|
+
if (name === undefined) {
|
|
87191
|
+
return undefined;
|
|
87192
|
+
}
|
|
87193
|
+
const method = (_b = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.MethodReference
|
|
87194
|
+
&& reference.position.getStart().equals(name.getStart()))) === null || _b === void 0 ? void 0 : _b.resolved;
|
|
87195
|
+
if (!(method instanceof types_1.MethodDefinition)) {
|
|
87196
|
+
return undefined;
|
|
87197
|
+
}
|
|
87198
|
+
return (_c = method.getParameters().getReturning()) === null || _c === void 0 ? void 0 : _c.getType();
|
|
87199
|
+
}
|
|
87200
|
+
fieldChainType(fieldChain, scope) {
|
|
87201
|
+
var _a;
|
|
87202
|
+
const operand = (_a = scope.getData().references.find(reference => reference.referenceType === _reference_1.ReferenceType.DataReadReference
|
|
87203
|
+
&& reference.position.getStart().equals(fieldChain.getFirstToken().getStart()))) === null || _a === void 0 ? void 0 : _a.resolved;
|
|
87204
|
+
if (!(operand instanceof _typed_identifier_1.TypedIdentifier)) {
|
|
87205
|
+
return undefined;
|
|
87206
|
+
}
|
|
87207
|
+
let type = operand.getType();
|
|
87208
|
+
for (const child of fieldChain.getChildren()) {
|
|
87209
|
+
if (!(child instanceof nodes_1.ExpressionNode)
|
|
87210
|
+
|| child.get() instanceof Expressions.SourceField) {
|
|
87211
|
+
continue;
|
|
87212
|
+
}
|
|
87213
|
+
else if (child.get() instanceof Expressions.ComponentName) {
|
|
87214
|
+
if (type instanceof basic_1.TableType) {
|
|
87215
|
+
type = type.getRowType();
|
|
87216
|
+
}
|
|
87217
|
+
if (!(type instanceof basic_1.StructureType)) {
|
|
87218
|
+
return undefined;
|
|
87219
|
+
}
|
|
87220
|
+
type = type.getComponentByName(child.concatTokens());
|
|
87221
|
+
}
|
|
87222
|
+
else {
|
|
87223
|
+
return undefined;
|
|
87224
|
+
}
|
|
87225
|
+
}
|
|
87226
|
+
return type;
|
|
87227
|
+
}
|
|
87228
|
+
}
|
|
87229
|
+
exports.InlinePackedComputation = InlinePackedComputation;
|
|
87230
|
+
//# sourceMappingURL=inline_packed_computation.js.map
|
|
87231
|
+
|
|
87232
|
+
/***/ },
|
|
87233
|
+
|
|
85828
87234
|
/***/ "../core/build/src/rules/intf_referencing_clas.js"
|
|
85829
87235
|
/*!********************************************************!*\
|
|
85830
87236
|
!*** ../core/build/src/rules/intf_referencing_clas.js ***!
|
|
@@ -85854,6 +87260,7 @@ exports.IntfReferencingClasConf = IntfReferencingClasConf;
|
|
|
85854
87260
|
class IntfReferencingClas {
|
|
85855
87261
|
constructor() {
|
|
85856
87262
|
this.conf = new IntfReferencingClasConf();
|
|
87263
|
+
this.allow = [];
|
|
85857
87264
|
}
|
|
85858
87265
|
getMetadata() {
|
|
85859
87266
|
return {
|
|
@@ -85874,6 +87281,7 @@ class IntfReferencingClas {
|
|
|
85874
87281
|
}
|
|
85875
87282
|
setConfig(conf) {
|
|
85876
87283
|
this.conf = conf;
|
|
87284
|
+
this.allow = (this.conf.allow || []).map(reg => new RegExp(reg, "i"));
|
|
85877
87285
|
}
|
|
85878
87286
|
initialize(reg) {
|
|
85879
87287
|
this.reg = reg;
|
|
@@ -85899,7 +87307,7 @@ class IntfReferencingClas {
|
|
|
85899
87307
|
if (found && ddic.isException(found.getClassDefinition(), found)) {
|
|
85900
87308
|
continue;
|
|
85901
87309
|
}
|
|
85902
|
-
else if (this.
|
|
87310
|
+
else if (this.allow.some(reg => reg.test(r.extra.ooName))) {
|
|
85903
87311
|
continue;
|
|
85904
87312
|
}
|
|
85905
87313
|
ret.push(issue_1.Issue.atIdentifier(r.position, message + r.extra.ooName, this.getMetadata().key, this.conf.severity));
|
|
@@ -86884,7 +88292,7 @@ https://docs.abapopenchecks.org/checks/16/`,
|
|
|
86884
88292
|
}
|
|
86885
88293
|
}
|
|
86886
88294
|
const rows = file.getRawRows();
|
|
86887
|
-
const reg =
|
|
88295
|
+
const reg = /^\)?\. *(".*)?$/;
|
|
86888
88296
|
for (let i = 0; i < rows.length; i++) {
|
|
86889
88297
|
if (reg.exec(rows[i].trim())) {
|
|
86890
88298
|
const column = rows[i].indexOf(")") >= 0 ? rows[i].indexOf(")") + 1 : rows[i].indexOf(".") + 1;
|
|
@@ -86949,6 +88357,7 @@ class LocalClassNaming extends _abap_rule_1.ABAPRule {
|
|
|
86949
88357
|
constructor() {
|
|
86950
88358
|
super(...arguments);
|
|
86951
88359
|
this.conf = new LocalClassNamingConf();
|
|
88360
|
+
this.regex = this.compile();
|
|
86952
88361
|
}
|
|
86953
88362
|
getMetadata() {
|
|
86954
88363
|
return {
|
|
@@ -86972,6 +88381,15 @@ ENDCLASS.`,
|
|
|
86972
88381
|
}
|
|
86973
88382
|
setConfig(conf) {
|
|
86974
88383
|
this.conf = conf;
|
|
88384
|
+
this.regex = this.compile();
|
|
88385
|
+
}
|
|
88386
|
+
compile() {
|
|
88387
|
+
return {
|
|
88388
|
+
local: new RegExp(this.conf.local, "i"),
|
|
88389
|
+
exception: new RegExp(this.conf.exception, "i"),
|
|
88390
|
+
test: new RegExp(this.conf.test, "i"),
|
|
88391
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
88392
|
+
};
|
|
86975
88393
|
}
|
|
86976
88394
|
runParsed(file, obj) {
|
|
86977
88395
|
const issues = [];
|
|
@@ -86985,20 +88403,23 @@ ENDCLASS.`,
|
|
|
86985
88403
|
}
|
|
86986
88404
|
const className = classDef.name;
|
|
86987
88405
|
let expected;
|
|
88406
|
+
let regex;
|
|
86988
88407
|
if (classDef.isForTesting) {
|
|
86989
88408
|
expected = this.conf.test;
|
|
88409
|
+
regex = this.regex.test;
|
|
86990
88410
|
}
|
|
86991
88411
|
else if (ddic.isException(classDef, obj)) {
|
|
86992
88412
|
expected = this.conf.exception;
|
|
88413
|
+
regex = this.regex.exception;
|
|
86993
88414
|
}
|
|
86994
88415
|
else {
|
|
86995
88416
|
expected = this.conf.local;
|
|
88417
|
+
regex = this.regex.local;
|
|
86996
88418
|
}
|
|
86997
88419
|
if (expected === undefined || expected.length === 0) {
|
|
86998
88420
|
continue;
|
|
86999
88421
|
}
|
|
87000
|
-
|
|
87001
|
-
if (name_validator_1.NameValidator.violatesRule(className, regex, this.conf)) {
|
|
88422
|
+
if (name_validator_1.NameValidator.violatesRule(className, regex, this.conf, this.regex.ignorePatterns)) {
|
|
87002
88423
|
issues.push(issue_1.Issue.atIdentifier(classDef.identifier, this.getDescription(expected, className), this.getMetadata().key, this.conf.severity));
|
|
87003
88424
|
}
|
|
87004
88425
|
}
|
|
@@ -87160,6 +88581,7 @@ class LocalVariableNames extends _abap_rule_1.ABAPRule {
|
|
|
87160
88581
|
constructor() {
|
|
87161
88582
|
super(...arguments);
|
|
87162
88583
|
this.conf = new LocalVariableNamesConf();
|
|
88584
|
+
this.regex = this.compile();
|
|
87163
88585
|
}
|
|
87164
88586
|
getMetadata() {
|
|
87165
88587
|
return {
|
|
@@ -87187,6 +88609,15 @@ ENDFORM.`,
|
|
|
87187
88609
|
}
|
|
87188
88610
|
setConfig(conf) {
|
|
87189
88611
|
this.conf = conf;
|
|
88612
|
+
this.regex = this.compile();
|
|
88613
|
+
}
|
|
88614
|
+
compile() {
|
|
88615
|
+
return {
|
|
88616
|
+
expectedData: new RegExp(this.conf.expectedData, "i"),
|
|
88617
|
+
expectedConstant: new RegExp(this.conf.expectedConstant, "i"),
|
|
88618
|
+
expectedFS: new RegExp(this.conf.expectedFS, "i"),
|
|
88619
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
88620
|
+
};
|
|
87190
88621
|
}
|
|
87191
88622
|
runParsed(file) {
|
|
87192
88623
|
const ret = [];
|
|
@@ -87220,7 +88651,7 @@ ENDFORM.`,
|
|
|
87220
88651
|
const found = dat.findFirstExpression(Expressions.DefinitionName);
|
|
87221
88652
|
if (found) {
|
|
87222
88653
|
const token = found.getFirstToken();
|
|
87223
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedData));
|
|
88654
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedData, this.regex.expectedData));
|
|
87224
88655
|
}
|
|
87225
88656
|
}
|
|
87226
88657
|
// inline data
|
|
@@ -87228,7 +88659,7 @@ ENDFORM.`,
|
|
|
87228
88659
|
const found = dat.findFirstExpression(Expressions.TargetField);
|
|
87229
88660
|
if (found) {
|
|
87230
88661
|
const token = found.getFirstToken();
|
|
87231
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedData));
|
|
88662
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedData, this.regex.expectedData));
|
|
87232
88663
|
}
|
|
87233
88664
|
}
|
|
87234
88665
|
// data structures, data begin of, first level
|
|
@@ -87239,14 +88670,14 @@ ENDFORM.`,
|
|
|
87239
88670
|
const found = stat === null || stat === void 0 ? void 0 : stat.findFirstExpression(Expressions.DefinitionName);
|
|
87240
88671
|
if (found) {
|
|
87241
88672
|
const token = found.getFirstToken();
|
|
87242
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedData));
|
|
88673
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedData, this.regex.expectedData));
|
|
87243
88674
|
}
|
|
87244
88675
|
}
|
|
87245
88676
|
for (const fieldsymbol of structure.findAllStatements(Statements.FieldSymbol)) {
|
|
87246
88677
|
const found = fieldsymbol.findFirstExpression(Expressions.FieldSymbol);
|
|
87247
88678
|
if (found) {
|
|
87248
88679
|
const token = found.getFirstToken();
|
|
87249
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));
|
|
88680
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS, this.regex.expectedFS));
|
|
87250
88681
|
}
|
|
87251
88682
|
}
|
|
87252
88683
|
// inline field symbols
|
|
@@ -87254,7 +88685,7 @@ ENDFORM.`,
|
|
|
87254
88685
|
const found = fieldsymbol.findFirstExpression(Expressions.TargetFieldSymbol);
|
|
87255
88686
|
if (found) {
|
|
87256
88687
|
const token = found.getFirstToken();
|
|
87257
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS));
|
|
88688
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedFS, this.regex.expectedFS));
|
|
87258
88689
|
}
|
|
87259
88690
|
}
|
|
87260
88691
|
const constants = structure.findAllStatements(Statements.Constant);
|
|
@@ -87266,16 +88697,15 @@ ENDFORM.`,
|
|
|
87266
88697
|
const found = constant.findFirstExpression(Expressions.DefinitionName);
|
|
87267
88698
|
if (found) {
|
|
87268
88699
|
const token = found.getFirstToken();
|
|
87269
|
-
ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant));
|
|
88700
|
+
ret = ret.concat(this.checkName(token, file, this.conf.expectedConstant, this.regex.expectedConstant));
|
|
87270
88701
|
}
|
|
87271
88702
|
}
|
|
87272
88703
|
return ret;
|
|
87273
88704
|
}
|
|
87274
|
-
checkName(token, file, expected) {
|
|
88705
|
+
checkName(token, file, expected, regex) {
|
|
87275
88706
|
const ret = [];
|
|
87276
|
-
const regex = new RegExp(expected, "i");
|
|
87277
88707
|
const name = token.getStr();
|
|
87278
|
-
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {
|
|
88708
|
+
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf, this.regex.ignorePatterns)) {
|
|
87279
88709
|
const message = this.getDescription(expected, name);
|
|
87280
88710
|
const issue = issue_1.Issue.atToken(file, token, message, this.getMetadata().key, this.conf.severity);
|
|
87281
88711
|
ret.push(issue);
|
|
@@ -87350,6 +88780,7 @@ class MacroNaming extends _abap_rule_1.ABAPRule {
|
|
|
87350
88780
|
constructor() {
|
|
87351
88781
|
super(...arguments);
|
|
87352
88782
|
this.conf = new MacroNamingConf();
|
|
88783
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
87353
88784
|
}
|
|
87354
88785
|
getMetadata() {
|
|
87355
88786
|
return {
|
|
@@ -87369,10 +88800,10 @@ END-OF-DEFINITION.`,
|
|
|
87369
88800
|
}
|
|
87370
88801
|
setConfig(conf) {
|
|
87371
88802
|
this.conf = conf;
|
|
88803
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
87372
88804
|
}
|
|
87373
88805
|
runParsed(file, obj) {
|
|
87374
88806
|
const issues = [];
|
|
87375
|
-
const testRegex = new RegExp(this.conf.pattern, "i");
|
|
87376
88807
|
if (obj instanceof objects_1.TypePool) {
|
|
87377
88808
|
return [];
|
|
87378
88809
|
}
|
|
@@ -87385,7 +88816,7 @@ END-OF-DEFINITION.`,
|
|
|
87385
88816
|
continue;
|
|
87386
88817
|
}
|
|
87387
88818
|
const token = expr.getFirstToken();
|
|
87388
|
-
if (
|
|
88819
|
+
if (this.regex.exec(token.getStr())) {
|
|
87389
88820
|
continue;
|
|
87390
88821
|
}
|
|
87391
88822
|
else {
|
|
@@ -88524,6 +89955,7 @@ exports.MethodParameterNamesConf = MethodParameterNamesConf;
|
|
|
88524
89955
|
class MethodParameterNames {
|
|
88525
89956
|
constructor() {
|
|
88526
89957
|
this.conf = new MethodParameterNamesConf();
|
|
89958
|
+
this.regex = this.compile();
|
|
88527
89959
|
}
|
|
88528
89960
|
getMetadata() {
|
|
88529
89961
|
return {
|
|
@@ -88549,6 +89981,16 @@ class MethodParameterNames {
|
|
|
88549
89981
|
}
|
|
88550
89982
|
setConfig(conf) {
|
|
88551
89983
|
this.conf = conf;
|
|
89984
|
+
this.regex = this.compile();
|
|
89985
|
+
}
|
|
89986
|
+
compile() {
|
|
89987
|
+
return {
|
|
89988
|
+
importing: new RegExp(this.conf.importing, "i"),
|
|
89989
|
+
returning: new RegExp(this.conf.returning, "i"),
|
|
89990
|
+
changing: new RegExp(this.conf.changing, "i"),
|
|
89991
|
+
exporting: new RegExp(this.conf.exporting, "i"),
|
|
89992
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
89993
|
+
};
|
|
88552
89994
|
}
|
|
88553
89995
|
initialize(reg) {
|
|
88554
89996
|
this.reg = reg;
|
|
@@ -88588,16 +90030,16 @@ class MethodParameterNames {
|
|
|
88588
90030
|
for (const p of method.parameters) {
|
|
88589
90031
|
switch (p.direction) {
|
|
88590
90032
|
case _abap_file_information_1.MethodParameterDirection.Importing:
|
|
88591
|
-
ret = ret.concat(this.checkParameter(p, this.conf.importing));
|
|
90033
|
+
ret = ret.concat(this.checkParameter(p, this.conf.importing, this.regex.importing));
|
|
88592
90034
|
break;
|
|
88593
90035
|
case _abap_file_information_1.MethodParameterDirection.Exporting:
|
|
88594
|
-
ret = ret.concat(this.checkParameter(p, this.conf.exporting));
|
|
90036
|
+
ret = ret.concat(this.checkParameter(p, this.conf.exporting, this.regex.exporting));
|
|
88595
90037
|
break;
|
|
88596
90038
|
case _abap_file_information_1.MethodParameterDirection.Changing:
|
|
88597
|
-
ret = ret.concat(this.checkParameter(p, this.conf.changing));
|
|
90039
|
+
ret = ret.concat(this.checkParameter(p, this.conf.changing, this.regex.changing));
|
|
88598
90040
|
break;
|
|
88599
90041
|
case _abap_file_information_1.MethodParameterDirection.Returning:
|
|
88600
|
-
ret = ret.concat(this.checkParameter(p, this.conf.returning));
|
|
90042
|
+
ret = ret.concat(this.checkParameter(p, this.conf.returning, this.regex.returning));
|
|
88601
90043
|
break;
|
|
88602
90044
|
default:
|
|
88603
90045
|
break;
|
|
@@ -88605,11 +90047,10 @@ class MethodParameterNames {
|
|
|
88605
90047
|
}
|
|
88606
90048
|
return ret;
|
|
88607
90049
|
}
|
|
88608
|
-
checkParameter(param, expected) {
|
|
90050
|
+
checkParameter(param, expected, regex) {
|
|
88609
90051
|
const ret = [];
|
|
88610
|
-
const regex = new RegExp(expected, "i");
|
|
88611
90052
|
const name = param.name;
|
|
88612
|
-
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf)) {
|
|
90053
|
+
if (name_validator_1.NameValidator.violatesRule(name, regex, this.conf, this.regex.ignorePatterns)) {
|
|
88613
90054
|
const message = this.getDescription(expected, name);
|
|
88614
90055
|
const issue = issue_1.Issue.atIdentifier(param.identifier, message, this.getMetadata().key, this.conf.severity);
|
|
88615
90056
|
ret.push(issue);
|
|
@@ -88794,6 +90235,7 @@ exports.ModifyOnlyOwnDBTablesConf = ModifyOnlyOwnDBTablesConf;
|
|
|
88794
90235
|
class ModifyOnlyOwnDBTables {
|
|
88795
90236
|
constructor() {
|
|
88796
90237
|
this.conf = new ModifyOnlyOwnDBTablesConf();
|
|
90238
|
+
this.ownTables = new RegExp(this.conf.ownTables, "i");
|
|
88797
90239
|
}
|
|
88798
90240
|
getMetadata() {
|
|
88799
90241
|
return {
|
|
@@ -88811,6 +90253,7 @@ class ModifyOnlyOwnDBTables {
|
|
|
88811
90253
|
}
|
|
88812
90254
|
setConfig(conf) {
|
|
88813
90255
|
this.conf = conf;
|
|
90256
|
+
this.ownTables = new RegExp(this.conf.ownTables, "i");
|
|
88814
90257
|
}
|
|
88815
90258
|
initialize(reg) {
|
|
88816
90259
|
this.reg = reg;
|
|
@@ -88828,7 +90271,6 @@ class ModifyOnlyOwnDBTables {
|
|
|
88828
90271
|
if (struc === undefined) {
|
|
88829
90272
|
return [];
|
|
88830
90273
|
}
|
|
88831
|
-
const regExp = new RegExp(this.getConfig().ownTables, "i");
|
|
88832
90274
|
for (const s of file.getStatements()) {
|
|
88833
90275
|
const g = s.get();
|
|
88834
90276
|
if (g instanceof Statements.DeleteDatabase
|
|
@@ -88846,7 +90288,7 @@ class ModifyOnlyOwnDBTables {
|
|
|
88846
90288
|
continue;
|
|
88847
90289
|
}
|
|
88848
90290
|
const concat = databaseTable.concatTokens().toUpperCase();
|
|
88849
|
-
if (
|
|
90291
|
+
if (this.ownTables.test(concat) === false) {
|
|
88850
90292
|
// must contain a ReferenceType.TableVoidReference or a ReferenceType.TableReference if its a dependency
|
|
88851
90293
|
if (spaghetti === undefined) {
|
|
88852
90294
|
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
@@ -89938,6 +91380,31 @@ const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "..
|
|
|
89938
91380
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
89939
91381
|
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
89940
91382
|
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
91383
|
+
const artifacts_1 = __webpack_require__(/*! ../abap/artifacts */ "../core/build/src/abap/artifacts.js");
|
|
91384
|
+
const combi_1 = __webpack_require__(/*! ../abap/2_statements/combi */ "../core/build/src/abap/2_statements/combi.js");
|
|
91385
|
+
let keywords = undefined;
|
|
91386
|
+
/** every word of the statement and expression grammar, upper case */
|
|
91387
|
+
function getKeywords() {
|
|
91388
|
+
if (keywords === undefined) {
|
|
91389
|
+
const list = [];
|
|
91390
|
+
for (const stat of artifacts_1.ArtifactsABAP.getStatements()) {
|
|
91391
|
+
list.push(...combi_1.Combi.listKeywords(stat.getMatcher()));
|
|
91392
|
+
}
|
|
91393
|
+
for (const expr of artifacts_1.ArtifactsABAP.getExpressions()) {
|
|
91394
|
+
list.push(...combi_1.Combi.listKeywords(new expr().getRunnable()));
|
|
91395
|
+
}
|
|
91396
|
+
keywords = new Set();
|
|
91397
|
+
for (const words of list) {
|
|
91398
|
+
// a WordSequence lists eg. "PREFERRED PARAMETER" or "IS-INITIAL" as one entry
|
|
91399
|
+
for (const word of words.replace(/-/g, " ").split(" ")) {
|
|
91400
|
+
if (word !== "") {
|
|
91401
|
+
keywords.add(word.toUpperCase());
|
|
91402
|
+
}
|
|
91403
|
+
}
|
|
91404
|
+
}
|
|
91405
|
+
}
|
|
91406
|
+
return keywords;
|
|
91407
|
+
}
|
|
89941
91408
|
class NoExclamationEscapeConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
89942
91409
|
}
|
|
89943
91410
|
exports.NoExclamationEscapeConf = NoExclamationEscapeConf;
|
|
@@ -89951,8 +91418,10 @@ class NoExclamationEscape extends _abap_rule_1.ABAPRule {
|
|
|
89951
91418
|
key: "no_exclamation_escape",
|
|
89952
91419
|
title: "No exclamation escape",
|
|
89953
91420
|
shortDescription: `Detects and removes exclamation marks (!) used to escape identifiers`,
|
|
89954
|
-
|
|
89955
|
-
|
|
91421
|
+
extendedInformation: `Exclamation marks are not needed when the identifier is not a keyword, or could be avoided by renaming.
|
|
91422
|
+
|
|
91423
|
+
An identifier named like an ABAP keyword is allowed to be escaped, eg. a method parameter "!default",
|
|
91424
|
+
which the system otherwise reads as the DEFAULT addition of the parameter before it.`,
|
|
89956
91425
|
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
89957
91426
|
badExample: "methods CONVERT changing !CO_sdf type ref to ZCL_sdf optional.",
|
|
89958
91427
|
goodExample: "methods CONVERT changing CO_sdf type ref to ZCL_sdf optional.",
|
|
@@ -89971,6 +91440,9 @@ class NoExclamationEscape extends _abap_rule_1.ABAPRule {
|
|
|
89971
91440
|
const str = token.getStr();
|
|
89972
91441
|
if (str.startsWith("!")) {
|
|
89973
91442
|
const replacement = str.substring(1);
|
|
91443
|
+
if (getKeywords().has(replacement.toUpperCase())) {
|
|
91444
|
+
continue;
|
|
91445
|
+
}
|
|
89974
91446
|
const fix = edit_helper_1.EditHelper.replaceToken(file, token, replacement);
|
|
89975
91447
|
issues.push(issue_1.Issue.atToken(file, token, "Do not use exclamation mark to escape identifiers", this.getMetadata().key, this.conf.severity, fix));
|
|
89976
91448
|
}
|
|
@@ -90518,6 +91990,7 @@ class NoPrefixes extends _abap_rule_1.ABAPRule {
|
|
|
90518
91990
|
constructor() {
|
|
90519
91991
|
super(...arguments);
|
|
90520
91992
|
this.conf = new NoPrefixesConf();
|
|
91993
|
+
this.regex = this.compile();
|
|
90521
91994
|
}
|
|
90522
91995
|
getMetadata() {
|
|
90523
91996
|
return {
|
|
@@ -90541,6 +92014,18 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
90541
92014
|
}
|
|
90542
92015
|
setConfig(conf) {
|
|
90543
92016
|
this.conf = conf;
|
|
92017
|
+
this.regex = this.compile();
|
|
92018
|
+
}
|
|
92019
|
+
compile() {
|
|
92020
|
+
const compile = (pattern) => pattern !== undefined && pattern !== "" ? new RegExp(pattern, "i") : undefined;
|
|
92021
|
+
return {
|
|
92022
|
+
data: compile(this.conf.data),
|
|
92023
|
+
statics: compile(this.conf.statics),
|
|
92024
|
+
fieldSymbols: compile(this.conf.fieldSymbols),
|
|
92025
|
+
constants: compile(this.conf.constants),
|
|
92026
|
+
types: compile(this.conf.types),
|
|
92027
|
+
methodParameters: compile(this.conf.methodParameters),
|
|
92028
|
+
};
|
|
90544
92029
|
}
|
|
90545
92030
|
runParsed(file) {
|
|
90546
92031
|
const ret = [];
|
|
@@ -90554,38 +92039,38 @@ https://github.com/SAP/styleguides/blob/main/clean-abap/sub-sections/AvoidEncodi
|
|
|
90554
92039
|
if (max === undefined || max < 1) {
|
|
90555
92040
|
max = 10;
|
|
90556
92041
|
}
|
|
90557
|
-
if (
|
|
90558
|
-
ret.push(...this.checkData(structure,
|
|
92042
|
+
if (this.regex.data !== undefined) {
|
|
92043
|
+
ret.push(...this.checkData(structure, this.regex.data, file));
|
|
90559
92044
|
}
|
|
90560
92045
|
if (ret.length >= max) {
|
|
90561
92046
|
return ret;
|
|
90562
92047
|
}
|
|
90563
|
-
if (
|
|
90564
|
-
ret.push(...this.checkStatics(structure,
|
|
92048
|
+
if (this.regex.statics !== undefined) {
|
|
92049
|
+
ret.push(...this.checkStatics(structure, this.regex.statics, file));
|
|
90565
92050
|
}
|
|
90566
92051
|
if (ret.length >= max) {
|
|
90567
92052
|
return ret;
|
|
90568
92053
|
}
|
|
90569
|
-
if (
|
|
90570
|
-
ret.push(...this.checkFieldSymbols(structure,
|
|
92054
|
+
if (this.regex.fieldSymbols !== undefined) {
|
|
92055
|
+
ret.push(...this.checkFieldSymbols(structure, this.regex.fieldSymbols, file));
|
|
90571
92056
|
}
|
|
90572
92057
|
if (ret.length >= max) {
|
|
90573
92058
|
return ret;
|
|
90574
92059
|
}
|
|
90575
|
-
if (
|
|
90576
|
-
ret.push(...this.checkConstants(structure,
|
|
92060
|
+
if (this.regex.constants !== undefined) {
|
|
92061
|
+
ret.push(...this.checkConstants(structure, this.regex.constants, file));
|
|
90577
92062
|
}
|
|
90578
92063
|
if (ret.length >= max) {
|
|
90579
92064
|
return ret;
|
|
90580
92065
|
}
|
|
90581
|
-
if (
|
|
90582
|
-
ret.push(...this.checkTypes(structure,
|
|
92066
|
+
if (this.regex.types !== undefined) {
|
|
92067
|
+
ret.push(...this.checkTypes(structure, this.regex.types, file));
|
|
90583
92068
|
}
|
|
90584
92069
|
if (ret.length >= max) {
|
|
90585
92070
|
return ret;
|
|
90586
92071
|
}
|
|
90587
|
-
if (
|
|
90588
|
-
ret.push(...this.checkMethodParameters(structure,
|
|
92072
|
+
if (this.regex.methodParameters !== undefined) {
|
|
92073
|
+
ret.push(...this.checkMethodParameters(structure, this.regex.methodParameters, file));
|
|
90589
92074
|
}
|
|
90590
92075
|
return ret;
|
|
90591
92076
|
}
|
|
@@ -91140,6 +92625,7 @@ exports.ObjectNamingConf = ObjectNamingConf;
|
|
|
91140
92625
|
class ObjectNaming {
|
|
91141
92626
|
constructor() {
|
|
91142
92627
|
this.conf = new ObjectNamingConf();
|
|
92628
|
+
this.regex = this.compile();
|
|
91143
92629
|
}
|
|
91144
92630
|
getMetadata() {
|
|
91145
92631
|
return {
|
|
@@ -91162,6 +92648,20 @@ class ObjectNaming {
|
|
|
91162
92648
|
}
|
|
91163
92649
|
setConfig(conf) {
|
|
91164
92650
|
this.conf = conf;
|
|
92651
|
+
this.regex = this.compile();
|
|
92652
|
+
}
|
|
92653
|
+
compile() {
|
|
92654
|
+
const config = this.getConfig();
|
|
92655
|
+
const patterns = new Map();
|
|
92656
|
+
for (const [key, value] of Object.entries(config)) {
|
|
92657
|
+
if (typeof value === "string" && key !== "patternKind" && key !== "severity") {
|
|
92658
|
+
patterns.set(key, new RegExp(value, "i"));
|
|
92659
|
+
}
|
|
92660
|
+
}
|
|
92661
|
+
return {
|
|
92662
|
+
patterns,
|
|
92663
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(config),
|
|
92664
|
+
};
|
|
91165
92665
|
}
|
|
91166
92666
|
initialize(_reg) {
|
|
91167
92667
|
return this;
|
|
@@ -91175,11 +92675,11 @@ class ObjectNaming {
|
|
|
91175
92675
|
const config = this.getConfig();
|
|
91176
92676
|
// @ts-ignore
|
|
91177
92677
|
const pattern = config[abapType];
|
|
91178
|
-
|
|
92678
|
+
const regex = this.regex.patterns.get(abapType);
|
|
92679
|
+
if (pattern === undefined || regex === undefined) {
|
|
91179
92680
|
return [];
|
|
91180
92681
|
}
|
|
91181
|
-
|
|
91182
|
-
if (name_validator_1.NameValidator.violatesRule(obj.getName(), regex, this.conf)) {
|
|
92682
|
+
if (name_validator_1.NameValidator.violatesRule(obj.getName(), regex, this.conf, this.regex.ignorePatterns)) {
|
|
91183
92683
|
message = this.getDescription(pattern, obj.getName());
|
|
91184
92684
|
}
|
|
91185
92685
|
if (message) {
|
|
@@ -93625,6 +95125,292 @@ exports.PreferInline = PreferInline;
|
|
|
93625
95125
|
|
|
93626
95126
|
/***/ },
|
|
93627
95127
|
|
|
95128
|
+
/***/ "../core/build/src/rules/prefer_inline_cast.js"
|
|
95129
|
+
/*!*****************************************************!*\
|
|
95130
|
+
!*** ../core/build/src/rules/prefer_inline_cast.js ***!
|
|
95131
|
+
\*****************************************************/
|
|
95132
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
95133
|
+
|
|
95134
|
+
"use strict";
|
|
95135
|
+
|
|
95136
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
95137
|
+
if (k2 === undefined) k2 = k;
|
|
95138
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
95139
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
95140
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
95141
|
+
}
|
|
95142
|
+
Object.defineProperty(o, k2, desc);
|
|
95143
|
+
}) : (function(o, m, k, k2) {
|
|
95144
|
+
if (k2 === undefined) k2 = k;
|
|
95145
|
+
o[k2] = m[k];
|
|
95146
|
+
}));
|
|
95147
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
95148
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
95149
|
+
}) : function(o, v) {
|
|
95150
|
+
o["default"] = v;
|
|
95151
|
+
});
|
|
95152
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
95153
|
+
var ownKeys = function(o) {
|
|
95154
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
95155
|
+
var ar = [];
|
|
95156
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
95157
|
+
return ar;
|
|
95158
|
+
};
|
|
95159
|
+
return ownKeys(o);
|
|
95160
|
+
};
|
|
95161
|
+
return function (mod) {
|
|
95162
|
+
if (mod && mod.__esModule) return mod;
|
|
95163
|
+
var result = {};
|
|
95164
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
95165
|
+
__setModuleDefault(result, mod);
|
|
95166
|
+
return result;
|
|
95167
|
+
};
|
|
95168
|
+
})();
|
|
95169
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
95170
|
+
exports.PreferInlineCast = exports.PreferInlineCastConf = void 0;
|
|
95171
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
95172
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
95173
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
95174
|
+
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
95175
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
95176
|
+
const _identifier_1 = __webpack_require__(/*! ../abap/4_file_information/_identifier */ "../core/build/src/abap/4_file_information/_identifier.js");
|
|
95177
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
95178
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
95179
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
95180
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
95181
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
95182
|
+
const version_1 = __webpack_require__(/*! ../version */ "../core/build/src/version.js");
|
|
95183
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
95184
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
95185
|
+
class PreferInlineCastConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
95186
|
+
}
|
|
95187
|
+
exports.PreferInlineCastConf = PreferInlineCastConf;
|
|
95188
|
+
class PreferInlineCast {
|
|
95189
|
+
constructor() {
|
|
95190
|
+
this.conf = new PreferInlineCastConf();
|
|
95191
|
+
}
|
|
95192
|
+
getMetadata() {
|
|
95193
|
+
return {
|
|
95194
|
+
key: "prefer_inline_cast",
|
|
95195
|
+
title: "Prefer Inline CAST",
|
|
95196
|
+
shortDescription: `Inline a CAST helper read only once in the next statement`,
|
|
95197
|
+
extendedInformation: `Requires 7.40 SP02 or above, or ABAP Cloud, and no syntax errors.
|
|
95198
|
+
|
|
95199
|
+
Reports DATA(t) = CAST type( source ) when the helper has exactly one read and no other access,
|
|
95200
|
+
except its declaration write, in the entire syntax scope (including earlier reads in loop bodies and exception handlers).
|
|
95201
|
+
The immediately following statement must be a plain assignment, an attribute read, a receiver method call,
|
|
95202
|
+
or a named IMPORTING argument of a functional method call (caller syntax p = t).
|
|
95203
|
+
|
|
95204
|
+
Only class/interface CAST targets, simple assignment targets and static access are supported.
|
|
95205
|
+
For argument uses, the CAST operand must be a plain field chain without calls, the receiver and all
|
|
95206
|
+
other arguments must be plain variables or literals, and the method signature must be known.
|
|
95207
|
+
Explicit EXPORTING, IMPORTING and CHANGING sections are not supported.
|
|
95208
|
+
Objects containing macros or dynamic access are skipped. Field symbols, reference-taking,
|
|
95209
|
+
pragmas and chained statements are not supported.
|
|
95210
|
+
|
|
95211
|
+
Predicates such as IS INITIAL / IS BOUND and removal of statically redundant CASTs are left for a future version.`,
|
|
95212
|
+
tags: [_irule_1.RuleTag.Styleguide, _irule_1.RuleTag.Quickfix, _irule_1.RuleTag.SingleFile],
|
|
95213
|
+
badExample: `DATA(helper) = CAST lcl_node( object ).
|
|
95214
|
+
result = helper->get_tokens( ).`,
|
|
95215
|
+
goodExample: `result = CAST lcl_node( object )->get_tokens( ).`,
|
|
95216
|
+
};
|
|
95217
|
+
}
|
|
95218
|
+
getConfig() {
|
|
95219
|
+
return this.conf;
|
|
95220
|
+
}
|
|
95221
|
+
setConfig(conf) {
|
|
95222
|
+
this.conf = conf;
|
|
95223
|
+
}
|
|
95224
|
+
initialize(reg) {
|
|
95225
|
+
this.reg = reg;
|
|
95226
|
+
return this;
|
|
95227
|
+
}
|
|
95228
|
+
run(obj) {
|
|
95229
|
+
var _a;
|
|
95230
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)
|
|
95231
|
+
|| (!(0, version_1.releaseAtLeast)(this.reg.getConfig().getRelease(), version_1.Release.v740sp02)
|
|
95232
|
+
&& this.reg.getConfig().getLanguageVersion() !== version_1.LanguageVersion.Cloud)) {
|
|
95233
|
+
return [];
|
|
95234
|
+
}
|
|
95235
|
+
// Neither macro expansion nor a dynamically named variable has reliable references.
|
|
95236
|
+
let hasCast = false;
|
|
95237
|
+
for (const file of obj.getABAPFiles()) {
|
|
95238
|
+
for (const statement of file.getStatements()) {
|
|
95239
|
+
hasCast || (hasCast = statement.findFirstExpression(Expressions.Cast) !== undefined);
|
|
95240
|
+
const type = statement.get();
|
|
95241
|
+
if (type instanceof _statement_1.Unknown || type instanceof Statements.Define
|
|
95242
|
+
|| type instanceof _statement_1.MacroCall || type instanceof _statement_1.MacroContent || type instanceof _statement_1.MacroRecursion
|
|
95243
|
+
|| statement.findFirstExpression(Expressions.Dynamic) !== undefined) {
|
|
95244
|
+
return [];
|
|
95245
|
+
}
|
|
95246
|
+
}
|
|
95247
|
+
}
|
|
95248
|
+
if (!hasCast) {
|
|
95249
|
+
return [];
|
|
95250
|
+
}
|
|
95251
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
95252
|
+
if (syntax.issues.length > 0) {
|
|
95253
|
+
return [];
|
|
95254
|
+
}
|
|
95255
|
+
const references = new Map();
|
|
95256
|
+
const knownMethods = new Set();
|
|
95257
|
+
for (const reference of this.references(syntax.spaghetti.getTop())) {
|
|
95258
|
+
if (reference.resolved === undefined) {
|
|
95259
|
+
continue;
|
|
95260
|
+
}
|
|
95261
|
+
const key = this.identifierKey(reference.resolved);
|
|
95262
|
+
const uses = references.get(key) || [];
|
|
95263
|
+
uses.push(reference);
|
|
95264
|
+
references.set(key, uses);
|
|
95265
|
+
if (reference.referenceType === _reference_1.ReferenceType.MethodReference) {
|
|
95266
|
+
knownMethods.add(this.identifierKey(reference.position));
|
|
95267
|
+
}
|
|
95268
|
+
}
|
|
95269
|
+
const issues = [];
|
|
95270
|
+
for (const file of obj.getABAPFiles()) {
|
|
95271
|
+
const statements = file.getStatements();
|
|
95272
|
+
for (let index = 0; index < statements.length - 1; index++) {
|
|
95273
|
+
const declaration = statements[index];
|
|
95274
|
+
const next = statements[index + 1];
|
|
95275
|
+
const cast = this.castDeclaration(declaration);
|
|
95276
|
+
const inline = declaration.findFirstExpression(Expressions.InlineData);
|
|
95277
|
+
const name = (_a = inline === null || inline === void 0 ? void 0 : inline.findDirectExpression(Expressions.TargetField)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
95278
|
+
if (cast === undefined || name === undefined) {
|
|
95279
|
+
continue;
|
|
95280
|
+
}
|
|
95281
|
+
const scope = syntax.spaghetti.lookupPosition(name.getStart(), file.getFilename());
|
|
95282
|
+
const identifier = scope === null || scope === void 0 ? void 0 : scope.findVariable(name.getStr());
|
|
95283
|
+
if (!(identifier instanceof _typed_identifier_1.TypedIdentifier) || !(identifier.getType() instanceof basic_1.ObjectReferenceType)
|
|
95284
|
+
|| identifier.getType().containsVoid()
|
|
95285
|
+
|| identifier.getType().isGeneric()) {
|
|
95286
|
+
continue;
|
|
95287
|
+
}
|
|
95288
|
+
const uses = references.get(this.identifierKey(identifier)) || [];
|
|
95289
|
+
const reads = uses.filter(r => r.referenceType === _reference_1.ReferenceType.DataReadReference);
|
|
95290
|
+
const writes = uses.filter(r => r.referenceType === _reference_1.ReferenceType.DataWriteReference);
|
|
95291
|
+
if (reads.length !== 1 || writes.length !== 1
|
|
95292
|
+
|| !declaration.includesToken(writes[0].position.getToken())
|
|
95293
|
+
|| uses.length !== 2 || !next.includesToken(reads[0].position.getToken())
|
|
95294
|
+
|| !this.supportedUse(next, reads[0].position, knownMethods, cast)) {
|
|
95295
|
+
continue;
|
|
95296
|
+
}
|
|
95297
|
+
// Replace the later occurrence first, also when both statements are on the same line.
|
|
95298
|
+
const fix = edit_helper_1.EditHelper.merge(edit_helper_1.EditHelper.replaceToken(file, reads[0].position.getToken(), cast.concatTokensWithLinebreaks()), edit_helper_1.EditHelper.deleteStatement(file, declaration));
|
|
95299
|
+
issues.push(issue_1.Issue.atToken(file, name, "Inline single-use CAST helper", this.getMetadata().key, this.conf.severity, fix));
|
|
95300
|
+
}
|
|
95301
|
+
}
|
|
95302
|
+
return issues;
|
|
95303
|
+
}
|
|
95304
|
+
identifierKey(identifier) {
|
|
95305
|
+
const start = identifier.getStart();
|
|
95306
|
+
return identifier.getFilename() + "," + start.getRow() + "," + start.getCol();
|
|
95307
|
+
}
|
|
95308
|
+
references(node) {
|
|
95309
|
+
return node.getData().references.concat(...node.getChildren().map(child => this.references(child)));
|
|
95310
|
+
}
|
|
95311
|
+
castDeclaration(statement) {
|
|
95312
|
+
var _a;
|
|
95313
|
+
if (!(statement.get() instanceof Statements.Move) || statement.getColon() !== undefined
|
|
95314
|
+
|| statement.getPragmas().length > 0) {
|
|
95315
|
+
return undefined;
|
|
95316
|
+
}
|
|
95317
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
95318
|
+
const source = statement.findDirectExpression(Expressions.Source);
|
|
95319
|
+
const chain = source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.MethodCallChain);
|
|
95320
|
+
const cast = chain === null || chain === void 0 ? void 0 : chain.findDirectExpression(Expressions.Cast);
|
|
95321
|
+
if ((target === null || target === void 0 ? void 0 : target.getChildren().length) !== 1 || target.findDirectExpression(Expressions.InlineData) === undefined
|
|
95322
|
+
|| (source === null || source === void 0 ? void 0 : source.getChildren().length) !== 1 || (chain === null || chain === void 0 ? void 0 : chain.getChildren().length) !== 1
|
|
95323
|
+
|| cast === undefined || cast.findDirectExpression(Expressions.Let) !== undefined
|
|
95324
|
+
|| cast.findDirectExpression(Expressions.Dereference) !== undefined
|
|
95325
|
+
|| ((_a = cast.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _a === void 0 ? void 0 : _a.concatTokens()) === "#"
|
|
95326
|
+
|| statement.findFirstExpression(Expressions.SourceFieldSymbol) !== undefined
|
|
95327
|
+
|| statement.getTokens().length !== target.countTokens() + source.countTokens() + 2
|
|
95328
|
+
|| statement.getTokens()[target.countTokens()].getStr() !== "=") {
|
|
95329
|
+
return undefined;
|
|
95330
|
+
}
|
|
95331
|
+
return cast;
|
|
95332
|
+
}
|
|
95333
|
+
supportedUse(statement, read, knownMethods, cast) {
|
|
95334
|
+
var _a, _b, _c;
|
|
95335
|
+
if (statement.getColon() !== undefined || statement.getPragmas().length > 0
|
|
95336
|
+
|| statement.findFirstExpression(Expressions.SourceFieldSymbol) !== undefined
|
|
95337
|
+
|| statement.findFirstExpression(Expressions.MethodParameters) !== undefined) {
|
|
95338
|
+
return false;
|
|
95339
|
+
}
|
|
95340
|
+
let chain;
|
|
95341
|
+
if (statement.get() instanceof Statements.Move) {
|
|
95342
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
95343
|
+
const source = statement.findDirectExpression(Expressions.Source);
|
|
95344
|
+
if (target === undefined || source === undefined || !this.simpleTarget(target)
|
|
95345
|
+
|| statement.getTokens().length !== target.countTokens() + source.countTokens() + 2
|
|
95346
|
+
|| statement.getTokens()[target.countTokens()].getStr() !== "="
|
|
95347
|
+
|| source.getChildren().length !== 1) {
|
|
95348
|
+
return false;
|
|
95349
|
+
}
|
|
95350
|
+
const field = source.findDirectExpression(Expressions.FieldChain);
|
|
95351
|
+
if (field !== undefined) {
|
|
95352
|
+
const tokens = field.getTokens();
|
|
95353
|
+
return field.getFirstToken().getStart().equals(read.getStart())
|
|
95354
|
+
&& (tokens.length === 1 || (tokens.length === 3 && tokens[1].getStr() === "->"
|
|
95355
|
+
&& field.findDirectExpression(Expressions.AttributeName) !== undefined));
|
|
95356
|
+
}
|
|
95357
|
+
chain = source.findDirectExpression(Expressions.MethodCallChain);
|
|
95358
|
+
}
|
|
95359
|
+
else if (statement.get() instanceof Statements.Call) {
|
|
95360
|
+
chain = statement.findDirectExpression(Expressions.MethodCallChain);
|
|
95361
|
+
}
|
|
95362
|
+
if (chain === undefined) {
|
|
95363
|
+
return false;
|
|
95364
|
+
}
|
|
95365
|
+
const calls = chain.findDirectExpressions(Expressions.MethodCall);
|
|
95366
|
+
const receiver = chain.findDirectExpression(Expressions.FieldChain);
|
|
95367
|
+
if (calls.length !== 1 || (chain.getChildren().length !== 1 && chain.getChildren().length !== 3)
|
|
95368
|
+
|| (receiver !== undefined && receiver.countTokens() !== 1)) {
|
|
95369
|
+
return false;
|
|
95370
|
+
}
|
|
95371
|
+
if (receiver === null || receiver === void 0 ? void 0 : receiver.getFirstToken().getStart().equals(read.getStart())) {
|
|
95372
|
+
// The receiver is evaluated first; even calls in its arguments stay after the CAST.
|
|
95373
|
+
return true;
|
|
95374
|
+
}
|
|
95375
|
+
// Named argument uses are limited to functional calls with a known signature.
|
|
95376
|
+
const method = (_a = calls[0].findDirectExpression(Expressions.MethodName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
|
|
95377
|
+
if (!(statement.get() instanceof Statements.Move) || method === undefined
|
|
95378
|
+
|| !this.plainCastOperand(cast)
|
|
95379
|
+
|| !knownMethods.has(this.identifierKey(new _identifier_1.Identifier(method, read.getFilename())))) {
|
|
95380
|
+
return false;
|
|
95381
|
+
}
|
|
95382
|
+
const parameters = (_c = (_b = calls[0].findDirectExpression(Expressions.MethodCallParam)) === null || _b === void 0 ? void 0 : _b.findDirectExpression(Expressions.ParameterListS)) === null || _c === void 0 ? void 0 : _c.findDirectExpressions(Expressions.ParameterS);
|
|
95383
|
+
return parameters !== undefined && parameters.some(p => { var _a; return (_a = p.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStart().equals(read.getStart()); })
|
|
95384
|
+
&& parameters.every(p => this.plainSource(p.findDirectExpression(Expressions.Source)));
|
|
95385
|
+
}
|
|
95386
|
+
plainCastOperand(cast) {
|
|
95387
|
+
// Unlike receiver uses, argument uses can evaluate the receiver before the CAST operand.
|
|
95388
|
+
// Exclude calls, table expressions and computed offsets/lengths from the field chain.
|
|
95389
|
+
const source = cast.findDirectExpression(Expressions.Source);
|
|
95390
|
+
const field = source === null || source === void 0 ? void 0 : source.findDirectExpression(Expressions.FieldChain);
|
|
95391
|
+
return (source === null || source === void 0 ? void 0 : source.getChildren().length) === 1 && field !== undefined
|
|
95392
|
+
&& field.findFirstExpression(Expressions.MethodCall) === undefined
|
|
95393
|
+
&& field.findFirstExpression(Expressions.TableExpression) === undefined
|
|
95394
|
+
&& field.findFirstExpression(Expressions.FieldOffset) === undefined
|
|
95395
|
+
&& field.findFirstExpression(Expressions.FieldLength) === undefined;
|
|
95396
|
+
}
|
|
95397
|
+
simpleTarget(target) {
|
|
95398
|
+
return target.countTokens() === 1 && target.findDirectExpression(Expressions.TargetField) !== undefined
|
|
95399
|
+
|| target.getChildren().length === 1 && target.findDirectExpression(Expressions.InlineData) !== undefined;
|
|
95400
|
+
}
|
|
95401
|
+
plainSource(source) {
|
|
95402
|
+
if ((source === null || source === void 0 ? void 0 : source.getChildren().length) !== 1) {
|
|
95403
|
+
return false;
|
|
95404
|
+
}
|
|
95405
|
+
return source.findDirectExpression(Expressions.Constant) !== undefined
|
|
95406
|
+
|| source.countTokens() === 1 && source.findDirectExpression(Expressions.FieldChain) !== undefined;
|
|
95407
|
+
}
|
|
95408
|
+
}
|
|
95409
|
+
exports.PreferInlineCast = PreferInlineCast;
|
|
95410
|
+
//# sourceMappingURL=prefer_inline_cast.js.map
|
|
95411
|
+
|
|
95412
|
+
/***/ },
|
|
95413
|
+
|
|
93628
95414
|
/***/ "../core/build/src/rules/prefer_insert_into_table.js"
|
|
93629
95415
|
/*!***********************************************************!*\
|
|
93630
95416
|
!*** ../core/build/src/rules/prefer_insert_into_table.js ***!
|
|
@@ -94987,6 +96773,216 @@ exports.PrefixIsCurrentClass = PrefixIsCurrentClass;
|
|
|
94987
96773
|
|
|
94988
96774
|
/***/ },
|
|
94989
96775
|
|
|
96776
|
+
/***/ "../core/build/src/rules/range_row_values.js"
|
|
96777
|
+
/*!***************************************************!*\
|
|
96778
|
+
!*** ../core/build/src/rules/range_row_values.js ***!
|
|
96779
|
+
\***************************************************/
|
|
96780
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
96781
|
+
|
|
96782
|
+
"use strict";
|
|
96783
|
+
|
|
96784
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
96785
|
+
if (k2 === undefined) k2 = k;
|
|
96786
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
96787
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
96788
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
96789
|
+
}
|
|
96790
|
+
Object.defineProperty(o, k2, desc);
|
|
96791
|
+
}) : (function(o, m, k, k2) {
|
|
96792
|
+
if (k2 === undefined) k2 = k;
|
|
96793
|
+
o[k2] = m[k];
|
|
96794
|
+
}));
|
|
96795
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
96796
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
96797
|
+
}) : function(o, v) {
|
|
96798
|
+
o["default"] = v;
|
|
96799
|
+
});
|
|
96800
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
96801
|
+
var ownKeys = function(o) {
|
|
96802
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
96803
|
+
var ar = [];
|
|
96804
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
96805
|
+
return ar;
|
|
96806
|
+
};
|
|
96807
|
+
return ownKeys(o);
|
|
96808
|
+
};
|
|
96809
|
+
return function (mod) {
|
|
96810
|
+
if (mod && mod.__esModule) return mod;
|
|
96811
|
+
var result = {};
|
|
96812
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
96813
|
+
__setModuleDefault(result, mod);
|
|
96814
|
+
return result;
|
|
96815
|
+
};
|
|
96816
|
+
})();
|
|
96817
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
96818
|
+
exports.RangeRowValues = exports.RangeRowValuesConf = void 0;
|
|
96819
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
96820
|
+
const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "../core/build/src/abap/5_syntax/_reference.js");
|
|
96821
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
96822
|
+
const nodes_1 = __webpack_require__(/*! ../abap/nodes */ "../core/build/src/abap/nodes/index.js");
|
|
96823
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
96824
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
96825
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
96826
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
96827
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
96828
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
96829
|
+
const RANGE_COMPONENTS = ["SIGN", "OPTION", "LOW", "HIGH"];
|
|
96830
|
+
const SIGNS = ["I", "E"];
|
|
96831
|
+
const OPTIONS = ["EQ", "NE", "BT", "NB", "CP", "NP", "GT", "GE", "LT", "LE"];
|
|
96832
|
+
class RangeRowValuesConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
96833
|
+
}
|
|
96834
|
+
exports.RangeRowValuesConf = RangeRowValuesConf;
|
|
96835
|
+
class RangeRowValues {
|
|
96836
|
+
constructor() {
|
|
96837
|
+
this.conf = new RangeRowValuesConf();
|
|
96838
|
+
}
|
|
96839
|
+
getMetadata() {
|
|
96840
|
+
return {
|
|
96841
|
+
key: "range_row_values",
|
|
96842
|
+
title: "Range row values",
|
|
96843
|
+
shortDescription: `Checks the SIGN and OPTION of range rows built with VALUE`,
|
|
96844
|
+
extendedInformation: `A row of a range table, ie. a structure with exactly the components SIGN, OPTION, LOW and HIGH,
|
|
96845
|
+
is a selection structure to the syntax check. For a VALUE row of one, the system warns when SIGN or OPTION
|
|
96846
|
+
is missing, and when a literal is not a permitted value: SIGN must be I or E, OPTION one of
|
|
96847
|
+
EQ NE BT NB CP NP GT GE LT LE, in upper case.
|
|
96848
|
+
|
|
96849
|
+
Components given in the VALUE header count for the rows that follow, eg. VALUE #( sign = 'I' option = 'EQ' ( low = 1 ) ).
|
|
96850
|
+
Only literals are checked, a value from a variable, constant or expression is not.`,
|
|
96851
|
+
tags: [_irule_1.RuleTag.Syntax],
|
|
96852
|
+
badExample: `TYPES ty_range TYPE RANGE OF string.
|
|
96853
|
+
DATA(range) = VALUE ty_range( ( sign = 'I' option = 'eq' low = \`a\` )
|
|
96854
|
+
( sign = 'I' low = \`b\` ) ).`,
|
|
96855
|
+
goodExample: `TYPES ty_range TYPE RANGE OF string.
|
|
96856
|
+
DATA(range) = VALUE ty_range( ( sign = 'I' option = 'EQ' low = \`a\` )
|
|
96857
|
+
( sign = 'I' option = 'EQ' low = \`b\` ) ).`,
|
|
96858
|
+
};
|
|
96859
|
+
}
|
|
96860
|
+
getConfig() {
|
|
96861
|
+
return this.conf;
|
|
96862
|
+
}
|
|
96863
|
+
setConfig(conf) {
|
|
96864
|
+
this.conf = conf;
|
|
96865
|
+
}
|
|
96866
|
+
initialize(reg) {
|
|
96867
|
+
this.reg = reg;
|
|
96868
|
+
return this;
|
|
96869
|
+
}
|
|
96870
|
+
run(obj) {
|
|
96871
|
+
var _a, _b, _c;
|
|
96872
|
+
if (!(obj instanceof _abap_object_1.ABAPObject)) {
|
|
96873
|
+
return [];
|
|
96874
|
+
}
|
|
96875
|
+
const syntax = new syntax_1.SyntaxLogic(this.reg, obj).run();
|
|
96876
|
+
if (syntax.issues.length > 0) {
|
|
96877
|
+
return [];
|
|
96878
|
+
}
|
|
96879
|
+
const issues = [];
|
|
96880
|
+
for (const file of obj.getABAPFiles()) {
|
|
96881
|
+
for (const source of ((_a = file.getStructure()) === null || _a === void 0 ? void 0 : _a.findAllExpressionsRecursive(Expressions.Source)) || []) {
|
|
96882
|
+
if (source.getFirstToken().getStr().toUpperCase() !== "VALUE") {
|
|
96883
|
+
continue;
|
|
96884
|
+
}
|
|
96885
|
+
const typeToken = (_b = source.findDirectExpression(Expressions.TypeNameOrInfer)) === null || _b === void 0 ? void 0 : _b.getFirstToken();
|
|
96886
|
+
const body = source.findDirectExpression(Expressions.ValueBody);
|
|
96887
|
+
if (typeToken === undefined || body === undefined) {
|
|
96888
|
+
continue;
|
|
96889
|
+
}
|
|
96890
|
+
const scope = syntax.spaghetti.lookupPosition(typeToken.getStart(), file.getFilename());
|
|
96891
|
+
const resolved = (_c = scope === null || scope === void 0 ? void 0 : scope.getData().references.find(r => r.referenceType === _reference_1.ReferenceType.InferredType
|
|
96892
|
+
&& r.position.getStart().equals(typeToken.getStart()))) === null || _c === void 0 ? void 0 : _c.resolved;
|
|
96893
|
+
if (!(resolved instanceof _typed_identifier_1.TypedIdentifier)) {
|
|
96894
|
+
continue;
|
|
96895
|
+
}
|
|
96896
|
+
const type = resolved.getType();
|
|
96897
|
+
if (type instanceof basic_1.TableType && this.isRangeRow(type.getRowType())) {
|
|
96898
|
+
const header = new Map();
|
|
96899
|
+
for (const child of body.getChildren()) {
|
|
96900
|
+
if (!(child instanceof nodes_1.ExpressionNode)) {
|
|
96901
|
+
continue;
|
|
96902
|
+
}
|
|
96903
|
+
else if (child.get() instanceof Expressions.FieldAssignment) {
|
|
96904
|
+
this.addAssignment(header, child);
|
|
96905
|
+
}
|
|
96906
|
+
else if (child.get() instanceof Expressions.ValueBodyLine) {
|
|
96907
|
+
const assignments = child.findDirectExpressions(Expressions.FieldAssignment);
|
|
96908
|
+
if (assignments.length === 0) {
|
|
96909
|
+
continue;
|
|
96910
|
+
}
|
|
96911
|
+
const row = new Map(header);
|
|
96912
|
+
for (const a of assignments) {
|
|
96913
|
+
this.addAssignment(row, a);
|
|
96914
|
+
}
|
|
96915
|
+
issues.push(...this.checkRow(file, child, row));
|
|
96916
|
+
}
|
|
96917
|
+
}
|
|
96918
|
+
}
|
|
96919
|
+
else if (this.isRangeRow(type) && body.findDirectExpression(Expressions.ValueBase) === undefined) {
|
|
96920
|
+
const assignments = body.findDirectExpressions(Expressions.FieldAssignment);
|
|
96921
|
+
if (assignments.length === 0) {
|
|
96922
|
+
continue;
|
|
96923
|
+
}
|
|
96924
|
+
const row = new Map();
|
|
96925
|
+
for (const a of assignments) {
|
|
96926
|
+
this.addAssignment(row, a);
|
|
96927
|
+
}
|
|
96928
|
+
issues.push(...this.checkRow(file, body, row));
|
|
96929
|
+
}
|
|
96930
|
+
}
|
|
96931
|
+
}
|
|
96932
|
+
return issues;
|
|
96933
|
+
}
|
|
96934
|
+
////////////////
|
|
96935
|
+
isRangeRow(type) {
|
|
96936
|
+
if (!(type instanceof basic_1.StructureType)) {
|
|
96937
|
+
return false;
|
|
96938
|
+
}
|
|
96939
|
+
const names = type.getComponents().map(c => c.name.toUpperCase());
|
|
96940
|
+
return names.length === RANGE_COMPONENTS.length && RANGE_COMPONENTS.every(c => names.includes(c));
|
|
96941
|
+
}
|
|
96942
|
+
addAssignment(row, assignment) {
|
|
96943
|
+
var _a;
|
|
96944
|
+
const name = (_a = assignment.findDirectExpression(Expressions.FieldSub)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
|
|
96945
|
+
const source = assignment.findDirectExpression(Expressions.Source);
|
|
96946
|
+
if (name && source) {
|
|
96947
|
+
row.set(name, source);
|
|
96948
|
+
}
|
|
96949
|
+
}
|
|
96950
|
+
checkRow(file, node, row) {
|
|
96951
|
+
const issues = [];
|
|
96952
|
+
for (const [component, allowed] of [["SIGN", SIGNS], ["OPTION", OPTIONS]]) {
|
|
96953
|
+
const source = row.get(component);
|
|
96954
|
+
if (source === undefined) {
|
|
96955
|
+
const message = `Specification ${component} is missing in the range row`;
|
|
96956
|
+
issues.push(issue_1.Issue.atToken(file, node.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
96957
|
+
continue;
|
|
96958
|
+
}
|
|
96959
|
+
const value = this.literal(source);
|
|
96960
|
+
if (value !== undefined && !allowed.includes(value)) {
|
|
96961
|
+
const message = `"${value}" is not a permitted value for ${component}, expected ${allowed.join(" ")}`;
|
|
96962
|
+
issues.push(issue_1.Issue.atToken(file, source.getFirstToken(), message, this.getMetadata().key, this.conf.severity));
|
|
96963
|
+
}
|
|
96964
|
+
}
|
|
96965
|
+
return issues;
|
|
96966
|
+
}
|
|
96967
|
+
/** The content of a character literal, undefined for anything else */
|
|
96968
|
+
literal(source) {
|
|
96969
|
+
var _a, _b;
|
|
96970
|
+
if (source.getChildren().length !== 1) {
|
|
96971
|
+
return undefined;
|
|
96972
|
+
}
|
|
96973
|
+
const str = (_b = (_a = source.findDirectExpression(Expressions.Constant)) === null || _a === void 0 ? void 0 : _a.findDirectExpression(Expressions.ConstantString)) === null || _b === void 0 ? void 0 : _b.getFirstToken().getStr();
|
|
96974
|
+
if (str === undefined) {
|
|
96975
|
+
return undefined;
|
|
96976
|
+
}
|
|
96977
|
+
const quote = str.charAt(0);
|
|
96978
|
+
return str.slice(1, -1).split(quote + quote).join(quote);
|
|
96979
|
+
}
|
|
96980
|
+
}
|
|
96981
|
+
exports.RangeRowValues = RangeRowValues;
|
|
96982
|
+
//# sourceMappingURL=range_row_values.js.map
|
|
96983
|
+
|
|
96984
|
+
/***/ },
|
|
96985
|
+
|
|
94990
96986
|
/***/ "../core/build/src/rules/reduce_procedural_code.js"
|
|
94991
96987
|
/*!*********************************************************!*\
|
|
94992
96988
|
!*** ../core/build/src/rules/reduce_procedural_code.js ***!
|
|
@@ -96498,6 +98494,7 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96498
98494
|
constructor() {
|
|
96499
98495
|
super(...arguments);
|
|
96500
98496
|
this.conf = new SelectionScreenNamingConf();
|
|
98497
|
+
this.regex = this.compile();
|
|
96501
98498
|
}
|
|
96502
98499
|
getMetadata() {
|
|
96503
98500
|
return {
|
|
@@ -96517,6 +98514,15 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96517
98514
|
}
|
|
96518
98515
|
setConfig(conf) {
|
|
96519
98516
|
this.conf = conf;
|
|
98517
|
+
this.regex = this.compile();
|
|
98518
|
+
}
|
|
98519
|
+
compile() {
|
|
98520
|
+
return {
|
|
98521
|
+
parameter: new RegExp(this.conf.parameter, "i"),
|
|
98522
|
+
selectOption: new RegExp(this.conf.selectOption, "i"),
|
|
98523
|
+
screenElement: new RegExp(this.conf.screenElement, "i"),
|
|
98524
|
+
ignorePatterns: name_validator_1.NameValidator.compileIgnorePatterns(this.conf),
|
|
98525
|
+
};
|
|
96520
98526
|
}
|
|
96521
98527
|
runParsed(file) {
|
|
96522
98528
|
const issues = [];
|
|
@@ -96540,8 +98546,8 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96540
98546
|
|| (stat.get() instanceof statements_1.SelectOption && !selectOptionDisabled)
|
|
96541
98547
|
|| (stat.get() instanceof statements_1.SelectionScreen && !screenElementDisabled)) {
|
|
96542
98548
|
const fieldNode = this.getFieldForStatementNode(stat);
|
|
96543
|
-
const regex =
|
|
96544
|
-
if (fieldNode && name_validator_1.NameValidator.violatesRule(fieldNode.getFirstToken().getStr(), regex, this.conf)) {
|
|
98549
|
+
const regex = this.getRegexForStatement(stat.get());
|
|
98550
|
+
if (fieldNode && name_validator_1.NameValidator.violatesRule(fieldNode.getFirstToken().getStr(), regex, this.conf, this.regex.ignorePatterns)) {
|
|
96545
98551
|
issues.push(issue_1.Issue.atToken(file, fieldNode.getFirstToken(), this.getDescription(this.getPatternForStatement(stat.get()), fieldNode.getFirstToken().getStr()), this.getMetadata().key, this.conf.severity));
|
|
96546
98552
|
}
|
|
96547
98553
|
}
|
|
@@ -96561,6 +98567,15 @@ class SelectionScreenNaming extends _abap_rule_1.ABAPRule {
|
|
|
96561
98567
|
}
|
|
96562
98568
|
return pattern;
|
|
96563
98569
|
}
|
|
98570
|
+
getRegexForStatement(statement) {
|
|
98571
|
+
if (statement instanceof statements_1.Parameter) {
|
|
98572
|
+
return this.regex.parameter;
|
|
98573
|
+
}
|
|
98574
|
+
else if (statement instanceof statements_1.SelectOption) {
|
|
98575
|
+
return this.regex.selectOption;
|
|
98576
|
+
}
|
|
98577
|
+
return this.regex.screenElement;
|
|
98578
|
+
}
|
|
96564
98579
|
getFieldForStatementNode(statNode) {
|
|
96565
98580
|
if (statNode.get() instanceof statements_1.Parameter) {
|
|
96566
98581
|
return statNode.findFirstExpression(expressions_1.FieldSub);
|
|
@@ -96963,8 +98978,7 @@ class SICFConsistency {
|
|
|
96963
98978
|
if (this.conf.skipNames && this.conf.skipNames.some((a) => a.toUpperCase() === h.toUpperCase())) {
|
|
96964
98979
|
continue;
|
|
96965
98980
|
}
|
|
96966
|
-
|
|
96967
|
-
if (pattern.test(h) === true) {
|
|
98981
|
+
if (this.reg.inErrorNamespace(h) === true) {
|
|
96968
98982
|
const message = "Handler class " + h + " not found";
|
|
96969
98983
|
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], new position_1.Position(1, 1), message, this.getMetadata().key, this.conf.severity);
|
|
96970
98984
|
issues.push(issue);
|
|
@@ -97227,6 +99241,204 @@ exports.SMIMConsistency = SMIMConsistency;
|
|
|
97227
99241
|
|
|
97228
99242
|
/***/ },
|
|
97229
99243
|
|
|
99244
|
+
/***/ "../core/build/src/rules/sort_empty_key.js"
|
|
99245
|
+
/*!*************************************************!*\
|
|
99246
|
+
!*** ../core/build/src/rules/sort_empty_key.js ***!
|
|
99247
|
+
\*************************************************/
|
|
99248
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
99249
|
+
|
|
99250
|
+
"use strict";
|
|
99251
|
+
|
|
99252
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
99253
|
+
if (k2 === undefined) k2 = k;
|
|
99254
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
99255
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
99256
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
99257
|
+
}
|
|
99258
|
+
Object.defineProperty(o, k2, desc);
|
|
99259
|
+
}) : (function(o, m, k, k2) {
|
|
99260
|
+
if (k2 === undefined) k2 = k;
|
|
99261
|
+
o[k2] = m[k];
|
|
99262
|
+
}));
|
|
99263
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
99264
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
99265
|
+
}) : function(o, v) {
|
|
99266
|
+
o["default"] = v;
|
|
99267
|
+
});
|
|
99268
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
99269
|
+
var ownKeys = function(o) {
|
|
99270
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
99271
|
+
var ar = [];
|
|
99272
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
99273
|
+
return ar;
|
|
99274
|
+
};
|
|
99275
|
+
return ownKeys(o);
|
|
99276
|
+
};
|
|
99277
|
+
return function (mod) {
|
|
99278
|
+
if (mod && mod.__esModule) return mod;
|
|
99279
|
+
var result = {};
|
|
99280
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
99281
|
+
__setModuleDefault(result, mod);
|
|
99282
|
+
return result;
|
|
99283
|
+
};
|
|
99284
|
+
})();
|
|
99285
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
99286
|
+
exports.SortEmptyKey = exports.SortEmptyKeyConf = void 0;
|
|
99287
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
99288
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
99289
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
99290
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
99291
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
99292
|
+
const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "../core/build/src/abap/5_syntax/syntax.js");
|
|
99293
|
+
const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../core/build/src/objects/_abap_object.js");
|
|
99294
|
+
const basic_1 = __webpack_require__(/*! ../abap/types/basic */ "../core/build/src/abap/types/basic/index.js");
|
|
99295
|
+
const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "../core/build/src/abap/types/_typed_identifier.js");
|
|
99296
|
+
const tokens_1 = __webpack_require__(/*! ../abap/1_lexer/tokens */ "../core/build/src/abap/1_lexer/tokens/index.js");
|
|
99297
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
99298
|
+
class SortEmptyKeyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
99299
|
+
}
|
|
99300
|
+
exports.SortEmptyKeyConf = SortEmptyKeyConf;
|
|
99301
|
+
class SortEmptyKey {
|
|
99302
|
+
constructor() {
|
|
99303
|
+
this.conf = new SortEmptyKeyConf();
|
|
99304
|
+
}
|
|
99305
|
+
getMetadata() {
|
|
99306
|
+
return {
|
|
99307
|
+
key: "sort_empty_key",
|
|
99308
|
+
title: "SORT or DELETE ADJACENT DUPLICATES on a table with an empty key",
|
|
99309
|
+
shortDescription: `SORT without BY and DELETE ADJACENT DUPLICATES without COMPARING on a table with an empty primary key`,
|
|
99310
|
+
extendedInformation: `Without BY or COMPARING, both statements use the primary key of the table. For a table
|
|
99311
|
+
declared WITH EMPTY KEY there is nothing to sort or compare by, SORT does nothing.
|
|
99312
|
+
|
|
99313
|
+
The syntax check warns: "ITAB is a table with an empty primary key. Check the semantics of the statement."
|
|
99314
|
+
|
|
99315
|
+
Sorted and hashed tables, tables with a default or explicit key, and tables of unknown or generic type are not reported.
|
|
99316
|
+
|
|
99317
|
+
The quick fix adds BY table_line or COMPARING table_line, for tables with an elementary row type.`,
|
|
99318
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
99319
|
+
badExample: `DATA result TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
|
99320
|
+
SORT result.
|
|
99321
|
+
DELETE ADJACENT DUPLICATES FROM result.`,
|
|
99322
|
+
goodExample: `DATA result TYPE STANDARD TABLE OF string WITH EMPTY KEY.
|
|
99323
|
+
SORT result BY table_line.
|
|
99324
|
+
DELETE ADJACENT DUPLICATES FROM result COMPARING table_line.`,
|
|
99325
|
+
};
|
|
99326
|
+
}
|
|
99327
|
+
getConfig() {
|
|
99328
|
+
return this.conf;
|
|
99329
|
+
}
|
|
99330
|
+
initialize(reg) {
|
|
99331
|
+
this.reg = reg;
|
|
99332
|
+
return this;
|
|
99333
|
+
}
|
|
99334
|
+
setConfig(conf) {
|
|
99335
|
+
this.conf = conf;
|
|
99336
|
+
}
|
|
99337
|
+
run(obj) {
|
|
99338
|
+
if (!(obj instanceof _abap_object_1.ABAPObject) || obj.getType() === "INTF") {
|
|
99339
|
+
return [];
|
|
99340
|
+
}
|
|
99341
|
+
const issues = [];
|
|
99342
|
+
let spaghetti = undefined;
|
|
99343
|
+
for (const file of obj.getABAPFiles()) {
|
|
99344
|
+
for (const statement of file.getStatements()) {
|
|
99345
|
+
let addition;
|
|
99346
|
+
if (statement.get() instanceof Statements.Sort) {
|
|
99347
|
+
if (statement.findDirectTokenByText("BY") !== undefined) {
|
|
99348
|
+
continue;
|
|
99349
|
+
}
|
|
99350
|
+
addition = "BY";
|
|
99351
|
+
}
|
|
99352
|
+
else if (statement.get() instanceof Statements.DeleteInternal) {
|
|
99353
|
+
if (statement.findDirectTokenByText("ADJACENT") === undefined
|
|
99354
|
+
|| statement.findDirectTokenByText("COMPARING") !== undefined
|
|
99355
|
+
|| statement.findDirectTokenByText("USING") !== undefined) {
|
|
99356
|
+
continue;
|
|
99357
|
+
}
|
|
99358
|
+
addition = "COMPARING";
|
|
99359
|
+
}
|
|
99360
|
+
else {
|
|
99361
|
+
continue;
|
|
99362
|
+
}
|
|
99363
|
+
const target = statement.findDirectExpression(Expressions.Target);
|
|
99364
|
+
if (target === undefined) {
|
|
99365
|
+
continue;
|
|
99366
|
+
}
|
|
99367
|
+
if (spaghetti === undefined) {
|
|
99368
|
+
spaghetti = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti;
|
|
99369
|
+
}
|
|
99370
|
+
const type = this.findType(target, spaghetti, file);
|
|
99371
|
+
if (!(type instanceof basic_1.TableType)
|
|
99372
|
+
|| type.getOptions().keyType !== basic_1.TableKeyType.empty
|
|
99373
|
+
|| type.isGeneric()
|
|
99374
|
+
|| (type.getAccessType() !== undefined && type.getAccessType() !== basic_1.TableAccessType.standard)) {
|
|
99375
|
+
continue;
|
|
99376
|
+
}
|
|
99377
|
+
const verb = addition === "BY" ? "SORT without BY" : "DELETE ADJACENT DUPLICATES without COMPARING";
|
|
99378
|
+
const message = `${verb} on "${target.concatTokens()}", a table with an empty primary key`;
|
|
99379
|
+
const fix = this.buildFix(file, statement, type.getRowType(), addition);
|
|
99380
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
99381
|
+
}
|
|
99382
|
+
}
|
|
99383
|
+
return issues;
|
|
99384
|
+
}
|
|
99385
|
+
////////////////
|
|
99386
|
+
/** The type of a target built from names, components and attributes only, else undefined */
|
|
99387
|
+
findType(target, spaghetti, file) {
|
|
99388
|
+
var _a;
|
|
99389
|
+
let type = undefined;
|
|
99390
|
+
for (const child of target.getChildren()) {
|
|
99391
|
+
const get = child.get();
|
|
99392
|
+
if (get instanceof Expressions.TargetField
|
|
99393
|
+
|| get instanceof Expressions.TargetFieldSymbol
|
|
99394
|
+
|| get instanceof Expressions.AttributeName) {
|
|
99395
|
+
type = (_a = this.findReference(child.getFirstToken().getStart(), spaghetti, file)) === null || _a === void 0 ? void 0 : _a.getType();
|
|
99396
|
+
}
|
|
99397
|
+
else if (get instanceof Expressions.ComponentName) {
|
|
99398
|
+
type = type instanceof basic_1.StructureType ? type.getComponentByName(child.concatTokens()) : undefined;
|
|
99399
|
+
}
|
|
99400
|
+
else if (!(get instanceof tokens_1.Dash)
|
|
99401
|
+
&& !(get instanceof tokens_1.InstanceArrow)
|
|
99402
|
+
&& !(get instanceof tokens_1.StaticArrow)
|
|
99403
|
+
&& !(get instanceof Expressions.ClassName)) {
|
|
99404
|
+
return undefined;
|
|
99405
|
+
}
|
|
99406
|
+
if (type === undefined && !(get instanceof Expressions.ClassName) && !(get instanceof tokens_1.StaticArrow)) {
|
|
99407
|
+
return undefined;
|
|
99408
|
+
}
|
|
99409
|
+
}
|
|
99410
|
+
return type;
|
|
99411
|
+
}
|
|
99412
|
+
findReference(start, spaghetti, file) {
|
|
99413
|
+
const scope = spaghetti.lookupPosition(start, file.getFilename());
|
|
99414
|
+
for (const r of (scope === null || scope === void 0 ? void 0 : scope.getData().references) || []) {
|
|
99415
|
+
if (r.position.getStart().equals(start) && r.resolved instanceof _typed_identifier_1.TypedIdentifier) {
|
|
99416
|
+
return r.resolved;
|
|
99417
|
+
}
|
|
99418
|
+
}
|
|
99419
|
+
return undefined;
|
|
99420
|
+
}
|
|
99421
|
+
buildFix(file, statement, rowType, addition) {
|
|
99422
|
+
if (rowType instanceof basic_1.StructureType
|
|
99423
|
+
|| rowType instanceof basic_1.TableType
|
|
99424
|
+
|| rowType instanceof basic_1.VoidType
|
|
99425
|
+
|| rowType instanceof basic_1.UnknownType
|
|
99426
|
+
|| rowType.isGeneric()) {
|
|
99427
|
+
return undefined;
|
|
99428
|
+
}
|
|
99429
|
+
const tokens = statement.getTokens();
|
|
99430
|
+
let last = tokens[tokens.length - 1];
|
|
99431
|
+
if (last instanceof tokens_1.Punctuation) {
|
|
99432
|
+
last = tokens[tokens.length - 2];
|
|
99433
|
+
}
|
|
99434
|
+
return edit_helper_1.EditHelper.insertAt(file, last.getEnd(), ` ${addition} table_line`);
|
|
99435
|
+
}
|
|
99436
|
+
}
|
|
99437
|
+
exports.SortEmptyKey = SortEmptyKey;
|
|
99438
|
+
//# sourceMappingURL=sort_empty_key.js.map
|
|
99439
|
+
|
|
99440
|
+
/***/ },
|
|
99441
|
+
|
|
97230
99442
|
/***/ "../core/build/src/rules/space_before_colon.js"
|
|
97231
99443
|
/*!*****************************************************!*\
|
|
97232
99444
|
!*** ../core/build/src/rules/space_before_colon.js ***!
|
|
@@ -97966,6 +100178,236 @@ exports.StrictSQL = StrictSQL;
|
|
|
97966
100178
|
|
|
97967
100179
|
/***/ },
|
|
97968
100180
|
|
|
100181
|
+
/***/ "../core/build/src/rules/subrc_after_assign.js"
|
|
100182
|
+
/*!*****************************************************!*\
|
|
100183
|
+
!*** ../core/build/src/rules/subrc_after_assign.js ***!
|
|
100184
|
+
\*****************************************************/
|
|
100185
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
100186
|
+
|
|
100187
|
+
"use strict";
|
|
100188
|
+
|
|
100189
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
100190
|
+
if (k2 === undefined) k2 = k;
|
|
100191
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
100192
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
100193
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
100194
|
+
}
|
|
100195
|
+
Object.defineProperty(o, k2, desc);
|
|
100196
|
+
}) : (function(o, m, k, k2) {
|
|
100197
|
+
if (k2 === undefined) k2 = k;
|
|
100198
|
+
o[k2] = m[k];
|
|
100199
|
+
}));
|
|
100200
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
100201
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
100202
|
+
}) : function(o, v) {
|
|
100203
|
+
o["default"] = v;
|
|
100204
|
+
});
|
|
100205
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
100206
|
+
var ownKeys = function(o) {
|
|
100207
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
100208
|
+
var ar = [];
|
|
100209
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
100210
|
+
return ar;
|
|
100211
|
+
};
|
|
100212
|
+
return ownKeys(o);
|
|
100213
|
+
};
|
|
100214
|
+
return function (mod) {
|
|
100215
|
+
if (mod && mod.__esModule) return mod;
|
|
100216
|
+
var result = {};
|
|
100217
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
100218
|
+
__setModuleDefault(result, mod);
|
|
100219
|
+
return result;
|
|
100220
|
+
};
|
|
100221
|
+
})();
|
|
100222
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
100223
|
+
exports.SubrcAfterAssign = exports.SubrcAfterAssignConf = void 0;
|
|
100224
|
+
const Statements = __importStar(__webpack_require__(/*! ../abap/2_statements/statements */ "../core/build/src/abap/2_statements/statements/index.js"));
|
|
100225
|
+
const Expressions = __importStar(__webpack_require__(/*! ../abap/2_statements/expressions */ "../core/build/src/abap/2_statements/expressions/index.js"));
|
|
100226
|
+
const issue_1 = __webpack_require__(/*! ../issue */ "../core/build/src/issue.js");
|
|
100227
|
+
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
100228
|
+
const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/rules/_abap_rule.js");
|
|
100229
|
+
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
100230
|
+
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
100231
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
100232
|
+
const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
|
|
100233
|
+
class SubrcAfterAssignConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
100234
|
+
constructor() {
|
|
100235
|
+
super(...arguments);
|
|
100236
|
+
this.severity = severity_1.Severity.Warning;
|
|
100237
|
+
}
|
|
100238
|
+
}
|
|
100239
|
+
exports.SubrcAfterAssignConf = SubrcAfterAssignConf;
|
|
100240
|
+
class SubrcAfterAssign extends _abap_rule_1.ABAPRule {
|
|
100241
|
+
constructor() {
|
|
100242
|
+
super(...arguments);
|
|
100243
|
+
this.conf = new SubrcAfterAssignConf();
|
|
100244
|
+
}
|
|
100245
|
+
getMetadata() {
|
|
100246
|
+
return {
|
|
100247
|
+
key: "subrc_after_assign",
|
|
100248
|
+
title: "sy-subrc checked after ASSIGN",
|
|
100249
|
+
shortDescription: `Reports a sy-subrc check directly after an ASSIGN, use IS [NOT] ASSIGNED instead`,
|
|
100250
|
+
extendedInformation: `On a 7.40 SP7 system sy-subrc was still 4 after a successful ASSIGN, left over from an earlier
|
|
100251
|
+
READ TABLE, see https://github.com/abap2UI5/abap2UI5/issues/1937. Current releases set sy-subrc here.
|
|
100252
|
+
IS [NOT] ASSIGNED asks the field symbol directly and does not depend on the release.
|
|
100253
|
+
|
|
100254
|
+
A failed ASSIGN keeps the previous binding of the field symbol. So inside a loop, or when the
|
|
100255
|
+
field symbol is bound earlier in the same method, IS ASSIGNED is true after a failed ASSIGN.
|
|
100256
|
+
There, add UNASSIGN <fs> before the ASSIGN. The quick fix is only offered when the field symbol
|
|
100257
|
+
is declared in the method, bound only by this ASSIGN, and the ASSIGN is not in a loop.
|
|
100258
|
+
|
|
100259
|
+
ASSIGN COMPONENT ... OF STRUCTURE is not reported.`,
|
|
100260
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
100261
|
+
badExample: `ASSIGN (lv_name) TO <attri>.
|
|
100262
|
+
IF sy-subrc = 0.
|
|
100263
|
+
WRITE <attri>.
|
|
100264
|
+
ENDIF.`,
|
|
100265
|
+
goodExample: `ASSIGN (lv_name) TO <attri>.
|
|
100266
|
+
IF <attri> IS ASSIGNED.
|
|
100267
|
+
WRITE <attri>.
|
|
100268
|
+
ENDIF.`,
|
|
100269
|
+
};
|
|
100270
|
+
}
|
|
100271
|
+
getConfig() {
|
|
100272
|
+
return this.conf;
|
|
100273
|
+
}
|
|
100274
|
+
setConfig(conf) {
|
|
100275
|
+
this.conf = conf;
|
|
100276
|
+
}
|
|
100277
|
+
runParsed(file) {
|
|
100278
|
+
var _a, _b;
|
|
100279
|
+
const issues = [];
|
|
100280
|
+
const statements = file.getStatements();
|
|
100281
|
+
for (let i = 0; i < statements.length; i++) {
|
|
100282
|
+
const statement = statements[i];
|
|
100283
|
+
if (!(statement.get() instanceof Statements.Assign)
|
|
100284
|
+
|| ((_a = statement.findDirectExpression(Expressions.AssignSource)) === null || _a === void 0 ? void 0 : _a.getFirstToken().getStr().toUpperCase()) === "COMPONENT") {
|
|
100285
|
+
continue;
|
|
100286
|
+
}
|
|
100287
|
+
const target = statement.findDirectExpression(Expressions.FSTarget);
|
|
100288
|
+
const fs = (_b = target === null || target === void 0 ? void 0 : target.findFirstExpression(Expressions.FieldSymbol)) === null || _b === void 0 ? void 0 : _b.concatTokens();
|
|
100289
|
+
if (target === undefined || fs === undefined) {
|
|
100290
|
+
continue;
|
|
100291
|
+
}
|
|
100292
|
+
const check = this.nextCheck(i, statements, fs.toUpperCase());
|
|
100293
|
+
if (check === undefined) {
|
|
100294
|
+
continue;
|
|
100295
|
+
}
|
|
100296
|
+
let message = `sy-subrc checked after ASSIGN, use ${fs} IS [NOT] ASSIGNED`;
|
|
100297
|
+
let fix = undefined;
|
|
100298
|
+
if (this.insideLoop(i, statements) === true) {
|
|
100299
|
+
message += ` with UNASSIGN ${fs} before the ASSIGN, it is inside a loop`;
|
|
100300
|
+
}
|
|
100301
|
+
else if (this.boundEarlier(i, statements, fs.toUpperCase()) === true) {
|
|
100302
|
+
message += ` with UNASSIGN ${fs} before the ASSIGN, ${fs} is bound earlier`;
|
|
100303
|
+
}
|
|
100304
|
+
else if (target.findDirectExpression(Expressions.InlineFS) === undefined
|
|
100305
|
+
&& this.declaredInBlock(i, statements, fs.toUpperCase()) === false) {
|
|
100306
|
+
message += ` with UNASSIGN ${fs} before the ASSIGN, ${fs} is not declared in this method`;
|
|
100307
|
+
}
|
|
100308
|
+
else {
|
|
100309
|
+
fix = this.buildFix(file, check, fs);
|
|
100310
|
+
}
|
|
100311
|
+
issues.push(issue_1.Issue.atStatement(file, check, message, this.getMetadata().key, this.conf.severity, fix));
|
|
100312
|
+
}
|
|
100313
|
+
return issues;
|
|
100314
|
+
}
|
|
100315
|
+
////////////////
|
|
100316
|
+
/** the next statement, skipping comments and ENDIF like check_subrc does, if it reads sy-subrc */
|
|
100317
|
+
nextCheck(index, statements, fs) {
|
|
100318
|
+
for (let i = index + 1; i < statements.length; i++) {
|
|
100319
|
+
const statement = statements[i];
|
|
100320
|
+
if (statement.get() instanceof _statement_1.Comment
|
|
100321
|
+
|| statement.get() instanceof Statements.EndIf
|
|
100322
|
+
|| statement.get() instanceof Statements.EndTestSeam) {
|
|
100323
|
+
continue;
|
|
100324
|
+
}
|
|
100325
|
+
const concat = statement.concatTokens().toUpperCase();
|
|
100326
|
+
if (concat.includes(fs + " IS ASSIGNED") || concat.includes(fs + " IS NOT ASSIGNED")) {
|
|
100327
|
+
return undefined;
|
|
100328
|
+
}
|
|
100329
|
+
return concat.includes("SY-SUBRC") ? statement : undefined;
|
|
100330
|
+
}
|
|
100331
|
+
return undefined;
|
|
100332
|
+
}
|
|
100333
|
+
insideLoop(index, statements) {
|
|
100334
|
+
let depth = 0;
|
|
100335
|
+
for (let i = index - 1; i >= 0 && this.startsBlock(statements[i]) === false; i--) {
|
|
100336
|
+
const s = statements[i].get();
|
|
100337
|
+
if (s instanceof Statements.EndLoop || s instanceof Statements.EndDo || s instanceof Statements.EndWhile) {
|
|
100338
|
+
depth++;
|
|
100339
|
+
}
|
|
100340
|
+
else if (s instanceof Statements.Loop || s instanceof Statements.Do || s instanceof Statements.While) {
|
|
100341
|
+
if (depth === 0) {
|
|
100342
|
+
return true;
|
|
100343
|
+
}
|
|
100344
|
+
depth--;
|
|
100345
|
+
}
|
|
100346
|
+
}
|
|
100347
|
+
return false;
|
|
100348
|
+
}
|
|
100349
|
+
/** any earlier statement in the block with the field symbol as target, eg. ASSIGN, LOOP or READ TABLE ASSIGNING */
|
|
100350
|
+
boundEarlier(index, statements, fs) {
|
|
100351
|
+
var _a;
|
|
100352
|
+
for (let i = index - 1; i >= 0 && this.startsBlock(statements[i]) === false; i--) {
|
|
100353
|
+
for (const target of statements[i].findAllExpressions(Expressions.FSTarget)) {
|
|
100354
|
+
if (((_a = target.findFirstExpression(Expressions.FieldSymbol)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === fs) {
|
|
100355
|
+
return true;
|
|
100356
|
+
}
|
|
100357
|
+
}
|
|
100358
|
+
}
|
|
100359
|
+
return false;
|
|
100360
|
+
}
|
|
100361
|
+
declaredInBlock(index, statements, fs) {
|
|
100362
|
+
var _a;
|
|
100363
|
+
for (let i = index - 1; i >= 0 && this.startsBlock(statements[i]) === false; i--) {
|
|
100364
|
+
if (statements[i].get() instanceof Statements.FieldSymbol
|
|
100365
|
+
&& ((_a = statements[i].findDirectExpression(Expressions.FieldSymbol)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === fs) {
|
|
100366
|
+
return true;
|
|
100367
|
+
}
|
|
100368
|
+
}
|
|
100369
|
+
return false;
|
|
100370
|
+
}
|
|
100371
|
+
startsBlock(statement) {
|
|
100372
|
+
const s = statement.get();
|
|
100373
|
+
return s instanceof Statements.MethodImplementation
|
|
100374
|
+
|| s instanceof Statements.Form
|
|
100375
|
+
|| s instanceof Statements.FunctionModule
|
|
100376
|
+
|| s instanceof Statements.Module
|
|
100377
|
+
|| s instanceof Statements.EndMethod
|
|
100378
|
+
|| s instanceof Statements.EndForm
|
|
100379
|
+
|| s instanceof Statements.EndFunction
|
|
100380
|
+
|| s instanceof Statements.EndModule;
|
|
100381
|
+
}
|
|
100382
|
+
/** replaces "sy-subrc = 0" or "sy-subrc <> 0" in place, also inside a longer condition */
|
|
100383
|
+
buildFix(file, statement, fs) {
|
|
100384
|
+
const tokens = statement.getTokens();
|
|
100385
|
+
for (let i = 0; i + 4 < tokens.length; i++) {
|
|
100386
|
+
if (tokens[i].getStr().toUpperCase() !== "SY"
|
|
100387
|
+
|| tokens[i + 1].getStr() !== "-"
|
|
100388
|
+
|| tokens[i + 2].getStr().toUpperCase() !== "SUBRC") {
|
|
100389
|
+
continue;
|
|
100390
|
+
}
|
|
100391
|
+
if (tokens[i + 4].getStr() !== "0") {
|
|
100392
|
+
return undefined;
|
|
100393
|
+
}
|
|
100394
|
+
const op = tokens[i + 3].getStr().toUpperCase();
|
|
100395
|
+
if (op === "=" || op === "EQ") {
|
|
100396
|
+
return edit_helper_1.EditHelper.replaceRange(file, tokens[i].getStart(), tokens[i + 4].getEnd(), `${fs} IS ASSIGNED`);
|
|
100397
|
+
}
|
|
100398
|
+
else if (op === "<>" || op === "NE") {
|
|
100399
|
+
return edit_helper_1.EditHelper.replaceRange(file, tokens[i].getStart(), tokens[i + 4].getEnd(), `${fs} IS NOT ASSIGNED`);
|
|
100400
|
+
}
|
|
100401
|
+
return undefined;
|
|
100402
|
+
}
|
|
100403
|
+
return undefined;
|
|
100404
|
+
}
|
|
100405
|
+
}
|
|
100406
|
+
exports.SubrcAfterAssign = SubrcAfterAssign;
|
|
100407
|
+
//# sourceMappingURL=subrc_after_assign.js.map
|
|
100408
|
+
|
|
100409
|
+
/***/ },
|
|
100410
|
+
|
|
97969
100411
|
/***/ "../core/build/src/rules/superclass_final.js"
|
|
97970
100412
|
/*!***************************************************!*\
|
|
97971
100413
|
!*** ../core/build/src/rules/superclass_final.js ***!
|
|
@@ -98883,6 +101325,7 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
|
|
|
98883
101325
|
constructor() {
|
|
98884
101326
|
super(...arguments);
|
|
98885
101327
|
this.conf = new TypesNamingConf();
|
|
101328
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
98886
101329
|
}
|
|
98887
101330
|
getMetadata() {
|
|
98888
101331
|
return {
|
|
@@ -98900,10 +101343,10 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
|
|
|
98900
101343
|
}
|
|
98901
101344
|
setConfig(conf) {
|
|
98902
101345
|
this.conf = conf;
|
|
101346
|
+
this.regex = new RegExp(this.conf.pattern, "i");
|
|
98903
101347
|
}
|
|
98904
101348
|
runParsed(file, obj) {
|
|
98905
101349
|
const issues = [];
|
|
98906
|
-
const testRegex = new RegExp(this.conf.pattern, "i");
|
|
98907
101350
|
let nesting = 0;
|
|
98908
101351
|
if (obj instanceof objects_1.TypePool) {
|
|
98909
101352
|
return [];
|
|
@@ -98932,7 +101375,7 @@ class TypesNaming extends _abap_rule_1.ABAPRule {
|
|
|
98932
101375
|
continue;
|
|
98933
101376
|
}
|
|
98934
101377
|
const token = expr.getFirstToken();
|
|
98935
|
-
if (
|
|
101378
|
+
if (this.regex.exec(token.getStr())) {
|
|
98936
101379
|
continue;
|
|
98937
101380
|
}
|
|
98938
101381
|
else {
|
|
@@ -102251,6 +104694,8 @@ const _abap_rule_1 = __webpack_require__(/*! ./_abap_rule */ "../core/build/src/
|
|
|
102251
104694
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
102252
104695
|
const _irule_1 = __webpack_require__(/*! ./_irule */ "../core/build/src/rules/_irule.js");
|
|
102253
104696
|
const _statement_1 = __webpack_require__(/*! ../abap/2_statements/statements/_statement */ "../core/build/src/abap/2_statements/statements/_statement.js");
|
|
104697
|
+
const edit_helper_1 = __webpack_require__(/*! ../edit_helper */ "../core/build/src/edit_helper.js");
|
|
104698
|
+
const position_1 = __webpack_require__(/*! ../position */ "../core/build/src/position.js");
|
|
102254
104699
|
class WrongAbapdocPositionConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
102255
104700
|
}
|
|
102256
104701
|
exports.WrongAbapdocPositionConf = WrongAbapdocPositionConf;
|
|
@@ -102270,10 +104715,13 @@ elsewhere is silently ignored, leaving the declaration undocumented.
|
|
|
102270
104715
|
The following positions are reported,
|
|
102271
104716
|
* in front of a chained keyword, ie. before "CONSTANTS:" instead of after the colon,
|
|
102272
104717
|
* in the middle of a statement, ie. between the parameters of a METHODS definition,
|
|
102273
|
-
* directly in front of ENDCLASS, ENDINTERFACE or a SECTION statement
|
|
104718
|
+
* directly in front of ENDCLASS, ENDINTERFACE or a SECTION statement,
|
|
104719
|
+
* separated from its declaration by a blank line or a normal comment, the system reads both as the end of the block.
|
|
102274
104720
|
|
|
102275
|
-
Only checks ABAP Doc inside class definitions and interfaces
|
|
102276
|
-
|
|
104721
|
+
Only checks ABAP Doc inside class definitions and interfaces, and directly in front of them.
|
|
104722
|
+
|
|
104723
|
+
The quick fix for a blank line deletes the blank lines.`,
|
|
104724
|
+
tags: [_irule_1.RuleTag.SingleFile, _irule_1.RuleTag.Quickfix],
|
|
102277
104725
|
badExample: `CLASS zcl_foo DEFINITION PUBLIC.
|
|
102278
104726
|
PUBLIC SECTION.
|
|
102279
104727
|
"! Navigation modes
|
|
@@ -102299,6 +104747,7 @@ ENDCLASS.`,
|
|
|
102299
104747
|
this.conf = conf;
|
|
102300
104748
|
}
|
|
102301
104749
|
runParsed(file) {
|
|
104750
|
+
var _a;
|
|
102302
104751
|
const issues = [];
|
|
102303
104752
|
const statements = file.getStatements();
|
|
102304
104753
|
let definition = false;
|
|
@@ -102313,7 +104762,7 @@ ENDCLASS.`,
|
|
|
102313
104762
|
definition = false;
|
|
102314
104763
|
continue;
|
|
102315
104764
|
}
|
|
102316
|
-
else if (
|
|
104765
|
+
else if (this.isAbapdoc(statement) === false) {
|
|
102317
104766
|
continue;
|
|
102318
104767
|
}
|
|
102319
104768
|
else if (this.isAbapdoc(statements[i - 1]) === true
|
|
@@ -102321,19 +104770,57 @@ ENDCLASS.`,
|
|
|
102321
104770
|
continue; // only report the first row of each block
|
|
102322
104771
|
}
|
|
102323
104772
|
let next = undefined;
|
|
102324
|
-
|
|
102325
|
-
|
|
102326
|
-
|
|
104773
|
+
let j = i + 1;
|
|
104774
|
+
for (; j < statements.length; j++) {
|
|
104775
|
+
if (!(statements[j].get() instanceof _statement_1.Comment)) {
|
|
104776
|
+
next = statements[j];
|
|
104777
|
+
break;
|
|
102327
104778
|
}
|
|
102328
|
-
next = statements[j];
|
|
102329
|
-
break;
|
|
102330
104779
|
}
|
|
102331
104780
|
if (next === undefined) {
|
|
102332
104781
|
continue;
|
|
102333
104782
|
}
|
|
102334
|
-
|
|
104783
|
+
else if (definition === false
|
|
104784
|
+
&& !(next.get() instanceof Statements.ClassDefinition)
|
|
104785
|
+
&& !(next.get() instanceof Statements.Interface)) {
|
|
104786
|
+
continue;
|
|
104787
|
+
}
|
|
104788
|
+
// comments inside "next" are listed in front of it, only look at the rows above it
|
|
104789
|
+
const nextRow = this.startRow(next);
|
|
104790
|
+
const trailing = ((_a = statements[i - 1]) === null || _a === void 0 ? void 0 : _a.getEnd().getRow()) === statement.getStart().getRow();
|
|
104791
|
+
let last = statement;
|
|
104792
|
+
let separator = undefined;
|
|
104793
|
+
let fix = undefined;
|
|
104794
|
+
for (const s of trailing ? [] : statements.slice(i + 1, j)) {
|
|
104795
|
+
if (s.getStart().getRow() >= nextRow) {
|
|
104796
|
+
break;
|
|
104797
|
+
}
|
|
104798
|
+
else if (s.getStart().getRow() > last.getEnd().getRow() + 1) {
|
|
104799
|
+
separator = "a blank line";
|
|
104800
|
+
if (this.isAbapdoc(s) === true) {
|
|
104801
|
+
fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(last.getEnd().getRow() + 1, 1), new position_1.Position(s.getStart().getRow(), 1));
|
|
104802
|
+
}
|
|
104803
|
+
break;
|
|
104804
|
+
}
|
|
104805
|
+
else if (this.isAbapdoc(s) === false) {
|
|
104806
|
+
separator = "a comment";
|
|
104807
|
+
break;
|
|
104808
|
+
}
|
|
104809
|
+
last = s;
|
|
104810
|
+
}
|
|
104811
|
+
if (separator === undefined && trailing === false && nextRow > last.getEnd().getRow() + 1) {
|
|
104812
|
+
separator = "a blank line";
|
|
104813
|
+
fix = edit_helper_1.EditHelper.deleteRange(file, new position_1.Position(last.getEnd().getRow() + 1, 1), new position_1.Position(nextRow, 1));
|
|
104814
|
+
}
|
|
104815
|
+
let message = this.check(statement, next);
|
|
102335
104816
|
if (message !== undefined) {
|
|
102336
|
-
|
|
104817
|
+
fix = undefined;
|
|
104818
|
+
}
|
|
104819
|
+
else if (separator !== undefined) {
|
|
104820
|
+
message = "ABAP Doc is separated from its declaration by " + separator;
|
|
104821
|
+
}
|
|
104822
|
+
if (message !== undefined) {
|
|
104823
|
+
issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity, fix));
|
|
102337
104824
|
}
|
|
102338
104825
|
}
|
|
102339
104826
|
return issues;
|
|
@@ -102342,6 +104829,9 @@ ENDCLASS.`,
|
|
|
102342
104829
|
return (statement === null || statement === void 0 ? void 0 : statement.get()) instanceof _statement_1.Comment
|
|
102343
104830
|
&& statement.getFirstToken().getStr().startsWith(`"!`);
|
|
102344
104831
|
}
|
|
104832
|
+
startRow(statement) {
|
|
104833
|
+
return Math.min(statement.getStart().getRow(), ...statement.getPragmas().map(p => p.getRow()));
|
|
104834
|
+
}
|
|
102345
104835
|
check(abapdoc, next) {
|
|
102346
104836
|
const type = next.get();
|
|
102347
104837
|
if (type instanceof Statements.EndClass
|
|
@@ -102482,6 +104972,10 @@ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "../co
|
|
|
102482
104972
|
const _basic_rule_config_1 = __webpack_require__(/*! ./_basic_rule_config */ "../core/build/src/rules/_basic_rule_config.js");
|
|
102483
104973
|
const fast_xml_parser_1 = __webpack_require__(/*! fast-xml-parser */ "../core/node_modules/fast-xml-parser/lib/fxp.cjs");
|
|
102484
104974
|
const severity_1 = __webpack_require__(/*! ../severity */ "../core/build/src/severity.js");
|
|
104975
|
+
const ABAPGIT_ATTRIBUTES = [
|
|
104976
|
+
["version", /<abapGit\b[^>]*\bversion="([^"]+)"/],
|
|
104977
|
+
["serializer_version", /<abapGit\b[^>]*\bserializer_version="([^"]+)"/],
|
|
104978
|
+
];
|
|
102485
104979
|
class XMLConsistencyConf extends _basic_rule_config_1.BasicRuleConfig {
|
|
102486
104980
|
constructor() {
|
|
102487
104981
|
super(...arguments);
|
|
@@ -102537,8 +105031,8 @@ class XMLConsistency {
|
|
|
102537
105031
|
issues.push(issue_1.Issue.atRow(file, 1, "XML parser error: " + res.err.msg, this.getMetadata().key, this.conf.severity));
|
|
102538
105032
|
}
|
|
102539
105033
|
else {
|
|
102540
|
-
for (const attribute of
|
|
102541
|
-
const value = (_a = xml.match(
|
|
105034
|
+
for (const [attribute, regex] of ABAPGIT_ATTRIBUTES) {
|
|
105035
|
+
const value = (_a = xml.match(regex)) === null || _a === void 0 ? void 0 : _a[1];
|
|
102542
105036
|
if (value !== undefined && value.match(/^v\d\.\d\.\d$/) === null) {
|
|
102543
105037
|
issues.push(issue_1.Issue.atRow(file, 1, `Unexpected abapGit ${attribute} "${value}"`, this.getMetadata().key, this.conf.severity));
|
|
102544
105038
|
}
|
|
@@ -103873,12 +106367,16 @@ exports.MethodLengthStats = MethodLengthStats;
|
|
|
103873
106367
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
103874
106368
|
exports.NameValidator = void 0;
|
|
103875
106369
|
class NameValidator {
|
|
103876
|
-
|
|
106370
|
+
/** compile the configured ignorePatterns, case insensitive */
|
|
106371
|
+
static compileIgnorePatterns(params) {
|
|
106372
|
+
return (params.ignorePatterns || []).map(ignored => new RegExp(ignored, "i"));
|
|
106373
|
+
}
|
|
106374
|
+
static violatesRule(name, pattern, params, ignorePatterns) {
|
|
103877
106375
|
if (params.ignoreNames && params.ignoreNames.indexOf(name.toUpperCase()) >= 0) {
|
|
103878
106376
|
return false;
|
|
103879
106377
|
}
|
|
103880
|
-
for (const ignored of
|
|
103881
|
-
if (
|
|
106378
|
+
for (const ignored of ignorePatterns) {
|
|
106379
|
+
if (ignored.test(name)) {
|
|
103882
106380
|
return false;
|
|
103883
106381
|
}
|
|
103884
106382
|
}
|