Identify the call chain of specified interfaces to facilitate interface management, with a maximum chain length of 5000.
// code-linter.json5
{
"rules": {
"@security/specified-interface-call-chain-check": [
"suggestion",
{
"outputDirPath": "", // Absolute path of the output result file, specified-interface-call-chain-check_result.txt. If the directory does not exist, it will be created.
"callChainMaxLen": 0, // Maximum length of the call chain. The default value is 0, indicating that the length is not limited.
},
{
"selector": "", // Enum: namespace/class/function/property/type (function includes functions and class methods, and class includes class, interface, enum, and struct).
"filePath": "", // Absolute path of the target file.
"namespace": [], // An array of namespace names, indicating definitions within the namespace or checks on the namespace itself. For nested namespaces, list them in order.
"class": "", // Class name, indicating definitions within the class or checks on the class itself.
"function": "", // Function name.
"property": "", // Class property name.
"type": "", // Type alias.
},
{
"selector": "", // Enum: namespace/class/function/property/type (function includes function methods).
"filePath": "", // Absolute path of the target file.
"namespace": [], // An array of namespace names, indicating definitions within the namespace or checks on the namespace itself. For nested namespaces, list them in order.
"class": "", // Class name, indicating definitions within the class or checks on the class itself.
"function": "", // Function name.
"property": "", // Class property name.
"type": "", // Type alias.
},
],
}
} In the following example, Absolute-Path1.ets is the dependency code.
// Absolute-Path1.ets
export class Cls1 {
public func1() {
console.log('This is func1 in cls1.');
}
public func2() {
console.log('This is func2 in cls1.');
}
} In the following example, Correct.ets contains examples of correct code and depends on Absolute-Path1.ets.
// Correct.ets
import { Cls1 } from './Absolute-Path1';
let testClass = new Cls1();
testClass.func2(); In the following example, absolute-path-1.ets is the dependency code.
// absolute-path-1.ets
export class cls1 {
public func1() {
console.log('This is func1 in cls1.');
}
public func2() {
console.log('This is func2 in cls1.');
}
} In the following example, incorrect.ets contains examples of incorrect code and depends on absolute-path-1.ets.
// incorrect.ets
import { cls1 } from './absolute-path-1';
let testClass = new cls1();
testClass.func1(); plugin:@security/all
For details about how to configure Code Linter check rules, see Code Linter.