mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 06:03:30 +00:00
fix diff and check
Signed-off-by: wangcaoyu <wangcaoyu@huawei.com>
This commit is contained in:
parent
f5d959c5f3
commit
56a5c5c4c3
@ -1,5 +1,5 @@
|
||||
{
|
||||
"data": [
|
||||
"kitData": [
|
||||
{ "filePath": "@internal/component/ets/ability_component.d.ts", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" },
|
||||
{ "filePath": "@internal/component/ets/action_sheet.d.ts", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" },
|
||||
{ "filePath": "@internal/component/ets/alert_dialog.d.ts", "kitName": "ArkUI", "subSystem": "ArkUI开发框架" },
|
||||
|
@ -52,6 +52,10 @@ export enum toolNameType {
|
||||
* 检查工具 线上版
|
||||
*/
|
||||
CHECKONLINE = 'checkOnline',
|
||||
/**
|
||||
* 兼容性变更检查工具 线上版
|
||||
*/
|
||||
APICHANGECHECK = 'apiChangeCheck',
|
||||
/**
|
||||
* diff工具
|
||||
*/
|
||||
@ -122,6 +126,10 @@ export const Plugin: PluginType = {
|
||||
isRequiredOption: false,
|
||||
options: ['--checker <string>', 'check api rule, split with comma', 'all'],
|
||||
},
|
||||
{
|
||||
isRequiredOption: false,
|
||||
options: ['--prId <string>', 'check api prId', ''],
|
||||
},
|
||||
{
|
||||
isRequiredOption: false,
|
||||
options: ['--excel <string>', 'check api excel', 'false'],
|
||||
@ -175,6 +183,7 @@ export const Plugin: PluginType = {
|
||||
isOH: argv.isOH,
|
||||
path: argv.path,
|
||||
checker: argv.checker,
|
||||
prId: argv.prId,
|
||||
old: argv.old,
|
||||
new: argv.new,
|
||||
oldVersion: argv.oldVersion,
|
||||
@ -323,7 +332,7 @@ function collectApiCallback(apiData: ApiStatisticsInfo[], sheet: ExcelJS.Workshe
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 收集api工具调用方法
|
||||
* api检查工具调用方法
|
||||
*
|
||||
* @param { OptionObjType } options
|
||||
* @return { ToolNameValueType }
|
||||
@ -335,7 +344,7 @@ function checkApi(): ToolNameValueType {
|
||||
if (fs.existsSync(filePathTxt)) {
|
||||
mdApiFiles = CommonFunctions.getMdFiles(filePathTxt);
|
||||
}
|
||||
LocalEntry.checkEntryLocal(mdApiFiles, ['all'], './result.json', 'true');
|
||||
LocalEntry.checkEntryLocal(mdApiFiles, ['all'], './result.json', '', 'true');
|
||||
return {
|
||||
data: [],
|
||||
};
|
||||
@ -348,7 +357,7 @@ function checkApi(): ToolNameValueType {
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 收集api工具调用方法
|
||||
* api检查工具调用方法
|
||||
*
|
||||
* @param { OptionObjType } options
|
||||
* @return { ToolNameValueType }
|
||||
@ -356,7 +365,8 @@ function checkApi(): ToolNameValueType {
|
||||
function checkOnline(options: OptionObjType): ToolNameValueType {
|
||||
options.format = formatType.NULL;
|
||||
try {
|
||||
LocalEntry.checkEntryLocal(options.path.split(','), options.checker.split(','), options.output, options.excel);
|
||||
LocalEntry.checkEntryLocal(options.path.split(','), options.checker.split(','), options.output, options.prId,
|
||||
options.excel);
|
||||
return {
|
||||
data: [],
|
||||
};
|
||||
@ -370,6 +380,29 @@ function checkOnline(options: OptionObjType): ToolNameValueType {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* api检查工具调用方法
|
||||
*
|
||||
* @param { OptionObjType } options
|
||||
* @return { ToolNameValueType }
|
||||
*/
|
||||
function apiChangeCheck(options: OptionObjType): ToolNameValueType {
|
||||
options.format = formatType.NULL;
|
||||
try {
|
||||
LocalEntry.apiChangeCheckEntryLocal(options.prId, options.checker.split(','), options.output, options.excel);
|
||||
return {
|
||||
data: [],
|
||||
};
|
||||
} catch (exception) {
|
||||
const error = exception as Error;
|
||||
LogUtil.e('error api change check', error.stack ? error.stack : error.message);
|
||||
} finally {
|
||||
}
|
||||
return {
|
||||
data: [],
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* diffApi工具调用方法
|
||||
*
|
||||
@ -573,6 +606,7 @@ export const toolNameMethod: Map<string, ToolNameMethodType> = new Map([
|
||||
[toolNameType.COLLECT, collectApi],
|
||||
[toolNameType.CHECK, checkApi],
|
||||
[toolNameType.CHECKONLINE, checkOnline],
|
||||
[toolNameType.APICHANGECHECK, apiChangeCheck],
|
||||
[toolNameType.DIFF, diffApi],
|
||||
[toolNameType.LABELDETECTION, detectionApi],
|
||||
[toolNameType.COUNT, countApi]
|
||||
@ -583,12 +617,13 @@ export const toolNameMethod: Map<string, ToolNameMethodType> = new Map([
|
||||
*/
|
||||
export type OptionObjType = {
|
||||
toolName: toolNameType;
|
||||
path: string;
|
||||
checker: string;
|
||||
prId: string;
|
||||
collectPath: string;
|
||||
collectFile: string;
|
||||
checkLabels: string;
|
||||
isOH: string;
|
||||
path: string;
|
||||
checker: string;
|
||||
old: string;
|
||||
new: string;
|
||||
oldVersion: string;
|
||||
|
@ -147,21 +147,41 @@
|
||||
"API_DEFINE_ANONYMOUS_FUNCTION_01": "Anonymous functions or anonymous object that are not allowed are used in this api."
|
||||
},
|
||||
"CHANEGE": {
|
||||
"API_CHANGE_INCOMPATIBLE_01": "Forbid changes: API level change to system.",
|
||||
"API_CHANGE_INCOMPATIBLE_02": "Forbid changes: API mode change.",
|
||||
"API_CHANGE_INCOMPATIBLE_03": "Forbid changes: API card delete.",
|
||||
"API_CHANGE_INCOMPATIBLE_04": "Forbid changes: API crossplatform delete.",
|
||||
"API_CHANGE_INCOMPATIBLE_05": "Forbid changes: API errorcode cannot be created or modified.",
|
||||
"API_CHANGE_INCOMPATIBLE_06": "Forbid changes: API cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_07": "Forbid changes: Function return type cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_08": "Forbid changes: Property cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_09": "Forbid changes: Constant value cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_10": "Forbid changes: Type alias cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_11": "Forbid changes: Enum number value cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_12": "Forbid changes: API cannot be deleted.",
|
||||
"API_CHANGE_INCOMPATIBLE_13": "Forbid changes: Historical JSDoc cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_14": "Forbid changes: API changes must add a new section of JSDoc.",
|
||||
"API_CHANGE_INCOMPATIBLE_15": "Forbid changes: Parameters cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_16": "Forbid changes: Permission tag cannot be created or modified."
|
||||
"API_CHANGE_INCOMPATIBLE_01": "Forbid changes: Cannot change from public API to system API.",
|
||||
"API_CHANGE_INCOMPATIBLE_02": "Forbid changes: Cannot reduce or permission or increase and permission.",
|
||||
"API_CHANGE_INCOMPATIBLE_03": "Forbid changes: Cannot change permission value,cannot judge the range change.",
|
||||
"API_CHANGE_INCOMPATIBLE_04": "Forbid changes: The number of error codes cannot be increased from 1 to multiple error codes.",
|
||||
"API_CHANGE_INCOMPATIBLE_05": "Forbid changes: Cannot change the error code value.",
|
||||
"API_CHANGE_INCOMPATIBLE_06": "Forbid changes: The card application cannot be changed from supported to not supported.",
|
||||
"API_CHANGE_INCOMPATIBLE_07": "Forbid changes: Crossplatform cannot be changed from supported to not supported.",
|
||||
"API_CHANGE_INCOMPATIBLE_08": "Forbid changes: API cannot be deleted.",
|
||||
"API_CHANGE_INCOMPATIBLE_09": "Forbid changes: Cannot change from FAModelOnly to StageModelOnly.",
|
||||
"API_CHANGE_INCOMPATIBLE_10": "Forbid changes: Cannot change from StageModelOnly to FAModelOnly.",
|
||||
"API_CHANGE_INCOMPATIBLE_11": "Forbid changes: Cannot change from nothing to StageModelOnly.",
|
||||
"API_CHANGE_INCOMPATIBLE_12": "Forbid changes: Cannot change from nothing to FAModelOnly.",
|
||||
"API_CHANGE_INCOMPATIBLE_13": "Forbid changes: The function return value type cannot be extended.",
|
||||
"API_CHANGE_INCOMPATIBLE_14": "Forbid changes: The function return value type cannot be reduced.",
|
||||
"API_CHANGE_INCOMPATIBLE_15": "Forbid changes: Cannot change function return value type.",
|
||||
"API_CHANGE_INCOMPATIBLE_16": "Forbid changes: Cannot change function param position.",
|
||||
"API_CHANGE_INCOMPATIBLE_17": "Forbid changes: Cannot add function required param.",
|
||||
"API_CHANGE_INCOMPATIBLE_18": "Forbid changes: Cannot delete function param.",
|
||||
"API_CHANGE_INCOMPATIBLE_19": "Forbid changes: Cannot change form unrequired param to required param.",
|
||||
"API_CHANGE_INCOMPATIBLE_20": "Forbid changes: Cannot change function param type.",
|
||||
"API_CHANGE_INCOMPATIBLE_21": "Forbid changes: The function param type range is cannot be reduced.",
|
||||
"API_CHANGE_INCOMPATIBLE_22": "Forbid changes: Read-only properties cannot be changed from optional to required.",
|
||||
"API_CHANGE_INCOMPATIBLE_23": "Forbid changes: Writable properties cannot be changed from required to optional.",
|
||||
"API_CHANGE_INCOMPATIBLE_24": "Forbid changes: Writable properties cannot be changed from optional to required.",
|
||||
"API_CHANGE_INCOMPATIBLE_25": "Forbid changes: Cannot change property type.",
|
||||
"API_CHANGE_INCOMPATIBLE_26": "Forbid changes: Cannot Expand the range of readonly property types.",
|
||||
"API_CHANGE_INCOMPATIBLE_27": "Forbid changes: Cannot Expand the range of writable property types.",
|
||||
"API_CHANGE_INCOMPATIBLE_28": "Forbid changes: Cannot reduce the range of writable property types.",
|
||||
"API_CHANGE_INCOMPATIBLE_29": "Forbid changes: Decorator cannot be deleted.",
|
||||
"API_CHANGE_INCOMPATIBLE_30": "Forbid changes: Cannot change constant value.",
|
||||
"API_CHANGE_INCOMPATIBLE_31": "Forbid changes: Cannot change custom type value.",
|
||||
"API_CHANGE_INCOMPATIBLE_32": "Forbid changes: Cannot expand the range of custom type.",
|
||||
"API_CHANGE_INCOMPATIBLE_33": "Forbid changes: Cannot reduce the range of custom type.",
|
||||
"API_CHANGE_INCOMPATIBLE_34": "Forbid changes: Cannot change Enumeration assignment.",
|
||||
"API_CHANGE_INCOMPATIBLE_35": "Forbid changes: Historical JSDoc cannot be changed.",
|
||||
"API_CHANGE_INCOMPATIBLE_36": "Forbid changes: API changes must add a new section of JSDoc."
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -22,8 +22,8 @@
|
||||
"SystemCapability.Graphic.Graphic2D.WebGL",
|
||||
"SystemCapability.Graphic.Graphic2D.WebGL2",
|
||||
"SystemCapability.Graphic.Graphic2D.ColorManager.Core",
|
||||
"SystemCapability.Graphic.Vulkan",
|
||||
"SystemCapability.Window.SessionManager",
|
||||
"SystemCapability.Graphic.Vulkan",
|
||||
"SystemCapability.WindowManager.WindowManager.Core",
|
||||
"SystemCapability.Notification.CommonEvent",
|
||||
"SystemCapability.Notification.Notification",
|
||||
@ -81,6 +81,7 @@
|
||||
"SystemCapability.Multimedia.Media.VideoPlayer",
|
||||
"SystemCapability.Multimedia.Media.VideoRecorder",
|
||||
"SystemCapability.Multimedia.Media.CodecBase",
|
||||
"SystemCapability.Multimedia.Media.AudioCodec",
|
||||
"SystemCapability.Multimedia.Media.AudioDecoder",
|
||||
"SystemCapability.Multimedia.Media.AudioEncoder",
|
||||
"SystemCapability.Multimedia.Media.VideoDecoder",
|
||||
@ -92,6 +93,7 @@
|
||||
"SystemCapability.Multimedia.AVSession.Core",
|
||||
"SystemCapability.Multimedia.AVSession.Manager",
|
||||
"SystemCapability.Multimedia.AVSession.AVCast",
|
||||
"SystemCapability.Multimedia.AVSession.ExtendedDisplayCast",
|
||||
"SystemCapability.Multimedia.Audio.Core",
|
||||
"SystemCapability.Multimedia.Audio.Tone",
|
||||
"SystemCapability.Multimedia.Audio.Interrupt",
|
||||
@ -107,11 +109,14 @@
|
||||
"SystemCapability.Multimedia.Image.ImageSource",
|
||||
"SystemCapability.Multimedia.Image.ImagePacker",
|
||||
"SystemCapability.Multimedia.Image.ImageReceiver",
|
||||
"SystemCapability.Multimedia.ImageEffect.Core",
|
||||
"SystemCapability.Multimedia.MediaLibrary.Core",
|
||||
"SystemCapability.Multimedia.MediaLibrary.SmartAlbum",
|
||||
"SystemCapability.Multimedia.MediaLibrary.DistributedCore",
|
||||
"SystemCapability.Multimedia.Media.AVPlayer",
|
||||
"SystemCapability.Multimedia.Media.AVRecorder",
|
||||
"SystemCapability.Multimedia.Media.AVMetadataExtractor",
|
||||
"SystemCapability.Multimedia.Media.AVImageGenerator",
|
||||
"SystemCapability.Multimedia.Image.ImageCreator",
|
||||
"SystemCapability.Multimedia.SystemSound.Core",
|
||||
"SystemCapability.Telephony.CoreService",
|
||||
@ -151,11 +156,13 @@
|
||||
"SystemCapability.HiviewDFX.HiProfiler.HiDebug",
|
||||
"SystemCapability.Update.UpdateService",
|
||||
"SystemCapability.DistributedHardware.DeviceManager",
|
||||
"SystemCapability.DistributedHardware.DistributedHardwareFWK",
|
||||
"SystemCapability.Security.DeviceAuth",
|
||||
"SystemCapability.Security.DataTransitManager",
|
||||
"SystemCapability.Security.DeviceSecurityLevel",
|
||||
"SystemCapability.Security.Huks.Core",
|
||||
"SystemCapability.Security.Huks.Extension",
|
||||
"SystemCapability.Security.Asset",
|
||||
"SystemCapability.Security.AccessToken",
|
||||
"SystemCapability.Security.Cipher",
|
||||
"SystemCapability.Security.CertificateManager",
|
||||
@ -164,6 +171,7 @@
|
||||
"SystemCapability.Security.DataLossPrevention",
|
||||
"SystemCapability.Security.Cert",
|
||||
"SystemCapability.Security.SecurityGuard",
|
||||
"SystemCapability.Security.ScreenLockFileManager",
|
||||
"SystemCapability.Account.OsAccount",
|
||||
"SystemCapability.Account.AppAccount",
|
||||
"SystemCapability.UserIAM.UserAuth.Core",
|
||||
@ -230,6 +238,7 @@
|
||||
"SystemCapability.Web.Webview.Core",
|
||||
"SystemCapability.Cloud.AAID",
|
||||
"SystemCapability.Advertising.OAID",
|
||||
"SystemCapability.Advertising.Ads",
|
||||
"SystemCapability.Cloud.VAID",
|
||||
"SystemCapability.Cloud.Push",
|
||||
"SystemCapability.XTS.DeviceAttest",
|
||||
@ -253,11 +262,9 @@
|
||||
"SystemCapability.Multimedia.AudioHaptic.Core",
|
||||
"SystemCapability.ArkUi.Graphics3D",
|
||||
"SystemCapability.Multimedia.Drm.Core",
|
||||
"SystemCapability.Graphics.Drawing"
|
||||
],
|
||||
"test2": [
|
||||
1,
|
||||
2,
|
||||
3
|
||||
"SystemCapability.Graphics.Drawing",
|
||||
"SystemCapability.ResourceSchedule.SystemLoad",
|
||||
"SystemCapability.Ability.AppStartup",
|
||||
"SystemCapability.MultimodalInput.Input.InfraredEmitter"
|
||||
]
|
||||
}
|
@ -12,28 +12,30 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ApiResultSimpleInfo, ApiResultMessage } from '../../typedef/checker/result_type';
|
||||
import { ApiResultSimpleInfo, ApiResultMessage, ApiBaseInfo } from '../../typedef/checker/result_type';
|
||||
import { Check } from './src/api_check_plugin';
|
||||
import { LogUtil } from '../../utils/logUtil';
|
||||
import { GenerateFile } from '../../utils/checkUtils';
|
||||
import { compositiveResult, compositiveLocalResult, apiCheckResult } from '../../utils/checkUtils';
|
||||
import { DOC, DEFINE, CHANEGE } from './config/api_check_config.json';
|
||||
import { ApiChangeCheck } from './src/check_api_diff';
|
||||
|
||||
/**
|
||||
* local entrance
|
||||
*/
|
||||
export class LocalEntry {
|
||||
static checkEntryLocal(filePathArr: string[], fileRuleArr: string[], output: string, excel: string): ApiResultMessage[] {
|
||||
|
||||
static checkEntryLocal(filePathArr: string[], fileRuleArr: string[], output: string, prId: string, excel: string): ApiResultMessage[] {
|
||||
let allResult: ApiResultMessage[] = apiCheckResult;
|
||||
try {
|
||||
Check.scanEntry(filePathArr);
|
||||
Check.scanEntry(filePathArr, prId);
|
||||
LocalEntry.maskAlarm(compositiveResult, fileRuleArr);
|
||||
} catch (error) {
|
||||
LogUtil.e('API_CHECK_ERROR', error);
|
||||
} finally {
|
||||
GenerateFile.writeFile(apiCheckResult, output, {});
|
||||
if (excel === 'true') {
|
||||
GenerateFile.writeExcelFile(compositiveLocalResult);
|
||||
GenerateFile.writeExcelFile(apiCheckResult);
|
||||
}
|
||||
}
|
||||
return allResult;
|
||||
@ -53,9 +55,17 @@ export class LocalEntry {
|
||||
}
|
||||
});
|
||||
}
|
||||
let allResultInfoSet: Set<ApiResultSimpleInfo> = new Set(allResultInfo);
|
||||
const maskResult: ApiResultSimpleInfo[] = LocalEntry.filterAllResultInfo(allResultInfo,
|
||||
apiCheckInfos, apiCheckAdmissiveSet);
|
||||
maskResult.forEach(resultItem => {
|
||||
const apiBaseInfos: ApiBaseInfo = new ApiBaseInfo();
|
||||
apiBaseInfos
|
||||
.setApiName(resultItem.apiName)
|
||||
.setApiType(resultItem.apiType)
|
||||
.setHierarchicalRelations(resultItem.hierarchicalRelations)
|
||||
.setParentModuleName(resultItem.parentModuleName);
|
||||
|
||||
const apiChecktErrorLog: ApiResultMessage = new ApiResultMessage();
|
||||
apiChecktErrorLog
|
||||
.setFilePath(resultItem.filePath)
|
||||
@ -64,7 +74,8 @@ export class LocalEntry {
|
||||
.setType(resultItem.type)
|
||||
.setMessage(resultItem.message)
|
||||
.setMainBuggyCode(resultItem.apiText)
|
||||
.setMainBuggyLine(resultItem.location);
|
||||
.setMainBuggyLine(resultItem.location)
|
||||
.setExtendInfo(apiBaseInfos);
|
||||
apiCheckResult.push(apiChecktErrorLog);
|
||||
});
|
||||
}
|
||||
@ -75,7 +86,7 @@ export class LocalEntry {
|
||||
let resultItemInfo: string = resultItem.message.replace(/API check error of \[.*\]: /g, '');
|
||||
const regex1 = /Prohibited word in \[.*\]:{option}.The word allowed is \[.*\]\./g;
|
||||
const regex2 = /Prohibited word in \[.*\]:{ability} in the \[.*\] file\./g;
|
||||
const regex3= /please confirm whether it needs to be corrected to a common word./g;
|
||||
const regex3 = /please confirm whether it needs to be corrected to a common word./g;
|
||||
if (/\d/g.test(resultItemInfo)) {
|
||||
resultItemInfo = resultItemInfo.replace(/\d+/g, '1');
|
||||
}
|
||||
@ -109,4 +120,20 @@ export class LocalEntry {
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
static apiChangeCheckEntryLocal(prId: string, fileRuleArr: string[], output: string, excel: string): ApiResultMessage[] {
|
||||
let apiChangeCheckResult: ApiResultMessage[] = apiCheckResult;
|
||||
try {
|
||||
ApiChangeCheck.checkApiChange(prId);
|
||||
LocalEntry.maskAlarm(compositiveResult, fileRuleArr);
|
||||
} catch (error) {
|
||||
LogUtil.e('API_CHECK_ERROR', error);
|
||||
} finally {
|
||||
GenerateFile.writeFile(apiCheckResult, output, {});
|
||||
if (excel === 'true') {
|
||||
GenerateFile.writeExcelFile(apiCheckResult);
|
||||
}
|
||||
}
|
||||
return apiChangeCheckResult;
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ import {
|
||||
ErrorLevel,
|
||||
ErrorTagFormat,
|
||||
ErrorMessage,
|
||||
ApiCheckInfo,
|
||||
ErrorBaseInfo,
|
||||
} from '../../../typedef/checker/result_type';
|
||||
import { ClassInfo } from '../../../typedef/parser/ApiInfoDefination';
|
||||
import { Comment } from '../../../typedef/parser/Comment';
|
||||
@ -45,15 +47,15 @@ import { TagInheritCheck } from './tag_inherit_check';
|
||||
import { ChineseCheck } from "./check_chinese";
|
||||
import { AnonymousFunctionCheck } from './check_anonymous_function';
|
||||
export let currentFilePath: string = '';
|
||||
import {CheckErrorCode} from "./check_error_code";
|
||||
import { CheckErrorCode } from "./check_error_code";
|
||||
|
||||
export class Check {
|
||||
/**
|
||||
* checker tool main entrance
|
||||
* @param { string[] } files -File path for storing file information.
|
||||
*/
|
||||
static scanEntry(files: string[]): void {
|
||||
ApiChangeCheck.checkApiChange();
|
||||
static scanEntry(files: string[], prId: string): void {
|
||||
ApiChangeCheck.checkApiChange(prId);
|
||||
files.forEach((filePath: string, index: number) => {
|
||||
currentFilePath = filePath;
|
||||
if (filePath.indexOf('build-tools') !== -1) {
|
||||
@ -113,52 +115,41 @@ export class Check {
|
||||
return;
|
||||
}
|
||||
if (apiJsdoc === undefined) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.NO_JSDOC_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.NO_JSDOC,
|
||||
LogType.LOG_JSDOC,
|
||||
-1,
|
||||
singleApi.getApiName(),
|
||||
singleApi.getJsDocText() + singleApi.getDefinedText(),
|
||||
ErrorMessage.ERROR_NO_JSDOC,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.NO_JSDOC_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.NO_JSDOC)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(ErrorMessage.ERROR_NO_JSDOC);
|
||||
const apiInfoNojsdoc: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoNojsdoc, compositiveResult, compositiveLocalResult);
|
||||
} else {
|
||||
if (apiJsdoc.getKit().length === 0) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_SCENE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
{ line: 0, character: 0 },
|
||||
ErrorType.WRONG_SCENE,
|
||||
LogType.LOG_JSDOC,
|
||||
-1,
|
||||
singleApi.getFilePath(),
|
||||
singleApi.getFilePath(),
|
||||
CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['kit']),
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_SCENE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_SCENE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['kit']));
|
||||
const apiInfoNoKit: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoNoKit, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
if (!apiJsdoc.getIsFile()) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_SCENE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
{ line: 0, character: 0 },
|
||||
ErrorType.WRONG_SCENE,
|
||||
LogType.LOG_JSDOC,
|
||||
-1,
|
||||
singleApi.getFilePath(),
|
||||
singleApi.getFilePath(),
|
||||
CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['file']),
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const apiInfo: ApiCheckInfo = new ApiCheckInfo();
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_SCENE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_SCENE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['file']));
|
||||
const apiInfoNoFile: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoNoFile, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
// legality check
|
||||
const tagLegalityCheckResult: ErrorTagFormat[] = LegalityCheck.apiLegalityCheck(singleApi, apiJsdoc);
|
||||
@ -168,10 +159,10 @@ export class Check {
|
||||
const namingCheckResult: ErrorTagFormat = ApiNamingCheck.namingCheck(singleApi);
|
||||
// check jsdoc chinese
|
||||
const chineseCheckResult: ErrorTagFormat = ChineseCheck.checkChinese(apiJsdoc);
|
||||
// check error code
|
||||
const errorCodeResult: ErrorTagFormat = CheckErrorCode.checkErrorCode(apiJsdoc);
|
||||
// check error code
|
||||
const errorCodeResult: ErrorTagFormat = CheckErrorCode.checkErrorCode(apiJsdoc);
|
||||
// tags name check
|
||||
const tagNamseCheckResult: ErrorTagFormat = TagNameCheck.tagNameCheck(apiJsdoc);
|
||||
const tagNameCheckResult: ErrorTagFormat = TagNameCheck.tagNameCheck(apiJsdoc);
|
||||
// tags inherit check
|
||||
const tagInheritCheckResult: ErrorTagFormat[] = TagInheritCheck.tagInheritCheck(singleApi);
|
||||
// tags value check
|
||||
@ -179,192 +170,149 @@ export class Check {
|
||||
// tags repeat check
|
||||
const tagRepeatCheckResult: ErrorTagFormat[] = TagRepeatCheck.tagRepeatCheck(apiJsdoc);
|
||||
// api forbidden wors check
|
||||
const forbiddenWorsCheckResult: ErrorTagFormat = ForbiddenWordsCheck.forbiddenWordsCheck(singleApi as ClassInfo);
|
||||
const forbiddenWordsCheckResult: ErrorTagFormat = ForbiddenWordsCheck.forbiddenWordsCheck(singleApi as ClassInfo);
|
||||
|
||||
const anonymousFunction: ErrorTagFormat = AnonymousFunctionCheck.checkAnonymousFunction(singleApi);
|
||||
// console.log(anonymousFunction)
|
||||
if (!orderCheckResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_ORDER_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.WRONG_ORDER,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
orderCheckResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_ORDER_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_ORDER)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(orderCheckResult.errorInfo);
|
||||
const apiInfoOrder: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoOrder, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
if (!tagNamseCheckResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.UNKNOW_DECORATOR_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.UNKNOW_DECORATOR,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
tagNamseCheckResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
if (!tagNameCheckResult.state) {
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.UNKNOW_DECORATOR_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.UNKNOW_DECORATOR)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(tagNameCheckResult.errorInfo);
|
||||
const apiInfoName: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoName, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
if (!forbiddenWorsCheckResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.FORBIDDEN_WORDS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.FORBIDDEN_WORDS,
|
||||
LogType.LOG_API,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
forbiddenWorsCheckResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
if (!forbiddenWordsCheckResult.state) {
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.FORBIDDEN_WORDS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.FORBIDDEN_WORDS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(forbiddenWordsCheckResult.errorInfo);
|
||||
const apiInfoForbiddenWords: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoForbiddenWords, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
if (!namingCheckResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.NAMING_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.NAMING_ERRORS,
|
||||
LogType.LOG_API,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
namingCheckResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.NAMING_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.NAMING_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(namingCheckResult.errorInfo);
|
||||
const apiInfoNaming: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoNaming, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
if (!chineseCheckResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.JSDOC_HAS_CHINESE,
|
||||
ErrorLevel.MIDDLE,
|
||||
singleApi.getFilePath(),
|
||||
singleApi.getPos(),
|
||||
ErrorType.JSDOC_HAS_CHINESE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
chineseCheckResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.JSDOC_HAS_CHINESE)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.JSDOC_HAS_CHINESE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(chineseCheckResult.errorInfo);
|
||||
const apiInfoChineseCheck: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoChineseCheck, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
if (!errorCodeResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.ERROR_ERROR_CODE,
|
||||
ErrorLevel.MIDDLE,
|
||||
singleApi.getFilePath(),
|
||||
singleApi.getPos(),
|
||||
ErrorType.ERROR_ERROR_CODE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
errorCodeResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult,
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.ERROR_ERROR_CODE)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.ERROR_ERROR_CODE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorCodeResult.errorInfo);
|
||||
const apiInfoErrorCode: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoErrorCode, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
tagInheritCheckResult.forEach((InheritCheckResult: ErrorTagFormat) => {
|
||||
if (!InheritCheckResult.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_SCENE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.WRONG_SCENE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
InheritCheckResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
tagInheritCheckResult.forEach((inheritCheckResult: ErrorTagFormat) => {
|
||||
if (!inheritCheckResult.state) {
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_SCENE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_SCENE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(inheritCheckResult.errorInfo);
|
||||
const apiInfoInherit: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoInherit, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
tagLegalityCheckResult.forEach((legalityResult) => {
|
||||
if (legalityResult.state === false) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_SCENE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.WRONG_SCENE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
legalityResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_SCENE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_SCENE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(legalityResult.errorInfo);
|
||||
const apiInfoInherit: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoInherit, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
tagValueCheckResult.forEach((valueResult) => {
|
||||
if (valueResult.state === false) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_VALUE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.WRONG_VALUE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
valueResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_VALUE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_VALUE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(valueResult.errorInfo);
|
||||
const apiInfoValue: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoValue, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
tagRepeatCheckResult.forEach((repeatResult) => {
|
||||
if (repeatResult.state === false) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_SCENE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.WRONG_SCENE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
repeatResult.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_SCENE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_SCENE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(repeatResult.errorInfo);
|
||||
const apiInfoRepeat: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoRepeat, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
if (!anonymousFunction.state) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.WRONG_SCENE_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
currentFilePath,
|
||||
singleApi.getPos(),
|
||||
ErrorType.WRONG_SCENE,
|
||||
LogType.LOG_JSDOC,
|
||||
toNumber(apiJsdoc.since),
|
||||
singleApi.getApiName(),
|
||||
singleApi.getDefinedText(),
|
||||
anonymousFunction.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.WRONG_SCENE_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.WRONG_SCENE)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(anonymousFunction.errorInfo);
|
||||
const apiInfoAnonymousFunction: ApiCheckInfo = CommonFunctions.getErrorInfo(singleApi, apiJsdoc, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoAnonymousFunction, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -20,7 +20,7 @@ import { DiffHelper } from '../../diff/diff';
|
||||
import { FileUtils } from '../../../utils/FileUtils';
|
||||
import { BasicDiffInfo } from '../../../typedef/diff/ApiInfoDiff';
|
||||
import { AddErrorLogs } from './compile_info';
|
||||
import { compositiveResult, compositiveLocalResult } from '../../../utils/checkUtils';
|
||||
import { compositiveResult, compositiveLocalResult, CommonFunctions } from '../../../utils/checkUtils';
|
||||
import {
|
||||
ErrorType,
|
||||
ErrorID,
|
||||
@ -28,21 +28,31 @@ import {
|
||||
ErrorLevel,
|
||||
ErrorMessage,
|
||||
incompatibleApiDiffTypes,
|
||||
ApiCheckInfo,
|
||||
ErrorBaseInfo,
|
||||
} from '../../../typedef/checker/result_type';
|
||||
import { ApiDiffType } from '../../../typedef/diff/ApiInfoDiff';
|
||||
import { ApiInfo } from '../../../typedef/parser/ApiInfoDefination';
|
||||
|
||||
export class ApiChangeCheck {
|
||||
static checkApiChange(prId?: string): void {
|
||||
const rootDir = path.resolve(
|
||||
static checkApiChange(prId: string): void {
|
||||
let rootDir: string = '';
|
||||
const onlineDir: string = path.resolve(
|
||||
FileUtils.getBaseDirName(),
|
||||
`../../../../../Archive/patch_info/openharmony_interface_sdk-js_${prId}`
|
||||
`../../../../Archive/patch_info/openharmony_interface_sdk-js_${prId}`
|
||||
);
|
||||
if (!fs.existsSync(rootDir)) {
|
||||
return;
|
||||
const localDir: string = path.resolve(FileUtils.getBaseDirName(), prId);
|
||||
|
||||
if (fs.existsSync(onlineDir)) {
|
||||
rootDir = onlineDir;
|
||||
} else if (fs.existsSync(localDir)) {
|
||||
rootDir = localDir;
|
||||
}
|
||||
const oldFileDir: string = path.resolve(rootDir, './old');
|
||||
const newFileDir: string = path.resolve(rootDir, './new');
|
||||
|
||||
if (!fs.existsSync(oldFileDir) || !fs.existsSync(newFileDir)) {
|
||||
return;
|
||||
}
|
||||
const status: fs.Stats = fs.statSync(oldFileDir);
|
||||
let diffInfos: BasicDiffInfo[] = [];
|
||||
if (status.isDirectory()) {
|
||||
@ -61,36 +71,45 @@ export class ApiChangeCheck {
|
||||
const errorInfo: ErrorMessage | undefined = incompatibleApiDiffTypes.get(diffInfo.getDiffType());
|
||||
if (diffInfo.getDiffType() === ApiDiffType.REDUCE) {
|
||||
const dtsName = path.basename(diffInfo.getOldDtsName());
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.API_CHANGE_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
dtsName,
|
||||
diffInfo.getOldPos(),
|
||||
ErrorType.API_CHANGE_ERRORS,
|
||||
LogType.LOG_API,
|
||||
-1,
|
||||
diffInfo.getOldApiName(),
|
||||
diffInfo.getOldApiDefinedText(),
|
||||
errorInfo as string,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
let apiInfoDiff: ApiCheckInfo = new ApiCheckInfo();
|
||||
const hierarchicalRelations: string[] = diffInfo.getOldHierarchicalRelations();
|
||||
const parentModuleName: string = hierarchicalRelations[hierarchicalRelations.length - 1];
|
||||
apiInfoDiff
|
||||
.setErrorID(ErrorID.API_CHANGE_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setFilePath(dtsName)
|
||||
.setApiPostion(diffInfo.getOldPos())
|
||||
.setErrorType(ErrorType.API_CHANGE_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setSinceNumber(-1)
|
||||
.setApiName(diffInfo.getOldApiName())
|
||||
.setApiType(diffInfo.getApiType())
|
||||
.setApiText(diffInfo.getOldApiDefinedText())
|
||||
.setErrorInfo(errorInfo as string)
|
||||
.setHierarchicalRelations(diffInfo.getOldHierarchicalRelations().join('|'))
|
||||
.setParentModuleName(parentModuleName);
|
||||
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoDiff, compositiveResult, compositiveLocalResult);
|
||||
} else {
|
||||
const dtsName = path.basename(diffInfo.getNewDtsName());
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.API_CHANGE_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
dtsName,
|
||||
diffInfo.getOldPos(),
|
||||
ErrorType.API_CHANGE_ERRORS,
|
||||
LogType.LOG_API,
|
||||
-1,
|
||||
diffInfo.getNewApiName(),
|
||||
diffInfo.getNewApiDefinedText(),
|
||||
errorInfo as string,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
let apiInfoDiff: ApiCheckInfo = new ApiCheckInfo();
|
||||
const hierarchicalRelations: string[] = diffInfo.getOldHierarchicalRelations();
|
||||
const parentModuleName: string = hierarchicalRelations[hierarchicalRelations.length - 1];
|
||||
apiInfoDiff
|
||||
.setErrorID(ErrorID.API_CHANGE_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setFilePath(dtsName)
|
||||
.setApiPostion(diffInfo.getOldPos())
|
||||
.setErrorType(ErrorType.API_CHANGE_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setSinceNumber(-1)
|
||||
.setApiName(diffInfo.getNewApiName())
|
||||
.setApiType(diffInfo.getApiType())
|
||||
.setApiText(diffInfo.getNewApiDefinedText())
|
||||
.setErrorInfo(errorInfo as string)
|
||||
.setHierarchicalRelations(diffInfo.getOldHierarchicalRelations().join('|'))
|
||||
.setParentModuleName(parentModuleName);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoDiff, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23,6 +23,8 @@ import {
|
||||
LogType,
|
||||
ErrorLevel,
|
||||
ErrorMessage,
|
||||
ApiCheckInfo,
|
||||
ErrorBaseInfo,
|
||||
} from '../../../typedef/checker/result_type';
|
||||
import { Comment } from '../../../typedef/parser/Comment';
|
||||
import {
|
||||
@ -33,6 +35,7 @@ import {
|
||||
} from '../../../typedef/parser/ApiInfoDefination';
|
||||
import { CommonFunctions } from '../../../utils/checkUtils';
|
||||
import { compositiveResult, compositiveLocalResult } from '../../../utils/checkUtils';
|
||||
import { currentFilePath } from './api_check_plugin';
|
||||
|
||||
export class CheckHump {
|
||||
/**
|
||||
@ -143,20 +146,16 @@ export class CheckHump {
|
||||
}
|
||||
|
||||
if (checkResult !== '') {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.TS_SYNTAX_ERROR_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
filePath,
|
||||
apiInfo.getPos(),
|
||||
ErrorType.NAMING_ERRORS,
|
||||
LogType.LOG_API,
|
||||
-1,
|
||||
apiName,
|
||||
apiInfo.getDefinedText(),
|
||||
checkResult,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.NAMING_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.NAMING_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(checkResult);
|
||||
const apiInfoHump: ApiCheckInfo = CommonFunctions.getErrorInfo(apiInfo, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoHump, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,7 +189,7 @@ export class CheckHump {
|
||||
exportAssignment = (apiInfo.getApiType() === ApiType.EXPORT_DEFAULT || apiInfo.getIsExport()) ? apiInfo.getApiName().replace(StringConstant.EXPORT_DEFAULT, '') : exportAssignment;
|
||||
});
|
||||
}
|
||||
const basename: string = path.basename(filePath).replace(new RegExp(StringConstant.DTS_EXTENSION, 'g'), '');
|
||||
const basename: string = path.basename(filePath).replace(new RegExp(StringConstant.DTS_EXTENSION, 'g'), '').replace(new RegExp(StringConstant.DETS_EXTENSION, 'g'), '');
|
||||
|
||||
const basenames: string[] = basename.split('.');
|
||||
const lastModuleName: string = basenames.length ? basenames[basenames.length - 1] : '';
|
||||
@ -202,20 +201,16 @@ export class CheckHump {
|
||||
checkResult = ErrorMessage.ERROR_LARGE_HUMP_NAME_FILE;
|
||||
}
|
||||
if (checkResult !== '' && version === String(CommonFunctions.getCheckApiVersion())) {
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.MISSPELL_WORDS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
filePath,
|
||||
{ line: -1, character: -1 },
|
||||
ErrorType.NAMING_ERRORS,
|
||||
LogType.LOG_API,
|
||||
-1,
|
||||
'NA',
|
||||
'NA',
|
||||
checkResult,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.NAMING_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.NAMING_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(checkResult);
|
||||
const apiInfoHump: ApiCheckInfo = CommonFunctions.getErrorInfo(undefined, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoHump, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,63 +12,51 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import ts from 'typescript';
|
||||
import { ApiResultSimpleInfo, ApiResultInfo, ErrorMessage } from '../../../typedef/checker/result_type';
|
||||
import { ApiResultSimpleInfo, ApiResultInfo, ErrorMessage, ApiCheckInfo } from '../../../typedef/checker/result_type';
|
||||
import { CommonFunctions } from '../../../utils/checkUtils';
|
||||
|
||||
export class AddErrorLogs {
|
||||
/**
|
||||
* 按照格式生成错误信息
|
||||
* @param { number } id -error message id
|
||||
* @param { number } level -error level
|
||||
* @param { string } filePath -error message file path
|
||||
* @param { string } location -error message location
|
||||
* @param { string } errorType -error message wrong type
|
||||
* @param { string } apiType -error message log type
|
||||
* @param { number } version -error message version
|
||||
* @param { string } apiName -error message api name
|
||||
* @param { string } apiFullText -error message api text
|
||||
* @param { string } message -error infomation
|
||||
* @param { ApiResultSimpleInfo[] } checkErrorInfos -array for storing error information
|
||||
* @param { ApiCheckInfo } apiInfo -api infomation
|
||||
* @param { ApiResultSimpleInfo[] } checkErrorInfos -save api check base error info
|
||||
* @param { ApiResultInfo[] } checkErrorAllInfos -save api check error info
|
||||
*/
|
||||
static addAPICheckErrorLogs(
|
||||
id: number,
|
||||
level: number,
|
||||
filePath: string,
|
||||
pos: ts.LineAndCharacter,
|
||||
errorType: string,
|
||||
apiType: string,
|
||||
version: number,
|
||||
apiName: string,
|
||||
apiFullText: string,
|
||||
message: string,
|
||||
checkErrorInfos: ApiResultSimpleInfo[],
|
||||
checkErrorAllInfos: ApiResultInfo[]
|
||||
static addAPICheckErrorLogs(apiInfo: ApiCheckInfo, checkErrorInfos: ApiResultSimpleInfo[],
|
||||
checkErrorAllInfos: ApiResultInfo[],
|
||||
): void {
|
||||
const location = JSON.stringify(pos.line);
|
||||
const errorMessage: string = `API check error of [${errorType}]: ${message}`;
|
||||
const location = JSON.stringify(apiInfo.getApiPostion().line);
|
||||
const errorMessage: string = `API check error of [${apiInfo.getErrorType()}]: ${apiInfo.getErrorInfo()}`;
|
||||
const apiChecktSimpleErrorLog: ApiResultSimpleInfo = new ApiResultSimpleInfo();
|
||||
|
||||
apiChecktSimpleErrorLog
|
||||
.setID(id)
|
||||
.setLevel(level)
|
||||
.setID(apiInfo.getErrorID())
|
||||
.setLevel(apiInfo.getErrorLevel())
|
||||
.setLocation(location)
|
||||
.setFilePath(filePath)
|
||||
.setFilePath(apiInfo.getFilePath())
|
||||
.setMessage(errorMessage)
|
||||
.setApiText(apiFullText);
|
||||
.setApiText(apiInfo.getApiText())
|
||||
.setApiName(apiInfo.getApiName())
|
||||
.setApiType(apiInfo.getApiType())
|
||||
.setHierarchicalRelations(apiInfo.getHierarchicalRelations())
|
||||
.setParentModuleName(apiInfo.getParentModuleName());
|
||||
|
||||
const apiCheckErrorLog: ApiResultInfo = new ApiResultInfo();
|
||||
apiCheckErrorLog
|
||||
.setErrorType(errorType)
|
||||
.setLocation(filePath.slice(filePath.indexOf('api'), filePath.length) + `(line: ${location})`)
|
||||
.setApiType(apiType)
|
||||
.setErrorType(apiInfo.getErrorType())
|
||||
.setLocation(apiInfo.getFilePath().slice(apiInfo.getFilePath().indexOf('api'), apiInfo.getFilePath().length) + `(line: ${location})`)
|
||||
.setApiType(apiInfo.getApiType())
|
||||
.setMessage(errorMessage)
|
||||
.setVersion(version)
|
||||
.setLevel(level)
|
||||
.setApiName(apiName)
|
||||
.setApiFullText(apiFullText)
|
||||
.setBaseName(filePath.slice(filePath.lastIndexOf('\\') + 1, filePath.length));
|
||||
let isLostKitErrorInfo: boolean = message === CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['kit']);
|
||||
let isLostFileErrorInfo: boolean = message === CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['file']);
|
||||
.setVersion(apiInfo.getSinceNumber())
|
||||
.setLevel(apiInfo.getErrorLevel())
|
||||
.setApiName(apiInfo.getApiName())
|
||||
.setApiFullText(apiInfo.getApiText())
|
||||
.setBaseName(apiInfo.getFilePath().slice(apiInfo.getFilePath().lastIndexOf('\\') + 1, apiInfo.getFilePath().length))
|
||||
.setHierarchicalRelations(apiInfo.getHierarchicalRelations())
|
||||
.setParentModuleName(apiInfo.getParentModuleName())
|
||||
.setDefectType('');
|
||||
let isLostKitErrorInfo: boolean = apiInfo.getErrorInfo() === CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['kit']);
|
||||
let isLostFileErrorInfo: boolean = apiInfo.getErrorInfo() === CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['file']);
|
||||
let hasLostKitErrorInfo: string[] = [];
|
||||
let hasLostfileErrorInfo: string[] = [];
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
import ts from 'typescript';
|
||||
import { EventConstant } from '../../../utils/Constant';
|
||||
import { EventMethodData, CollectParamStatus } from '../../../typedef/checker/event_method_check_interface';
|
||||
import { ErrorID, ErrorLevel, ErrorMessage, ErrorType, LogType } from '../../../typedef/checker/result_type';
|
||||
import { ApiCheckInfo, ErrorBaseInfo, ErrorID, ErrorLevel, ErrorMessage, ErrorType, LogType } from '../../../typedef/checker/result_type';
|
||||
import { ApiInfo, ApiType, BasicApiInfo, MethodInfo, ParamInfo } from '../../../typedef/parser/ApiInfoDefination';
|
||||
import { CommonFunctions } from '../../../utils/checkUtils';
|
||||
import { FilesMap, Parser } from '../../parser/parser';
|
||||
@ -24,7 +24,7 @@ import { AddErrorLogs } from './compile_info';
|
||||
import { compositiveResult, compositiveLocalResult } from '../../../utils/checkUtils';
|
||||
import { CheckHump } from './check_hump';
|
||||
import { ApiCheckVersion } from '../config/api_check_version.json';
|
||||
import { Check } from './api_check_plugin';
|
||||
import { Check, currentFilePath } from './api_check_plugin';
|
||||
|
||||
export class EventMethodChecker {
|
||||
private apiData: FilesMap;
|
||||
@ -56,20 +56,16 @@ export class EventMethodChecker {
|
||||
(eventMethod.onEvents.length !== 0 && eventMethod.offEvents.length === 0)) {
|
||||
const firstEvent: BasicApiInfo = eventMethod.onEvents.concat(eventMethod.offEvents)[0];
|
||||
const errorMessage: string = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_EVENT_ON_AND_OFF_PAIR, []);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.API_PAIR_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
firstEvent.getFilePath(),
|
||||
firstEvent.getPos(),
|
||||
ErrorType.API_PAIR_ERRORS,
|
||||
LogType.LOG_API,
|
||||
parseInt(firstEvent.getCurrentVersion()),
|
||||
firstEvent.getApiName(),
|
||||
firstEvent.getDefinedText(),
|
||||
errorMessage,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.API_PAIR_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.API_PAIR_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorMessage);
|
||||
const apiInfoEvent: ApiCheckInfo = CommonFunctions.getErrorInfo(firstEvent, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoEvent, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
|
||||
// check off event
|
||||
@ -91,20 +87,16 @@ export class EventMethodChecker {
|
||||
(offEvnetCallbackNumber === 0 && eventMethod.offEvents.length !== 0)) {
|
||||
const firstEvent: BasicApiInfo = eventMethod.offEvents[0];
|
||||
const errorMessage: string = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_EVENT_CALLBACK_OPTIONAL, []);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.PARAMETER_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
firstEvent.getFilePath(),
|
||||
firstEvent.getPos(),
|
||||
ErrorType.PARAMETER_ERRORS,
|
||||
LogType.LOG_API,
|
||||
parseInt(firstEvent.getCurrentVersion()),
|
||||
firstEvent.getApiName(),
|
||||
firstEvent.getDefinedText(),
|
||||
errorMessage,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.PARAMETER_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.PARAMETER_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorMessage);
|
||||
const apiInfoEvent: ApiCheckInfo = CommonFunctions.getErrorInfo(firstEvent, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoEvent, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,20 +111,16 @@ export class EventMethodChecker {
|
||||
const eventParams: ParamInfo[] = (event as MethodInfo).getParams();
|
||||
if (eventParams.length < 1) {
|
||||
const errorMessage: string = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_EVENT_WITHOUT_PARAMETER, []);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.PARAMETER_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
event.getFilePath(),
|
||||
event.getPos(),
|
||||
ErrorType.PARAMETER_ERRORS,
|
||||
LogType.LOG_API,
|
||||
parseInt(event.getCurrentVersion()),
|
||||
event.getApiName(),
|
||||
event.getDefinedText(),
|
||||
errorMessage,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.PARAMETER_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.PARAMETER_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorMessage);
|
||||
const apiInfoEvent: ApiCheckInfo = CommonFunctions.getErrorInfo(event, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoEvent, compositiveResult, compositiveLocalResult);
|
||||
continue;
|
||||
}
|
||||
const firstParam: ParamInfo = eventParams[0];
|
||||
@ -141,55 +129,43 @@ export class EventMethodChecker {
|
||||
if (paramTypeName === '') {
|
||||
const errorMessage: string = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_EVENT_NAME_NULL,
|
||||
[firstParam.getApiName()]);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.PARAMETER_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
event.getFilePath(),
|
||||
event.getPos(),
|
||||
ErrorType.PARAMETER_ERRORS,
|
||||
LogType.LOG_API,
|
||||
parseInt(event.getCurrentVersion()),
|
||||
event.getApiName(),
|
||||
event.getDefinedText(),
|
||||
errorMessage,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.PARAMETER_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.PARAMETER_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorMessage);
|
||||
const apiInfoEvent: ApiCheckInfo = CommonFunctions.getErrorInfo(event, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoEvent, compositiveResult, compositiveLocalResult);
|
||||
} else if (!CheckHump.checkSmallHump(paramTypeName)) {
|
||||
const errorMessage: string = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_EVENT_NAME_SMALL_HUMP,
|
||||
[paramTypeName]);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.PARAMETER_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
event.getFilePath(),
|
||||
event.getPos(),
|
||||
ErrorType.PARAMETER_ERRORS,
|
||||
LogType.LOG_API,
|
||||
parseInt(event.getCurrentVersion()),
|
||||
event.getApiName(),
|
||||
event.getDefinedText(),
|
||||
errorMessage,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.PARAMETER_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.PARAMETER_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorMessage);
|
||||
const apiInfoEvent: ApiCheckInfo = CommonFunctions.getErrorInfo(event, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoEvent, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
} else if (firstParam.getParamType() !== ts.SyntaxKind.StringKeyword) {
|
||||
const errorMessage: string = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_EVENT_NAME_STRING,
|
||||
[firstParam.getApiName()]);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.PARAMETER_ERRORS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
event.getFilePath(),
|
||||
event.getPos(),
|
||||
ErrorType.PARAMETER_ERRORS,
|
||||
LogType.LOG_API,
|
||||
parseInt(event.getCurrentVersion()),
|
||||
event.getApiName(),
|
||||
event.getDefinedText(),
|
||||
errorMessage,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.PARAMETER_ERRORS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.PARAMETER_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(errorMessage);
|
||||
const apiInfoEvent: ApiCheckInfo = CommonFunctions.getErrorInfo(event, undefined, currentFilePath,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoEvent, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -20,7 +20,8 @@ import {
|
||||
} from '../../../typedef/checker/result_type';
|
||||
import { ApiInfo } from '../../../typedef/parser/ApiInfoDefination';
|
||||
import { Comment } from '../../../typedef/parser/Comment';
|
||||
import { CommonFunctions } from '../../../utils/checkUtils';
|
||||
import { CommonFunctions, punctuationMarkSet } from '../../../utils/checkUtils';
|
||||
import { WordsCheck } from './words_check';
|
||||
const nameDictionary = require('../config/name_dictionary.json');
|
||||
const nameScenarioScope = require('../config/name_scenario_scope.json');
|
||||
|
||||
@ -38,12 +39,23 @@ export class ApiNamingCheck {
|
||||
const jsDocInfo: Comment.JsDocInfo[] = singleApi.getJsDocInfos();
|
||||
const publishVersion: string = CommonFunctions.getSinceVersion(jsDocInfo[0].getSince());
|
||||
const apiVersionToBeVerified: string = CommonFunctions.getCheckApiVersion();
|
||||
const lowIdentifier: string = singleApi.getDefinedText().toLowerCase();
|
||||
const fileName:string=singleApi.getFilePath().toLowerCase();
|
||||
if (publishVersion === apiVersionToBeVerified) {
|
||||
ApiNamingCheck.checkApiNamingWords(lowIdentifier, tagNameCheckResult);
|
||||
ApiNamingCheck.checkApiNamingScenario(fileName, tagNameCheckResult, singleApi);
|
||||
}
|
||||
const fileName: string = singleApi.getFilePath().toLowerCase();
|
||||
const reg = /\s{2,}/g;
|
||||
const regx = /(\/\*|\*\/|\*)|\n|\r/g;
|
||||
let apiText: string = singleApi.getDefinedText().replace(regx, ' ');
|
||||
punctuationMarkSet.forEach(punctuationMark => {
|
||||
const punctuationMarkReg = new RegExp(punctuationMark, 'g');
|
||||
if (punctuationMarkReg.test(apiText)) { apiText = apiText.replace(punctuationMarkReg, ' ').replace(reg, ' '); }
|
||||
});
|
||||
let apiWordsArr = apiText.split(/\s/g);
|
||||
let basicWords: string[] = [];
|
||||
apiWordsArr.forEach((apiWord) => { basicWords = WordsCheck.splitComplexWords(apiWord); });
|
||||
basicWords.forEach((basicWord: string) => {
|
||||
if (publishVersion === apiVersionToBeVerified) {
|
||||
ApiNamingCheck.checkApiNamingWords(basicWord, tagNameCheckResult);
|
||||
ApiNamingCheck.checkApiNamingScenario(fileName, tagNameCheckResult, singleApi);
|
||||
}
|
||||
});
|
||||
return tagNameCheckResult;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ export class LegalityCheck {
|
||||
const illegalTagsArray: string[] = LegalityCheck.getIllegalTagsArray(apiLegalityTagsArray);
|
||||
let extendsApiValue = '';
|
||||
let implementsApiValue = '';
|
||||
|
||||
if (singleApi.getApiType() === ApiType.CLASS || singleApi.getApiType() === ApiType.INTERFACE) {
|
||||
extendsApiValue = CommonFunctions.getExtendsApiValue(singleApi);
|
||||
implementsApiValue = CommonFunctions.getImplementsApiValue(singleApi);
|
||||
@ -61,82 +60,83 @@ export class LegalityCheck {
|
||||
}
|
||||
|
||||
// 判断api的jsdoc中是否存在非法标签,是否缺失必选标签
|
||||
if (Array.isArray(apiLegalityTagsArray)) {
|
||||
const apiTags: Comment.CommentTag[] | undefined = apiJsdoc.tags;
|
||||
const apiTagsName: string[] = [];
|
||||
const throwsCodeArr: string[] = [];
|
||||
if (apiTags === undefined) {
|
||||
const sinceLost: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['since']),
|
||||
};
|
||||
const syscapLost: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['syscap']),
|
||||
};
|
||||
apiLegalityCheckResult.push(sinceLost, syscapLost);
|
||||
return apiLegalityCheckResult;
|
||||
}
|
||||
const tagsTag: string[] = [];
|
||||
apiTags.forEach((apiTag: Comment.CommentTag) => { tagsTag.push(apiTag.tag) });
|
||||
if (tagsTag.includes('deprecated')) {
|
||||
return apiLegalityCheckResult;
|
||||
}
|
||||
|
||||
let paramTagNumber: number = 0;
|
||||
let paramApiNumber: number =
|
||||
singleApi.getApiType() === ApiType.METHOD ? (singleApi as MethodInfo).getParams().length : 0;
|
||||
|
||||
paramApiNumber = singleApi.getApiType() === ApiType.TYPE_ALIAS ?
|
||||
(singleApi as TypeAliasInfo).getParamInfos().length : paramApiNumber;
|
||||
|
||||
apiTags.forEach((apiTag) => {
|
||||
apiTagsName.push(apiTag.tag);
|
||||
if (apiTag.tag === 'throws') {
|
||||
throwsCodeArr.push(apiTag.name);
|
||||
}
|
||||
paramTagNumber = apiTag.tag === 'param' ? paramTagNumber + 1 : paramTagNumber;
|
||||
const isUseinsteadLegalSituation: boolean = apiTag.tag === 'useinstead' && apiJsdoc.deprecatedVersion !== '-1';
|
||||
apiLegalityTagsSet.delete('param');
|
||||
if (apiLegalityTagsSet.has(apiTag.tag)) {
|
||||
apiLegalityTagsSet.delete(apiTag.tag);
|
||||
}
|
||||
if (singleApi.getApiType() === ApiType.INTERFACE && (apiTag.tag === 'typedef' || apiTag.tag === 'interface')) {
|
||||
apiLegalityTagsSet.delete('typedef');
|
||||
apiLegalityTagsSet.delete('interface');
|
||||
}
|
||||
if ((singleApi.getApiType() === ApiType.METHOD && (singleApi as MethodInfo).getReturnValue().length === 0) ||
|
||||
singleApi.getApiType() === ApiType.TYPE_ALIAS && ((singleApi as TypeAliasInfo).getReturnType() === 'void' ||
|
||||
!(singleApi as TypeAliasInfo).getTypeIsFunction())) {
|
||||
apiLegalityTagsSet.delete('returns');
|
||||
illegalTagsArray.push('returns');
|
||||
}
|
||||
if (illegalTagsArray.includes(apiTag.tag)) {
|
||||
if (apiTag.tag !== 'useinstead' || !isUseinsteadLegalSituation) {
|
||||
const apiRedundantResultFormat: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_USE, [apiTag.tag]),
|
||||
};
|
||||
apiLegalityCheckResult.push(apiRedundantResultFormat);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (singleApi.getApiType() === ApiType.METHOD) {
|
||||
LegalityCheck.checkThrowsCode(throwsCodeArr, apiTagsName, paramApiNumber, apiLegalityCheckResult);
|
||||
}
|
||||
// param合法性单独进行校验
|
||||
LegalityCheck.paramLegalityCheck(paramTagNumber, paramApiNumber, apiLegalityCheckResult);
|
||||
// 缺失标签set合集
|
||||
apiLegalityTagsSet.forEach((apiLegalityTag) => {
|
||||
if (!conditionalOptionalTags.includes(apiLegalityTag)) {
|
||||
const apiLostResultFormat: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, [apiLegalityTag]),
|
||||
};
|
||||
apiLegalityCheckResult.push(apiLostResultFormat);
|
||||
}
|
||||
});
|
||||
if (!Array.isArray(apiLegalityTagsArray)) {
|
||||
return apiLegalityCheckResult;
|
||||
}
|
||||
const apiTags: Comment.CommentTag[] | undefined = apiJsdoc.tags;
|
||||
const apiTagsName: string[] = [];
|
||||
const throwsCodeArr: string[] = [];
|
||||
if (apiTags === undefined) {
|
||||
const sinceLost: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['since']),
|
||||
};
|
||||
const syscapLost: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, ['syscap']),
|
||||
};
|
||||
apiLegalityCheckResult.push(sinceLost, syscapLost);
|
||||
return apiLegalityCheckResult;
|
||||
}
|
||||
const tagsTag: string[] = [];
|
||||
apiTags.forEach((apiTag: Comment.CommentTag) => { tagsTag.push(apiTag.tag) });
|
||||
if (tagsTag.includes('deprecated')) {
|
||||
return apiLegalityCheckResult;
|
||||
}
|
||||
|
||||
let paramTagNumber: number = 0;
|
||||
let paramApiNumber: number =
|
||||
singleApi.getApiType() === ApiType.METHOD ? (singleApi as MethodInfo).getParams().length : 0;
|
||||
|
||||
paramApiNumber = singleApi.getApiType() === ApiType.TYPE_ALIAS ?
|
||||
(singleApi as TypeAliasInfo).getParamInfos().length : paramApiNumber;
|
||||
|
||||
apiTags.forEach((apiTag) => {
|
||||
apiTagsName.push(apiTag.tag);
|
||||
if (apiTag.tag === 'throws') {
|
||||
throwsCodeArr.push(apiTag.name);
|
||||
}
|
||||
paramTagNumber = apiTag.tag === 'param' ? paramTagNumber + 1 : paramTagNumber;
|
||||
const isUseinsteadLegalSituation: boolean = apiTag.tag === 'useinstead' && apiJsdoc.deprecatedVersion !== '-1';
|
||||
apiLegalityTagsSet.delete('param');
|
||||
if (apiLegalityTagsSet.has(apiTag.tag)) {
|
||||
apiLegalityTagsSet.delete(apiTag.tag);
|
||||
}
|
||||
if (singleApi.getApiType() === ApiType.INTERFACE && (apiTag.tag === 'typedef' || apiTag.tag === 'interface')) {
|
||||
apiLegalityTagsSet.delete('typedef');
|
||||
apiLegalityTagsSet.delete('interface');
|
||||
}
|
||||
if ((singleApi.getApiType() === ApiType.METHOD && (singleApi as MethodInfo).getReturnValue().length === 0) ||
|
||||
singleApi.getApiType() === ApiType.TYPE_ALIAS && ((singleApi as TypeAliasInfo).getReturnType() === 'void' ||
|
||||
!(singleApi as TypeAliasInfo).getTypeIsFunction())) {
|
||||
apiLegalityTagsSet.delete('returns');
|
||||
illegalTagsArray.push('returns');
|
||||
}
|
||||
if (illegalTagsArray.includes(apiTag.tag)) {
|
||||
if (apiTag.tag !== 'useinstead' || !isUseinsteadLegalSituation) {
|
||||
const apiRedundantResultFormat: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_USE, [apiTag.tag]),
|
||||
};
|
||||
apiLegalityCheckResult.push(apiRedundantResultFormat);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (singleApi.getApiType() === ApiType.METHOD) {
|
||||
LegalityCheck.checkThrowsCode(throwsCodeArr, apiTagsName, paramApiNumber, apiLegalityCheckResult);
|
||||
}
|
||||
// param合法性单独进行校验
|
||||
LegalityCheck.paramLegalityCheck(paramTagNumber, paramApiNumber, apiLegalityCheckResult);
|
||||
// 缺失标签set合集
|
||||
apiLegalityTagsSet.forEach((apiLegalityTag) => {
|
||||
if (!conditionalOptionalTags.includes(apiLegalityTag)) {
|
||||
const apiLostResultFormat: ErrorTagFormat = {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, [apiLegalityTag]),
|
||||
};
|
||||
apiLegalityCheckResult.push(apiLostResultFormat);
|
||||
}
|
||||
});
|
||||
return apiLegalityCheckResult;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ export class LegalityCheck {
|
||||
apiLostSystemapiTag.errorInfo = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_LOST_LABEL, [hasSystemapiTag ? 'throws 202' : ParticularErrorCode.ERROR_SYSTEMAPI]);
|
||||
}
|
||||
// check systemapi 401
|
||||
if (hasError401 && paramApiNumber===0) {
|
||||
if (hasError401 && paramApiNumber === 0) {
|
||||
apiRedundantThrows.state = false;
|
||||
apiRedundantThrows.errorInfo = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_REPEATLABEL, ['throws']);
|
||||
}
|
||||
|
@ -46,13 +46,36 @@ export class OrderCheck {
|
||||
// 判断标签是否为官方标签
|
||||
const firstTag = CommonFunctions.isOfficialTag(tagsOrder[tagIndex]);
|
||||
// 非自定义标签在前或数组降序时报错
|
||||
if ((firstTag && secondIndex > -1) || (firstIndex > secondIndex && secondIndex > -1)) {
|
||||
if (tagsOrder[tagIndex].tag !== 'form' && tagsOrder[tagIndex + 1].tag !== 'form' &&
|
||||
((firstTag && secondIndex > -1) || (firstIndex > secondIndex && secondIndex > -1))) {
|
||||
orderCheckResult.state = false;
|
||||
orderCheckResult.errorInfo = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_ORDER, [tagsOrder[tagIndex]]);
|
||||
break;
|
||||
} else if (tagsOrder[tagIndex].tag === 'form') {
|
||||
orderCheckResult.state = OrderCheck.formOrderCheck(tagsOrder, tagIndex, firstIndex, secondIndex);
|
||||
orderCheckResult.errorInfo = CommonFunctions.createErrorInfo(ErrorMessage.ERROR_ORDER, [tagsOrder[tagIndex].tag]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return orderCheckResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对form标签的顺序做兼容处理
|
||||
*/
|
||||
static formOrderCheck(tags: Comment.CommentTag[], tagIndex: number, firstIndex: number, secondIndex: number): boolean {
|
||||
const frontFirstIndex = tagIndex - 1 > -1 ? tagsArrayOfOrder.indexOf(tags[tagIndex - 1].tag) : 0;
|
||||
const formNeighborArr = [frontFirstIndex, firstIndex];
|
||||
const newTagIndex = tagsArrayOfOrder.lastIndexOf(tags[tagIndex].tag);
|
||||
const newFormNeighborArr = [frontFirstIndex, newTagIndex];
|
||||
if (secondIndex > -1) {
|
||||
formNeighborArr.push(secondIndex);
|
||||
newFormNeighborArr.push(secondIndex);
|
||||
}
|
||||
if (!CommonFunctions.isAscending(formNeighborArr) && !CommonFunctions.isAscending(newFormNeighborArr)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -179,7 +179,6 @@ export class TagValueCheck {
|
||||
errorInfo: '',
|
||||
};
|
||||
const returnsTagValue: string = tag.type.replace(/\s/g, '');
|
||||
|
||||
let returnsApiValue: string[] = [];
|
||||
const legalApiArr: string[] = [ApiType.METHOD, ApiType.TYPE_ALIAS];
|
||||
if (!legalApiArr.includes(singleApi.getApiType())) {
|
||||
@ -191,6 +190,7 @@ export class TagValueCheck {
|
||||
} else {
|
||||
returnsApiValue = spacealCase.length > 0 ? spacealCase : (singleApi as MethodInfo).getReturnValue();
|
||||
}
|
||||
|
||||
if (returnsApiValue.length === 0) {
|
||||
returnsValueCheckResult.state = false;
|
||||
returnsValueCheckResult.errorInfo = ErrorMessage.ERROR_INFO_RETURNS;
|
||||
@ -431,10 +431,10 @@ export class TagValueCheck {
|
||||
let paramApiName: string = '';
|
||||
let paramApiType: string[] = [];
|
||||
|
||||
if (singleApi.getApiType() === ApiType.TYPE_ALIAS) {
|
||||
const typeParams: TypeParamInfo[] = (singleApi as TypeAliasInfo).getParamInfos();
|
||||
paramApiName = typeParams.length > paramIndex ? typeParams[paramIndex].getParamName() : '';
|
||||
paramApiType.push(typeParams.length > paramIndex ? JSON.stringify(typeParams[paramIndex].getParamType()) : '');
|
||||
if (singleApi. getApiType() === ApiType.TYPE_ALIAS) {
|
||||
const typeParams: ParamInfo[] = (singleApi as TypeAliasInfo).getParamInfos();
|
||||
paramApiName = typeParams.length > paramIndex ? typeParams[paramIndex].getApiName() : '';
|
||||
paramApiType=typeParams.length > paramIndex ? typeParams[paramIndex].getType() : [];
|
||||
} else {
|
||||
const paramApiInfos: ParamInfo[] = (singleApi as MethodInfo).getParams();
|
||||
paramApiName = paramApiInfos[paramIndex]?.getApiName();
|
||||
|
@ -24,9 +24,11 @@ import {
|
||||
LogType,
|
||||
ErrorLevel,
|
||||
ApiResultInfo,
|
||||
ApiCheckInfo,
|
||||
ErrorBaseInfo,
|
||||
} from '../../../typedef/checker/result_type';
|
||||
import { StringConstant } from '../../../utils/Constant';
|
||||
import { CompolerOptions, ObtainFullPath } from '../../../utils/checkUtils';
|
||||
import { CommonFunctions, CompolerOptions, ObtainFullPath } from '../../../utils/checkUtils';
|
||||
import { compositiveResult, compositiveLocalResult } from '../../../utils/checkUtils';
|
||||
|
||||
export class TsSyntaxCheck {
|
||||
@ -95,20 +97,8 @@ export class TsSyntaxCheck {
|
||||
result.forEach((item) => {
|
||||
const filePath: string = item.file?.fileName as string;
|
||||
const fileName: string = filePath.substring(filePath.indexOf('api'), filePath.length);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.TS_SYNTAX_ERROR_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
fileName,
|
||||
ts.getLineAndCharacterOfPosition(node.getSourceFile(), item.start as number),
|
||||
ErrorType.TS_SYNTAX_ERROR,
|
||||
LogType.LOG_API,
|
||||
-1,
|
||||
'NA',
|
||||
'NA',
|
||||
item.messageText as string,
|
||||
tsResult,
|
||||
checkErrorAllInfos
|
||||
);
|
||||
const apiInfo: ApiCheckInfo = new ApiCheckInfo();
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfo, compositiveResult, compositiveLocalResult);
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -118,20 +108,16 @@ export class TsSyntaxCheck {
|
||||
if (path.normalize(item.file?.fileName as string) === path.normalize(fileName)) {
|
||||
const filePath: string = item.file?.fileName as string;
|
||||
const fileName: string = filePath.substring(filePath.indexOf('api'), filePath.length);
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.TS_SYNTAX_ERROR_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
fileName,
|
||||
ts.getLineAndCharacterOfPosition(node.getSourceFile(), item.start as number),
|
||||
ErrorType.TS_SYNTAX_ERROR,
|
||||
LogType.LOG_API,
|
||||
-1,
|
||||
'NA',
|
||||
'NA',
|
||||
item.messageText as string,
|
||||
tsResult,
|
||||
checkErrorAllInfos
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.TS_SYNTAX_ERROR_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.PARAMETER_ERRORS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(item.messageText as string);
|
||||
const apiInfoTsCheck: ApiCheckInfo = CommonFunctions.getErrorInfo(undefined, undefined, fileName,
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoTsCheck, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import {
|
||||
ErrorLevel,
|
||||
ErrorTagFormat,
|
||||
ErrorMessage,
|
||||
ApiCheckInfo,
|
||||
ErrorBaseInfo,
|
||||
} from '../../../typedef/checker/result_type';
|
||||
import { BasicApiInfo } from '../../../typedef/parser/ApiInfoDefination';
|
||||
import { tagsArrayOfOrder, officialTagArr, CommonFunctions } from '../../../utils/checkUtils';
|
||||
@ -85,20 +87,16 @@ export class WordsCheck {
|
||||
state: false,
|
||||
errorInfo: CommonFunctions.createErrorInfo(ErrorMessage.ERROR_WORD, [apiWord, basicWord]),
|
||||
};
|
||||
AddErrorLogs.addAPICheckErrorLogs(
|
||||
ErrorID.MISSPELL_WORDS_ID,
|
||||
ErrorLevel.MIDDLE,
|
||||
baseInfo.getFilePath(),
|
||||
baseInfo.getPos(),
|
||||
ErrorType.MISSPELL_WORDS,
|
||||
LogType.LOG_JSDOC,
|
||||
-1,
|
||||
baseInfo.getApiName(),
|
||||
baseInfo.getDefinedText(),
|
||||
wordsCheckFormat.errorInfo,
|
||||
compositiveResult,
|
||||
compositiveLocalResult
|
||||
);
|
||||
const errorBaseInfo: ErrorBaseInfo = new ErrorBaseInfo();
|
||||
errorBaseInfo
|
||||
.setErrorID(ErrorID.MISSPELL_WORDS_ID)
|
||||
.setErrorLevel(ErrorLevel.MIDDLE)
|
||||
.setErrorType(ErrorType.MISSPELL_WORDS)
|
||||
.setLogType(LogType.LOG_JSDOC)
|
||||
.setErrorInfo(wordsCheckFormat.errorInfo);
|
||||
const apiInfoSpell: ApiCheckInfo = CommonFunctions.getErrorInfo(baseInfo, undefined, baseInfo.getFilePath(),
|
||||
errorBaseInfo);
|
||||
AddErrorLogs.addAPICheckErrorLogs(apiInfoSpell, compositiveResult, compositiveLocalResult);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -25,6 +25,7 @@ import {
|
||||
PropertyInfo,
|
||||
TypeAliasInfo,
|
||||
ClassInfo,
|
||||
TypeParamInfo,
|
||||
} from '../../typedef/parser/ApiInfoDefination';
|
||||
import { Comment } from '../../typedef/parser/Comment';
|
||||
import {
|
||||
@ -90,7 +91,7 @@ export namespace DiffProcessorHelper {
|
||||
if (jsDocInfo.getSince() !== '-1') {
|
||||
sinceVersion = jsDocInfo.getSince();
|
||||
return sinceVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
return sinceVersion;
|
||||
}
|
||||
@ -282,6 +283,9 @@ export namespace DiffProcessorHelper {
|
||||
if (errorCodesStringOfNew === errorCodesStringOfOld) {
|
||||
return undefined;
|
||||
}
|
||||
if (errorCodesOfOld.length === 0 && errorCodesOfNew.length !== 0) {
|
||||
return diffTypeInfo.setStatusCode(ApiStatusCode.NEW_ERRORCODE).setDiffType(ApiDiffType.ERROR_CODE_NA_TO_HAVE);
|
||||
}
|
||||
if (StringUtils.hasSubstring(errorCodesStringOfNew, errorCodesStringOfOld)) {
|
||||
return diffTypeInfo.setStatusCode(ApiStatusCode.NEW_ERRORCODE).setDiffType(ApiDiffType.ERROR_CODE_ADD);
|
||||
}
|
||||
@ -291,6 +295,26 @@ export namespace DiffProcessorHelper {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.ERROR_CODE_CHANGE);
|
||||
}
|
||||
|
||||
static diffAtomicService(
|
||||
oldJsDocInfo: Comment.JsDocInfo | undefined,
|
||||
newJsDocInfo: Comment.JsDocInfo | undefined
|
||||
): DiffTypeInfo | undefined {
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
const isAtomicServiceOfOld: boolean | undefined = oldJsDocInfo? oldJsDocInfo.getIsAtomicService() : false;
|
||||
const isAtomicServiceOfNew: boolean | undefined = newJsDocInfo? newJsDocInfo.getIsAtomicService() : false;
|
||||
diffTypeInfo
|
||||
.setStatusCode(ApiStatusCode.ATOMICSERVICE_CHANGE)
|
||||
.setOldMessage(StringUtils.transformBooleanToTag(isAtomicServiceOfOld, Comment.JsDocTag.ATOMIC_SERVICE))
|
||||
.setNewMessage(StringUtils.transformBooleanToTag(isAtomicServiceOfNew, Comment.JsDocTag.ATOMIC_SERVICE));
|
||||
if (isAtomicServiceOfOld === isAtomicServiceOfNew) {
|
||||
return undefined;
|
||||
}
|
||||
if (isAtomicServiceOfNew) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.ATOMIC_SERVICE_NA_TO_HAVE);
|
||||
}
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA);
|
||||
}
|
||||
|
||||
static diffSyscap(
|
||||
oldJsDocInfo: Comment.JsDocInfo | undefined,
|
||||
newJsDocInfo: Comment.JsDocInfo | undefined
|
||||
@ -619,7 +643,23 @@ export namespace DiffProcessorHelper {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static diffTypeAliasReturnType(oldApiInfo: TypeAliasInfo, newApiInfo: TypeAliasInfo): DiffTypeInfo | undefined {
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
const oldReturnType: string[] = oldApiInfo.getReturnType()?.split('|');
|
||||
const newReturnType: string[] = newApiInfo.getReturnType()?.split('|');
|
||||
const olaMethodTypeStr = oldReturnType.toString().replace(/\r|\n|\s+|'|"/g, '');
|
||||
const newMethodTypeStr = newReturnType.toString().replace(/\r|\n|\s+|'|"/g, '');
|
||||
if (olaMethodTypeStr === newMethodTypeStr) return;
|
||||
diffTypeInfo.setOldMessage(olaMethodTypeStr).setNewMessage(newMethodTypeStr);
|
||||
if (checkParentContainChild(newReturnType, oldReturnType)) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_ADD);
|
||||
}
|
||||
if (checkParentContainChild(oldReturnType, newReturnType)) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_REDUCE);
|
||||
}
|
||||
// 旧版本不包含新版本,新版本也不含旧版本,就定义为返回值变更
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_CHANGE);
|
||||
}
|
||||
/**
|
||||
* 处理方法节点的返回值
|
||||
*
|
||||
@ -629,23 +669,58 @@ export namespace DiffProcessorHelper {
|
||||
*/
|
||||
static diffMethodReturnType(oldApiInfo: MethodInfo, newApiInfo: MethodInfo): DiffTypeInfo | undefined {
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
const olaMethodType: string[] = oldApiInfo.getReturnValue();
|
||||
const newMethodType: string[] = newApiInfo.getReturnValue();
|
||||
const olaMethodTypeStr = olaMethodType.toString().replace(/\r|\n|\s+|'|"/g, '');
|
||||
const newMethodTypeStr = newMethodType.toString().replace(/\r|\n|\s+|'|"/g, '');
|
||||
const oldReturnType: string[] = oldApiInfo.getReturnValue();
|
||||
const newReturnType: string[] = newApiInfo.getReturnValue();
|
||||
const olaMethodTypeStr = oldReturnType.toString().replace(/\r|\n|\s+|'|"/g, '');
|
||||
const newMethodTypeStr = newReturnType.toString().replace(/\r|\n|\s+|'|"/g, '');
|
||||
if (olaMethodTypeStr === newMethodTypeStr) {
|
||||
return undefined;
|
||||
}
|
||||
diffTypeInfo.setOldMessage(olaMethodTypeStr).setNewMessage(newMethodTypeStr);
|
||||
if (StringUtils.hasSubstring(newMethodTypeStr, olaMethodTypeStr)) {
|
||||
if (checkParentContainChild(newReturnType, oldReturnType)) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.FUNCTION_RETURN_TYPE_ADD);
|
||||
}
|
||||
if (StringUtils.hasSubstring(olaMethodTypeStr, newMethodTypeStr)) {
|
||||
if (checkParentContainChild(oldReturnType, newReturnType)) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.FUNCTION_RETURN_TYPE_REDUCE);
|
||||
}
|
||||
// 旧版本不包含新版本,新版本也不含旧版本,就定义为返回值变更
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.FUNCTION_RETURN_TYPE_CHANGE);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param isTypeAlias 是否为自定义节点类型
|
||||
* @returns {*} {DiffMethodType} 当前节点类型对应的修改类型
|
||||
*/
|
||||
static getDiffMethodTypes(isTypeAlias: boolean): DiffMethodType & DiffTypeChangeType {
|
||||
if (isTypeAlias) {
|
||||
return {
|
||||
POS_CHANGE: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_POS_CHAHGE,
|
||||
ADD_OPTIONAL_PARAM: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_UNREQUIRED_ADD,
|
||||
ADD_REQUIRED_PARAM: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_REQUIRED_ADD,
|
||||
REDUCE_PARAM: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_REDUCE,
|
||||
PARAM_TYPE_CHANGE: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_CHANGE,
|
||||
PARAM_TYPE_ADD: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_ADD,
|
||||
PARAM_TYPE_REDUCE: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_REDUCE,
|
||||
PARAM_TO_UNREQUIRED: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TO_UNREQUIRED,
|
||||
PARAM_TO_REQUIRED: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TO_REQUIRED,
|
||||
PARAM_CHANGE: ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_CHANGE,
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
POS_CHANGE: ApiDiffType.FUNCTION_PARAM_POS_CHANGE,
|
||||
ADD_OPTIONAL_PARAM: ApiDiffType.FUNCTION_PARAM_UNREQUIRED_ADD,
|
||||
ADD_REQUIRED_PARAM: ApiDiffType.FUNCTION_PARAM_REQUIRED_ADD,
|
||||
REDUCE_PARAM: ApiDiffType.FUNCTION_PARAM_REDUCE,
|
||||
PARAM_TYPE_CHANGE: ApiDiffType.FUNCTION_PARAM_TYPE_CHANGE,
|
||||
PARAM_TYPE_ADD: ApiDiffType.FUNCTION_PARAM_TYPE_ADD,
|
||||
PARAM_TYPE_REDUCE: ApiDiffType.FUNCTION_PARAM_TYPE_REDUCE,
|
||||
PARAM_TO_UNREQUIRED: ApiDiffType.FUNCTION_PARAM_TO_UNREQUIRED,
|
||||
PARAM_TO_REQUIRED: ApiDiffType.FUNCTION_PARAM_TO_REQUIRED,
|
||||
PARAM_CHANGE: ApiDiffType.FUNCTION_PARAM_CHANGE,
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 处理方法节点的参数,获取对应diff信息
|
||||
*
|
||||
@ -653,51 +728,302 @@ export namespace DiffProcessorHelper {
|
||||
* @param {MethodInfo} newApiInfo 新版本的方法节点信息
|
||||
* @return {*} {ApiDiffType[]} 返回各个参数的变化情况
|
||||
*/
|
||||
static diffMethodParams(oldApiInfo: MethodInfo, newApiInfo: MethodInfo): DiffTypeInfo[] {
|
||||
static diffMethodParams(
|
||||
oldApiInfo: MethodInfo | TypeAliasInfo,
|
||||
newApiInfo: MethodInfo | TypeAliasInfo
|
||||
): DiffTypeInfo[] {
|
||||
const diffTypeInfos: DiffTypeInfo[] = [];
|
||||
const diffTypes: ApiDiffType[] = [];
|
||||
const oldMethodParams: ParamInfo[] = oldApiInfo.getParams();
|
||||
const newMethodParams: ParamInfo[] = newApiInfo.getParams();
|
||||
const diffProcessors: ((oldApiInfo: ParamInfo, newApiInfo: ParamInfo) => ApiDiffType | undefined)[] = [
|
||||
ApiNodeDiffHelper.diffMethodParamName,
|
||||
ApiNodeDiffHelper.diffMethodParamType,
|
||||
ApiNodeDiffHelper.diffMethodParamRequired,
|
||||
];
|
||||
const maxLen: number = Math.max(oldMethodParams.length, newMethodParams.length);
|
||||
// 遍历方法参数列表
|
||||
for (let i = 0; i < maxLen; i++) {
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
if (i >= oldMethodParams.length) {
|
||||
const newElement: ParamInfo = newMethodParams[i];
|
||||
const oldParamISRequired: boolean = newElement.getIsRequired();
|
||||
diffTypeInfo
|
||||
.setDiffType(
|
||||
oldParamISRequired ? ApiDiffType.FUNCTION_PARAM_REQUIRED_ADD : ApiDiffType.FUNCTION_PARAM_UNREQUIRED_ADD
|
||||
)
|
||||
.setNewMessage(newElement.getDefinedText());
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
continue;
|
||||
}
|
||||
if (i >= newMethodParams.length) {
|
||||
const oldElement: ParamInfo = oldMethodParams[i];
|
||||
diffTypeInfo.setDiffType(ApiDiffType.FUNCTION_PARAM_REDUCE).setOldMessage(oldElement.getDefinedText());
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
continue;
|
||||
}
|
||||
const oldElement: ParamInfo = oldMethodParams[i];
|
||||
const newElement: ParamInfo = newMethodParams[i];
|
||||
diffTypeInfo.setOldMessage(oldElement.getDefinedText()).setNewMessage(newElement.getDefinedText());
|
||||
for (let j = 0; j < diffProcessors.length; j++) {
|
||||
const apiSceneDiffProcessor = diffProcessors[j];
|
||||
const diffType: ApiDiffType | undefined = apiSceneDiffProcessor(oldElement, newElement);
|
||||
if (!diffType) {
|
||||
continue;
|
||||
}
|
||||
diffTypeInfos.push(diffTypeInfo.setDiffType(diffType));
|
||||
}
|
||||
}
|
||||
const isTypeAlias: boolean = oldApiInfo.getApiType() === 'TypeAlias';
|
||||
const oldMethodParams: ParamInfo[] = isTypeAlias
|
||||
? (oldApiInfo as TypeAliasInfo).getParamInfos()
|
||||
: (oldApiInfo as MethodInfo).getParams();
|
||||
const newMethodParams: ParamInfo[] = isTypeAlias
|
||||
? (newApiInfo as TypeAliasInfo).getParamInfos()
|
||||
: (newApiInfo as MethodInfo).getParams();
|
||||
const diffMethodType: DiffMethodType & DiffTypeChangeType = ApiNodeDiffHelper.getDiffMethodTypes(isTypeAlias);
|
||||
|
||||
ApiNodeDiffHelper.diffParamsPosition(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
ApiNodeDiffHelper.diffNewOptionalParam(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
ApiNodeDiffHelper.diffNewRequiredParam(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
ApiNodeDiffHelper.diffReducedParam(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
ApiNodeDiffHelper.diffParamTypeChange(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
ApiNodeDiffHelper.diffParamChange(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
ApiNodeDiffHelper.diffMethodParamChange(oldMethodParams, newMethodParams, diffTypeInfos, diffMethodType);
|
||||
return diffTypeInfos;
|
||||
}
|
||||
/**
|
||||
* 方法参数名变化,且不属于新增、减少的情况,归纳为方法参数变化,
|
||||
*
|
||||
* @param {ParamInfo[]} oldMethodParams 函数旧参数节点信息
|
||||
* @param {ParamInfo[]} newMethodParams 函数新参数节点信息
|
||||
* @param diffTypeInfos 处理好的结果信息
|
||||
*/
|
||||
static diffMethodParamChange(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType
|
||||
) {
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
// 1.新旧版本参数一个不存在即不符合,直接返回
|
||||
if (!oldParamLen || !newParamLen) return;
|
||||
// 2. 判断新旧版本参数名称相同的参数的个数和新旧版本的参数是否相同,相同即为新增或者减少参数
|
||||
// 2.1 循环得到所有的参数名称
|
||||
const oldParamNames: string[] = [],
|
||||
newParamNames: string[] = [];
|
||||
for (let i: number = 0; i < Math.max(oldParamLen, newParamLen); i++) {
|
||||
const newCur: ParamInfo = newMethodParams[i];
|
||||
const oldCur: ParamInfo = oldMethodParams[i];
|
||||
newCur && newParamNames.push(newCur.getApiName());
|
||||
oldCur && oldParamNames.push(oldCur.getApiName());
|
||||
}
|
||||
// 2.2 找出旧版本不同的参数名称
|
||||
const oldDiffParams: ParamInfo[] = oldMethodParams.filter(
|
||||
(oldParam: ParamInfo) => !newParamNames.includes(oldParam.getApiName())
|
||||
);
|
||||
// 2.3 得到参数相同的个数
|
||||
const sameParamsLength: number = oldParamLen - oldDiffParams.length;
|
||||
// 2.4 判断新旧版本参数名称相同的参数的个数和新旧版本的参数是否相同,相同即为新增或者减少参数
|
||||
if (sameParamsLength === oldParamLen || sameParamsLength === newParamLen) return;
|
||||
|
||||
let oldDiffInfos: ParamInfo[] = oldMethodParams;
|
||||
let newDiffInfos: ParamInfo[] = newMethodParams;
|
||||
// 3.将新旧版本参数信息中前面检查出来的信息去掉
|
||||
diffTypeInfos.forEach((diffInfo: DiffTypeInfo) => {
|
||||
// 循环已经得到的结果信息,找到新旧版本里不在已经得到的结果信息里面的参数信息
|
||||
oldDiffInfos = oldDiffInfos.filter(
|
||||
(oldDiffInfo: ParamInfo) => diffInfo.getOldMessage() !== oldDiffInfo.getDefinedText()
|
||||
);
|
||||
newDiffInfos = newDiffInfos.filter(
|
||||
(newDiffInfo: ParamInfo) => diffInfo.getNewMessage() !== newDiffInfo.getDefinedText()
|
||||
);
|
||||
});
|
||||
// 4.剩下的部分就是发生变化的部分,生成返回信息
|
||||
const oldNamesStr: string = stitchMethodParameters(oldDiffInfos);
|
||||
const newNamesStr: string = stitchMethodParameters(newDiffInfos);
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setDiffType(diffMethodType.PARAM_CHANGE).setOldMessage(oldNamesStr).setNewMessage(newNamesStr);
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
/**
|
||||
* 比较函数位置发生变化
|
||||
*
|
||||
* @param {ParamInfo[]} oldMethodParams 函数旧参数节点信息
|
||||
* @param {ParamInfo[]} newMethodParams 函数新参数节点信息
|
||||
* @param diffTypeInfos
|
||||
*/
|
||||
static diffParamsPosition(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType
|
||||
) {
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
// 1.如果旧版本的参数长度不大于1,或者两者长度不一致,直接返回
|
||||
if (oldParamLen <= 1 || oldParamLen !== newParamLen) return;
|
||||
// 2.判断两个版本的相同位置的参数名称是否一致,相同直接返回
|
||||
const isSamePosition: boolean = checkIsSameOfSamePosition(newMethodParams, oldMethodParams);
|
||||
if (isSamePosition) return;
|
||||
// 3.如果旧版本的参数不完全包含新版本的参数或者两个版本的参数是否完全一致,一个不符合直接返回
|
||||
const isContain: boolean = checkIsContain(oldMethodParams, newMethodParams);
|
||||
if (!isContain) return;
|
||||
// 4.上述情况都不符合,处理返回信息
|
||||
const oldNamesStr: string = stitchMethodParameters(oldMethodParams);
|
||||
const newNamesStr: string = stitchMethodParameters(newMethodParams);
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setDiffType(diffMethodType.POS_CHANGE).setOldMessage(oldNamesStr).setNewMessage(newNamesStr);
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 函数新增可选参数
|
||||
*
|
||||
* @param oldMethodParams
|
||||
* @param newMethodParams
|
||||
* @param diffTypeInfos
|
||||
*/
|
||||
static diffNewOptionalParam(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType
|
||||
) {
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
// 1.如果新版本参数为空或者旧版本参数长度大于或者等于新版本参数长度,直接返回
|
||||
if (newParamLen === 0 || oldParamLen >= newParamLen) return;
|
||||
// 2.新版本参数需要完全包含旧版本,如果不包含,直接返回
|
||||
const isContain: boolean = checkIsContain(newMethodParams, oldMethodParams);
|
||||
if (!isContain) return;
|
||||
// 3.是否存在新增的可选参数
|
||||
const oldParamNames: string[] = oldMethodParams.map((oldParam: ParamInfo) => oldParam.getApiName());
|
||||
const addParams: ParamInfo[] = newMethodParams.filter((newParam: ParamInfo) => {
|
||||
const curParamName: string = newParam.getApiName();
|
||||
return !oldParamNames.includes(curParamName) && !newParam.getIsRequired();
|
||||
});
|
||||
// 4.新版本新增的参数是否存在参数是可选类型,不存在直接返回
|
||||
if (!addParams.length) return;
|
||||
// 5.存在新增的参数是可选参数,处理返回信息
|
||||
const addParamNamesStr: string = stitchMethodParameters(addParams);
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setOldMessage('').setDiffType(diffMethodType.ADD_OPTIONAL_PARAM).setNewMessage(addParamNamesStr);
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数新增必选参数
|
||||
*
|
||||
* @param oldMethodParams
|
||||
* @param newMethodParams
|
||||
* @param diffTypeInfos
|
||||
*/
|
||||
static diffNewRequiredParam(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType
|
||||
) {
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
// 1.如果新版本参数为空或者旧版本参数长度大于或者等于新版本参数长度,直接返回
|
||||
if (newParamLen === 0 || oldParamLen >= newParamLen) return;
|
||||
// 2.新版本参数需要完全包含旧版本,如果不包含,直接返回
|
||||
const isContain: boolean = checkIsContain(newMethodParams, oldMethodParams);
|
||||
if (!isContain) return;
|
||||
// 3.是否存在新增的必选参数
|
||||
const oldParamNames: string[] = oldMethodParams.map((oldParam: ParamInfo) => oldParam.getApiName());
|
||||
const addParams: ParamInfo[] = newMethodParams.filter((newParam: ParamInfo) => {
|
||||
const curParamName: string = newParam.getApiName();
|
||||
return !oldParamNames.includes(curParamName) && newParam.getIsRequired();
|
||||
});
|
||||
// 4.新版本新增的参数是否存在参数是必选类型,不存在直接返回
|
||||
if (!addParams.length) return;
|
||||
// 5.存在新增的参数是可选参数,处理返回信息
|
||||
const addParamNamesStr: string = stitchMethodParameters(addParams);
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setDiffType(diffMethodType.ADD_REQUIRED_PARAM).setOldMessage('').setNewMessage(addParamNamesStr);
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 函数删除参数
|
||||
*
|
||||
* @param oldMethodParams
|
||||
* @param newMethodParams
|
||||
* @param diffTypeInfos
|
||||
*/
|
||||
static diffReducedParam(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType
|
||||
) {
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
// 1.旧版本参数为空或者新版本参数长度大于或者等于旧版本参数长度,直接返回
|
||||
if (oldParamLen === 0 || newParamLen >= oldParamLen) return;
|
||||
// 2.如果旧版本的参数不包含新版本的参数,直接返回
|
||||
const isContain: boolean = checkIsContain(oldMethodParams, newMethodParams);
|
||||
if (newParamLen > 0 && !isContain) return;
|
||||
// 3.参数减少,处理返回信息
|
||||
const newParamNames: string[] = newMethodParams.map((newParam: ParamInfo) => newParam.getApiName());
|
||||
const reduceParams: ParamInfo[] = oldMethodParams.filter(
|
||||
(oldParam: ParamInfo) => !newParamNames.includes(oldParam.getApiName())
|
||||
);
|
||||
const reduceNamesStr: string = stitchMethodParameters(reduceParams);
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setDiffType(diffMethodType.REDUCE_PARAM).setOldMessage(reduceNamesStr).setNewMessage('');
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
/**
|
||||
* 比较参数必选/可选的变更,(可选->必选,必选->可选)
|
||||
*
|
||||
* @param oldMethodParams
|
||||
* @param newMethodParams
|
||||
* @param diffTypeInfos
|
||||
*/
|
||||
static diffParamChange(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType
|
||||
) {
|
||||
// 1.新旧版本的参数长度应大于0
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
if (!oldParamLen || !newParamLen) return;
|
||||
// 2.找到参数名称一致和参数类型一致的参数进行比较,不存在直接返回
|
||||
const sameParamInfos: ParamInfo[] = oldMethodParams.filter((oldParam: ParamInfo) => {
|
||||
const oldParamName: string = oldParam.getApiName();
|
||||
return newMethodParams.find((newParam: ParamInfo) => newParam.getApiName() === oldParamName);
|
||||
});
|
||||
if (!sameParamInfos.length) return;
|
||||
// 3.比较参数名和类型一致是否发生了可选/必选的变化,参数类型不需要计较
|
||||
sameParamInfos.forEach((sameInfo: ParamInfo, idx: number) => {
|
||||
const curOldParamName: string = sameInfo.getApiName();
|
||||
const curNewParam: ParamInfo = newMethodParams.find(
|
||||
(newParam: ParamInfo) => newParam.getApiName() === curOldParamName
|
||||
)!;
|
||||
if (curNewParam.getIsRequired() !== sameInfo.getIsRequired()) {
|
||||
// 参数发生了可选/必选的变化,处理返回信息
|
||||
const oldMessage = sameInfo.getDefinedText();
|
||||
const newMessage = curNewParam.getDefinedText();
|
||||
const changeType: number = sameInfo.getIsRequired()
|
||||
? diffMethodType.PARAM_TO_UNREQUIRED
|
||||
: diffMethodType.PARAM_TO_REQUIRED;
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setDiffType(changeType).setOldMessage(oldMessage).setNewMessage(newMessage);
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 比较参数类型的变更,(参数类型范围扩大/参数类型范围缩小/参数类型变更)
|
||||
*
|
||||
* @param oldMethodParams
|
||||
* @param newMethodParams
|
||||
* @param diffTypeInfos
|
||||
*/
|
||||
static diffParamTypeChange(
|
||||
oldMethodParams: ParamInfo[],
|
||||
newMethodParams: ParamInfo[],
|
||||
diffTypeInfos: DiffTypeInfo[],
|
||||
diffMethodType: DiffMethodType & DiffTypeChangeType
|
||||
) {
|
||||
//1.判断新旧版本参数长度大于0
|
||||
const oldParamLen: number = oldMethodParams.length;
|
||||
const newParamLen: number = newMethodParams.length;
|
||||
if (!oldParamLen || !newParamLen) return;
|
||||
const newParamName: string[] = newMethodParams.map((newParam: ParamInfo) => newParam.getApiName());
|
||||
// 2.需要新旧版本存在参数名称一致的,不存在直接返回
|
||||
const sameParamInfo: ParamInfo[] = oldMethodParams.filter((oldParam: ParamInfo) =>
|
||||
newParamName.includes(oldParam.getApiName())
|
||||
);
|
||||
if (!sameParamInfo.length) return;
|
||||
// 3.寻找参数名称相同的情况下的参数类型变化的
|
||||
sameParamInfo.forEach((curSame: ParamInfo, idx: number) => {
|
||||
const oldParamTypes: string[] = curSame.getType();
|
||||
const curNewParam: ParamInfo = newMethodParams.find(
|
||||
(newParam: ParamInfo) => newParam.getApiName() === curSame.getApiName()
|
||||
)!;
|
||||
const newParamTypes: string[] = curNewParam.getType();
|
||||
// 处理参数类型不一样的,生成返回信息
|
||||
if (oldParamTypes.toString() !== newParamTypes.toString()) {
|
||||
// 根据参数的差异来获取对应的statusCode
|
||||
const diffType: number = diffChangeType(oldParamTypes, newParamTypes, diffMethodType);
|
||||
const oldMessage: string = curSame.getDefinedText();
|
||||
const newMessage: string = curNewParam.getDefinedText();
|
||||
const diffTypeInfo: DiffTypeInfo = new DiffTypeInfo();
|
||||
diffTypeInfo.setDiffType(diffType).setOldMessage(oldMessage).setNewMessage(newMessage);
|
||||
diffTypeInfos.push(diffTypeInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理方法节点的参数名称
|
||||
@ -970,10 +1296,30 @@ export namespace DiffProcessorHelper {
|
||||
const diffInfo: BasicDiffInfo = DiffProcessorHelper.wrapDiffInfo(oldApiInfo, newApiInfo, diffTypeInfo);
|
||||
diffInfos.push(diffInfo);
|
||||
});
|
||||
// 自定义类型为方法
|
||||
if ((oldApiInfo as TypeAliasInfo).getTypeIsFunction()) {
|
||||
const diffTypeInfos: DiffTypeInfo[] = ApiNodeDiffHelper.diffMethodParams(
|
||||
oldApiInfo as TypeAliasInfo,
|
||||
newApiInfo as TypeAliasInfo
|
||||
);
|
||||
const diffTypeReturnInfo: DiffTypeInfo | undefined = ApiNodeDiffHelper.diffTypeAliasReturnType(
|
||||
oldApiInfo as TypeAliasInfo,
|
||||
newApiInfo as TypeAliasInfo
|
||||
);
|
||||
diffTypeReturnInfo && diffTypeInfos.push(diffTypeReturnInfo);
|
||||
diffTypeInfos.forEach((info: DiffTypeInfo) => {
|
||||
const diffInfo: BasicDiffInfo = DiffProcessorHelper.wrapDiffInfo(
|
||||
oldApiInfo,
|
||||
newApiInfo,
|
||||
info.setStatusCode(ApiStatusCode.TYPE_CHNAGES)
|
||||
);
|
||||
diffInfos.push(diffInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理自定义类型节点的类型
|
||||
* 处理自定义类型节点的类型(类型值范围扩大/类型值范围缩小/类型值改变)
|
||||
*
|
||||
* @param {TypeAliasInfo} oldApiInfo 旧版本的自定义类型节点信息
|
||||
* @param {TypeAliasInfo} newApiInfo 新版本的自定义类型节点信息
|
||||
@ -985,19 +1331,24 @@ export namespace DiffProcessorHelper {
|
||||
const newTypeAliasType: string[] = newApiInfo.getType();
|
||||
const olaTypeAliasTypeStr: string = olaTypeAliasType.toString();
|
||||
const newTypeAliasTypeStr: string = newTypeAliasType.toString();
|
||||
if (olaTypeAliasTypeStr === newTypeAliasTypeStr) {
|
||||
return undefined;
|
||||
}
|
||||
diffTypeInfo.setOldMessage(olaTypeAliasTypeStr).setNewMessage(newTypeAliasTypeStr);
|
||||
if (StringUtils.hasSubstring(newTypeAliasTypeStr, olaTypeAliasTypeStr)) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.TYPE_ALIAS_ADD);
|
||||
}
|
||||
if (StringUtils.hasSubstring(olaTypeAliasTypeStr, newTypeAliasTypeStr)) {
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.TYPE_ALIAS_REDUCE);
|
||||
}
|
||||
return diffTypeInfo.setDiffType(ApiDiffType.TYPE_ALIAS_CHANGE);
|
||||
// 1.两者定义相同,没有变化
|
||||
if (olaTypeAliasTypeStr === newTypeAliasTypeStr) return;
|
||||
// 自定义函数类型
|
||||
if (oldApiInfo.getTypeIsFunction()) return;
|
||||
// 2.两者定义不同
|
||||
const diffMethodType: DiffTypeChangeType = {
|
||||
PARAM_TYPE_CHANGE: ApiDiffType.TYPE_ALIAS_CHANGE,
|
||||
PARAM_TYPE_ADD: ApiDiffType.TYPE_ALIAS_ADD,
|
||||
PARAM_TYPE_REDUCE: ApiDiffType.TYPE_ALIAS_REDUCE,
|
||||
};
|
||||
const diffType: number = diffChangeType(olaTypeAliasType, newTypeAliasType, diffMethodType);
|
||||
diffTypeInfo
|
||||
.setOldMessage(olaTypeAliasType.join(' | '))
|
||||
.setNewMessage(newTypeAliasType.join(' | '))
|
||||
.setStatusCode(ApiStatusCode.TYPE_CHNAGES)
|
||||
.setDiffType(diffType);
|
||||
return diffTypeInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理枚举值节点,获取对应diff信息
|
||||
*
|
||||
@ -1080,6 +1431,101 @@ export namespace DiffProcessorHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查父集是否完全包含子集
|
||||
*
|
||||
* @param {ParamInfo[]} parentInfos 父集节点信息
|
||||
* @param {ParamInfo[]} childInfos 子集节点信息
|
||||
* @returns {*} {boolean} 完全包含为true, 否则为false
|
||||
*/
|
||||
function checkIsContain(parentInfos: ParamInfo[], childInfos: ParamInfo[]): boolean {
|
||||
return childInfos.every((child: ParamInfo) => {
|
||||
const curChildName = child.getApiName();
|
||||
// 父节点里面是否存在子节点的参数名称
|
||||
const curParentNode = parentInfos.find((item: ParamInfo) => item.getApiName() === curChildName);
|
||||
// 相同参数的类型是否一样
|
||||
return curParentNode && curParentNode.getApiType() === child.getApiType();
|
||||
});
|
||||
}
|
||||
|
||||
function checkParentContainChild(parentStrArr: string[], childStrArr: string[]): boolean {
|
||||
return childStrArr.every((child: string) => parentStrArr.includes(child));
|
||||
}
|
||||
|
||||
interface DiffTypeChangeType {
|
||||
PARAM_TYPE_CHANGE: ApiDiffType;
|
||||
PARAM_TYPE_ADD: ApiDiffType;
|
||||
PARAM_TYPE_REDUCE: ApiDiffType;
|
||||
}
|
||||
// statusCode对应的几种变化类型
|
||||
interface DiffMethodType {
|
||||
POS_CHANGE: ApiDiffType;
|
||||
ADD_OPTIONAL_PARAM: ApiDiffType;
|
||||
ADD_REQUIRED_PARAM: ApiDiffType;
|
||||
REDUCE_PARAM: ApiDiffType;
|
||||
PARAM_TO_UNREQUIRED: ApiDiffType;
|
||||
PARAM_TO_REQUIRED: ApiDiffType;
|
||||
PARAM_CHANGE: ApiDiffType;
|
||||
}
|
||||
/**
|
||||
* 根据参数的差异来获取对应的statusCode
|
||||
*
|
||||
* @param {string[]} oldTypes 旧参数数组
|
||||
* @param {string[]} newTypes 新参数数组
|
||||
* @returns {*} {ApiDiffType} statusCode
|
||||
*/
|
||||
function diffChangeType(oldTypes: string[], newTypes: string[], diffTypes: DiffTypeChangeType): ApiDiffType {
|
||||
const oldLen: number = oldTypes.length;
|
||||
const newLen: number = newTypes.length;
|
||||
switch (oldLen - newLen) {
|
||||
case 0:
|
||||
return diffTypes.PARAM_TYPE_CHANGE;
|
||||
case -newLen:
|
||||
return diffTypes.PARAM_TYPE_ADD;
|
||||
case oldLen:
|
||||
return diffTypes.PARAM_TYPE_REDUCE;
|
||||
default:
|
||||
if (oldLen > newLen) {
|
||||
return newTypes.every((type: string) => oldTypes.includes(type))
|
||||
? diffTypes.PARAM_TYPE_REDUCE
|
||||
: diffTypes.PARAM_TYPE_CHANGE;
|
||||
} else {
|
||||
return oldTypes.every((type: string) => newTypes.includes(type))
|
||||
? diffTypes.PARAM_TYPE_ADD
|
||||
: diffTypes.PARAM_TYPE_CHANGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 检查两个版本的相同位置的参数的参数名是否相同
|
||||
*
|
||||
* @param {ParamInfo[]} parentInfos 父节点信息
|
||||
* @param {ParamInfo[]} childInfos 子集节点信息
|
||||
* @returns {*} {boolean} 完全相同为true, 否则为false
|
||||
*/
|
||||
function checkIsSameOfSamePosition(parentInfos: ParamInfo[], childInfos: ParamInfo[]): boolean {
|
||||
return parentInfos.every((curParentItem: ParamInfo, idx: number) => {
|
||||
const curChildItem: ParamInfo = childInfos[idx];
|
||||
return curParentItem.getApiName() === curChildItem.getApiName();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前节点信息来拼接返回的新旧信息
|
||||
*
|
||||
* @param {ParamInfo} methodParams 函数参数的节点信息
|
||||
* @returns {*} {string} 字符串拼接后的节点信息
|
||||
*/
|
||||
function stitchMethodParameters(methodParams: ParamInfo[]): string {
|
||||
return methodParams.reduce((preStr: string, curItem: ParamInfo, idx: number) => {
|
||||
let curStr: string = curItem.getDefinedText();
|
||||
if (idx !== methodParams.length - 1) {
|
||||
curStr += ', ';
|
||||
}
|
||||
return (preStr += curStr);
|
||||
}, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据节点信息和type生成需要的diff对象
|
||||
*
|
||||
@ -1093,6 +1539,15 @@ export namespace DiffProcessorHelper {
|
||||
newApiInfo: BasicApiInfo | undefined = undefined,
|
||||
diffTypeInfo: DiffTypeInfo
|
||||
): BasicDiffInfo {
|
||||
const newPropertyInfo = newApiInfo as PropertyInfo;
|
||||
let isCompatible = true;
|
||||
if (
|
||||
newApiInfo?.getParentApiType() === ApiType.INTERFACE && diffTypeInfo.getDiffType() === ApiDiffType.ADD &&
|
||||
((newApiInfo?.getApiType() === ApiType.PROPERTY && newPropertyInfo.getIsRequired()) ||
|
||||
newApiInfo?.getApiType() === ApiType.METHOD)
|
||||
) {
|
||||
isCompatible = false;
|
||||
}
|
||||
const diffInfo: BasicDiffInfo = new BasicDiffInfo();
|
||||
const diffType: ApiDiffType = diffTypeInfo.getDiffType();
|
||||
if (oldApiInfo) {
|
||||
@ -1104,8 +1559,8 @@ export namespace DiffProcessorHelper {
|
||||
diffInfo
|
||||
.setDiffType(diffType)
|
||||
.setDiffMessage(diffMap.get(diffType) as string)
|
||||
.setIsCompatible(!incompatibleApiDiffTypes.has(diffType))
|
||||
.setStatusCode(diffTypeInfo.getStatusCode())
|
||||
.setIsCompatible(!isCompatible ? false: !incompatibleApiDiffTypes.has(diffType))
|
||||
.setOldDescription(diffTypeInfo.getOldMessage())
|
||||
.setNewDescription(diffTypeInfo.getNewMessage());
|
||||
return diffInfo;
|
||||
|
@ -276,11 +276,18 @@ export class NodeProcessorHelper {
|
||||
if (
|
||||
ts.isInterfaceDeclaration(node) ||
|
||||
ts.isClassDeclaration(node) ||
|
||||
ts.isEnumDeclaration(node) ||
|
||||
ts.isStructDeclaration(node)
|
||||
ts.isEnumDeclaration(node)
|
||||
) {
|
||||
return node.members;
|
||||
}
|
||||
if (ts.isStructDeclaration(node)) {
|
||||
return ts.visitNodes(node.members, (node) => {
|
||||
if (ts.isConstructorDeclaration(node)) {
|
||||
return
|
||||
}
|
||||
return node
|
||||
})
|
||||
}
|
||||
if (ts.isTypeAliasDeclaration(node) && ts.isTypeLiteralNode(node.type)) {
|
||||
return node.type.members;
|
||||
}
|
||||
@ -958,9 +965,10 @@ export class NodeProcessorHelper {
|
||||
if (ts.isFunctionTypeNode(nodeType)) {
|
||||
const typeParameters = nodeType.parameters;
|
||||
typeParameters.forEach((typeParameter: ts.ParameterDeclaration) => {
|
||||
const typeParamInfo: TypeParamInfo = new TypeParamInfo();
|
||||
typeParamInfo.setParamName(typeParameter.name.getText());
|
||||
typeParamInfo.setParamType(typeParameter.type?.getText());
|
||||
const typeParamInfo: ParamInfo = NodeProcessorHelper.processParam(
|
||||
typeParameter,
|
||||
new MethodInfo(ApiType.METHOD, node, parentApi)
|
||||
);
|
||||
typeAliasInfo.setParamInfos(typeParamInfo);
|
||||
});
|
||||
typeAliasInfo.setReturnType(nodeType.type.getText());
|
||||
|
@ -1,22 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* Licensed under the Apache License, Version 2.0 (the 'License');
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* distributed under the License is distributed on an 'AS IS' BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import ts from 'typescript';
|
||||
import { ApiDiffType } from '../../typedef/diff/ApiInfoDiff';
|
||||
|
||||
/**
|
||||
* error message type
|
||||
* error message type
|
||||
* @enum { string }
|
||||
*/
|
||||
export enum ErrorType {
|
||||
@ -127,7 +128,7 @@ export enum ErrorMessage {
|
||||
ERROR_USE_INTERFACE = 'The validity verification of the JSDoc tag failed. The [interface] tag and [typedef] tag are not allowed to be used simultaneously. Please confirm the interface class.',
|
||||
ERROR_EVENT_NAME_STRING = 'The event name should be string.',
|
||||
ERROR_EVENT_NAME_NULL = 'The event name cannot be Null value.',
|
||||
ERROR_EVENT_NAME_SMALL_HUMP = "The event name should be named by small hump. (Received ['$$']).",
|
||||
ERROR_EVENT_NAME_SMALL_HUMP = 'The event name should be named by small hump. (Received ["$$"]).',
|
||||
ERROR_EVENT_CALLBACK_OPTIONAL = 'The callback parameter of off function should be optional.',
|
||||
ERROR_EVENT_CALLBACK_MISSING = 'The off functions of one single event should have at least one callback parameter, and the callback parameter should be the last parameter.',
|
||||
ERROR_EVENT_ON_AND_OFF_PAIR = 'The on and off event subscription methods do not appear in pair.',
|
||||
@ -143,66 +144,101 @@ export enum ErrorMessage {
|
||||
ERROR_SMALL_HUMP_NAME_FILE = 'This API file should be named by small hump.',
|
||||
ERROR_LARGE_HUMP_NAME_FILE = 'This API file should be named by large hump.',
|
||||
ERROR_ANONYMOUS_FUNCTION ='Anonymous functions or anonymous object that are not allowed are used in this api.',
|
||||
ERROR_CHANGES_JSDOC_LEVEL = 'Forbid changes: API defectLevel change to system.',
|
||||
ERROR_CHANGES_JSDOC_MODEL = 'Forbid changes: API mode change.',
|
||||
ERROR_CHANGES_JSDOC_CARD = 'Forbid changes: API card delete.',
|
||||
ERROR_CHANGES_JSDOC_CROSS_PLATFORM = 'Forbid changes: API crossplatform delete.',
|
||||
ERROR_CHANGES_JSDOC_ERROR_CODE = 'Forbid changes: API errorcode cannot be created or modified.',
|
||||
ERROR_CHANGES_JSDOC_PERMISSION = 'Forbid changes: Permission tag cannot be created or modified.',
|
||||
ERROR_CHANGES_API_NAME = 'Forbid changes: API cannot be changed.',
|
||||
ERROR_CHANGES_FUNCTION_RETURN_TYPE = 'Forbid changes: Function return type cannot be changed.',
|
||||
ERROR_CHANGES_API_PARAM = 'Forbid changes: Parameters cannot be changed.',
|
||||
ERROR_CHANGES_PROPERTY = 'Forbid changes: Property cannot be changed.',
|
||||
ERROR_CHANGES_CONSTANT = 'Forbid changes: Constant value cannot be changed.',
|
||||
ERROR_CHANGES_TYPE_ALIAS = 'Forbid changes: Type alias cannot be changed.',
|
||||
ERROR_CHANGES_ENUM_MEMBER = 'Forbid changes: Enum number value cannot be changed.',
|
||||
ERROR_CHANGES_API = 'Forbid changes: API cannot be deleted.',
|
||||
ERROR_CHANGES_JSDOC_CHANGE = 'Forbid changes: Historical JSDoc cannot be changed.',
|
||||
ERROR_CHANGES_JSDOC_NUMBER = 'Forbid changes: API changes must add a new section of JSDoc.',
|
||||
ERROR_NO_JSDOC = 'Jsdoc needs to be added to the current API.',
|
||||
ERROR_NO_JSDOC_TAG = 'add tags to the Jsdoc.',
|
||||
ERROR_HAS_CHINESE= 'Jsdoc has chinese.',
|
||||
ERROR_ERROR_CODE = 'The generic error code does not contain the current error code.'
|
||||
ERROR_ERROR_CODE = 'The generic error code does not contain the current error code.',
|
||||
ERROR_CHANGES_JSDOC_LEVEL = 'Forbid changes: Cannot change from public API to system API.',
|
||||
ERROR_CHANGES_JSDOC_PERMISSION_RANGE = 'Forbid changes: Cannot reduce or permission or increase and permission.',
|
||||
ERROR_CHANGES_JSDOC_PERMISSION_VALUE = 'Forbid changes: Cannot change permission value,cannot judge the range change.',
|
||||
ERROR_CHANGES_JSDOC_ERROR_CODE_ADD = 'Forbid changes: The number of error codes cannot be increased from 0 to multiple error codes.',
|
||||
ERROR_CHANGES_JSDOC_ERROR_CODE_VALUE = 'Forbid changes: Cannot change the error code value.',
|
||||
ERROR_CHANGES_JSDOC_CARD = 'Forbid changes: The card application cannot be changed from supported to not supported.',
|
||||
ERROR_CHANGES_JSDOC_CROSS_PLATFORM = 'Forbid changes: Crossplatform cannot be changed from supported to not supported.',
|
||||
ERROR_CHANGES_JSDOC_API_DELETE = 'Forbid changes: API cannot be deleted.',
|
||||
ERROR_CHANGES_JSDOC_FA_TO_STAGE = 'Forbid changes: Cannot change from FAModelOnly to StageModelOnly.',
|
||||
ERROR_CHANGES_JSDOC_STAGE_TO_FA = 'Forbid changes: Cannot change from StageModelOnly to FAModelOnly.',
|
||||
ERROR_CHANGES_JSDOC_NA_TO_STAGE = 'Forbid changes: Cannot change from nothing to StageModelOnly.',
|
||||
ERROR_CHANGES_JSDOC_NA_TO_FA = 'Forbid changes: Cannot change from nothing to FAModelOnly.',
|
||||
ERROR_CHANGES_FUNCTION_RETURN_TYPE_ADD = 'Forbid changes: The function return value type cannot be extended.',
|
||||
ERROR_CHANGES_FUNCTION_RETURN_TYPE_REDUCE = 'Forbid changes: The function return value type cannot be reduced.',
|
||||
ERROR_CHANGES_FUNCTION_RETURN_TYPE_CHANGE = 'Forbid changes: Cannot change function return value type.',
|
||||
ERROR_CHANGES_FUNCTION_PARAM_POS_CHANGE = 'Forbid changes: Cannot change function param position.',
|
||||
ERROR_CHANGES_FUNCTION_PARAM_REQUIRED_ADD = 'Forbid changes: Cannot add function required param.',
|
||||
ERROR_CHANGES_FUNCTION_PARAM_REDUCE = 'Forbid changes: Cannot delete function param.',
|
||||
ERROR_CHANGES_FUNCTION_PARAM_TO_REQUIRED = 'Forbid changes: Cannot change form unrequired param to required param.',
|
||||
ERROR_CHANGES_FUNCTION_PARAM_TYPE = 'Forbid changes: Cannot change function param type.',
|
||||
ERROR_CHANGES_FUNCTION_PARAM_TYPE_REDUCE = 'Forbid changes: The function param type range is cannot be reduced.',
|
||||
ERROR_CHANGES_PROPERTY_READONLY_TO_REQUIRED = 'Forbid changes: Read-only properties cannot be changed from optional to required.',
|
||||
ERROR_CHANGES_PROPERTY_WRITABLE_TO_UNREQUIRED = 'Forbid changes: Writable properties cannot be changed from required to optional.',
|
||||
ERROR_CHANGES_PROPERTY_WRITABLE_TO_REQUIRED = 'Forbid changes: Writable properties cannot be changed from optional to required.',
|
||||
ERROR_CHANGES_PROPERTY_TYPE_CHANGE = 'Forbid changes: Cannot change property type.',
|
||||
ERROR_CHANGES_PROPERTY_READONLY_ADD = 'Forbid changes: Cannot Expand the range of readonly property types.',
|
||||
ERROR_CHANGES_PROPERTY_WRITABLE_ADD = 'Forbid changes: Cannot Expand the range of writable property types.',
|
||||
ERROR_CHANGES_PROPERTY_WRITABLE_REDUCE = 'Forbid changes: Cannot reduce the range of writable property types.',
|
||||
ERROR_CHANGES_DELETE_DECORATOR = 'Forbid changes: Decorator cannot be deleted.',
|
||||
ERROR_CHANGES_CONSTANT_VALUE = 'Forbid changes: Cannot change constant value.',
|
||||
ERROR_CHANGES_TYPE_ALIAS_VALUE = 'Forbid changes: Cannot change custom type value.',
|
||||
ERROR_CHANGES_TYPE_ALIAS_ADD = 'Forbid changes: Cannot expand the range of custom type.',
|
||||
ERROR_CHANGES_TYPE_ALIAS_REDUCE = 'Forbid changes: Cannot reduce the range of custom type.',
|
||||
ERROR_CHANGES_ENUM_MEMBER_VALUE = 'Forbid changes: Cannot change Enumeration assignment.',
|
||||
ERROR_CHANGES_JSDOC_CHANGE = 'Forbid changes: Historical JSDoc cannot be changed.',
|
||||
ERROR_CHANGES_JSDOC_NUMBER = 'Forbid changes: API changes must add a new section of JSDoc.',
|
||||
}
|
||||
|
||||
export const incompatibleApiDiffTypes: Map<ApiDiffType, ErrorMessage> = new Map([
|
||||
[ApiDiffType.PUBLIC_TO_SYSTEM, ErrorMessage.ERROR_CHANGES_JSDOC_LEVEL],
|
||||
[ApiDiffType.NA_TO_STAGE, ErrorMessage.ERROR_CHANGES_JSDOC_MODEL],
|
||||
[ApiDiffType.NA_TO_FA, ErrorMessage.ERROR_CHANGES_JSDOC_MODEL],
|
||||
[ApiDiffType.FA_TO_STAGE, ErrorMessage.ERROR_CHANGES_JSDOC_MODEL],
|
||||
[ApiDiffType.STAGE_TO_FA, ErrorMessage.ERROR_CHANGES_JSDOC_MODEL],
|
||||
[ApiDiffType.CARD_TO_NA, ErrorMessage.ERROR_CHANGES_JSDOC_CARD],
|
||||
[ApiDiffType.CROSS_PLATFORM_TO_NA, ErrorMessage.ERROR_CHANGES_JSDOC_CROSS_PLATFORM],
|
||||
[ApiDiffType.ERROR_CODE_NA_TO_HAVE, ErrorMessage.ERROR_CHANGES_JSDOC_ERROR_CODE],
|
||||
[ApiDiffType.ERROR_CODE_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_ERROR_CODE],
|
||||
[ApiDiffType.PERMISSION_NA_TO_HAVE, ErrorMessage.ERROR_CHANGES_JSDOC_PERMISSION],
|
||||
[ApiDiffType.PERMISSION_RANGE_SMALLER, ErrorMessage.ERROR_CHANGES_JSDOC_PERMISSION],
|
||||
[ApiDiffType.PERMISSION_RANGE_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_PERMISSION],
|
||||
[ApiDiffType.API_NAME_CHANGE, ErrorMessage.ERROR_CHANGES_API_NAME],
|
||||
[ApiDiffType.FUNCTION_RETURN_TYPE_ADD, ErrorMessage.ERROR_CHANGES_FUNCTION_RETURN_TYPE],
|
||||
[ApiDiffType.FUNCTION_RETURN_TYPE_CHANGE, ErrorMessage.ERROR_CHANGES_FUNCTION_RETURN_TYPE],
|
||||
[ApiDiffType.FUNCTION_PARAM_POS_CHANGE, ErrorMessage.ERROR_CHANGES_API_PARAM],
|
||||
[ApiDiffType.FUNCTION_PARAM_REQUIRED_ADD, ErrorMessage.ERROR_CHANGES_API_PARAM],
|
||||
[ApiDiffType.FUNCTION_PARAM_REDUCE, ErrorMessage.ERROR_CHANGES_API_PARAM],
|
||||
[ApiDiffType.FUNCTION_PARAM_TO_REQUIRED, ErrorMessage.ERROR_CHANGES_API_PARAM],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_CHANGE, ErrorMessage.ERROR_CHANGES_API_PARAM],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_REDUCE, ErrorMessage.ERROR_CHANGES_API_PARAM],
|
||||
[ApiDiffType.PROPERTY_READONLY_TO_REQUIRED, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_TO_UNREQUIRED, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_TO_REQUIRED, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.PROPERTY_TYPE_CHANGE, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.PROPERTY_READONLY_ADD, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_ADD, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_REDUCE, ErrorMessage.ERROR_CHANGES_PROPERTY],
|
||||
[ApiDiffType.CONSTANT_VALUE_CHANGE, ErrorMessage.ERROR_CHANGES_CONSTANT],
|
||||
[ApiDiffType.TYPE_ALIAS_CHANGE, ErrorMessage.ERROR_CHANGES_TYPE_ALIAS],
|
||||
[ApiDiffType.TYPE_ALIAS_ADD, ErrorMessage.ERROR_CHANGES_TYPE_ALIAS],
|
||||
[ApiDiffType.TYPE_ALIAS_REDUCE, ErrorMessage.ERROR_CHANGES_TYPE_ALIAS],
|
||||
[ApiDiffType.ENUM_MEMBER_VALUE_CHANGE, ErrorMessage.ERROR_CHANGES_ENUM_MEMBER],
|
||||
[ApiDiffType.REDUCE, ErrorMessage.ERROR_CHANGES_API],
|
||||
[ApiDiffType.HISTORICAL_JSDOC_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_CHANGE],
|
||||
[ApiDiffType.HISTORICAL_API_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_NUMBER],
|
||||
]);
|
||||
export const incompatibleApiDiffTypes: Map<ApiDiffType, ErrorMessage> = new Map(
|
||||
[
|
||||
[ApiDiffType.HISTORICAL_JSDOC_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_CHANGE],
|
||||
[ApiDiffType.HISTORICAL_API_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_NUMBER],
|
||||
// 1.访问级别变更
|
||||
[ApiDiffType.PUBLIC_TO_SYSTEM, ErrorMessage.ERROR_CHANGES_JSDOC_LEVEL],
|
||||
// 2.权限变更
|
||||
[ApiDiffType.PERMISSION_NA_TO_HAVE, ErrorMessage.ERROR_CHANGES_JSDOC_PERMISSION_VALUE],
|
||||
[ApiDiffType.PERMISSION_RANGE_SMALLER, ErrorMessage.ERROR_CHANGES_JSDOC_PERMISSION_RANGE],
|
||||
[ApiDiffType.PERMISSION_RANGE_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_PERMISSION_VALUE],
|
||||
// 3.错误码变更
|
||||
[ApiDiffType.ERROR_CODE_NA_TO_HAVE, ErrorMessage.ERROR_CHANGES_JSDOC_ERROR_CODE_ADD],
|
||||
[ApiDiffType.ERROR_CODE_CHANGE, ErrorMessage.ERROR_CHANGES_JSDOC_ERROR_CODE_VALUE],
|
||||
// 4.是否支持卡片应用
|
||||
[ApiDiffType.CARD_TO_NA, ErrorMessage.ERROR_CHANGES_JSDOC_CARD],
|
||||
// 5.是否支持跨平台
|
||||
[ApiDiffType.CROSS_PLATFORM_TO_NA, ErrorMessage.ERROR_CHANGES_JSDOC_CROSS_PLATFORM],
|
||||
// 7.api删除
|
||||
[ApiDiffType.REDUCE, ErrorMessage.ERROR_CHANGES_JSDOC_API_DELETE],
|
||||
// 8.模型使用限制变更
|
||||
[ApiDiffType.FA_TO_STAGE, ErrorMessage.ERROR_CHANGES_JSDOC_FA_TO_STAGE],
|
||||
[ApiDiffType.STAGE_TO_FA, ErrorMessage.ERROR_CHANGES_JSDOC_STAGE_TO_FA],
|
||||
[ApiDiffType.NA_TO_STAGE, ErrorMessage.ERROR_CHANGES_JSDOC_NA_TO_STAGE],
|
||||
[ApiDiffType.NA_TO_FA, ErrorMessage.ERROR_CHANGES_JSDOC_NA_TO_FA],
|
||||
// 10.函数变更
|
||||
[ApiDiffType.FUNCTION_RETURN_TYPE_ADD, ErrorMessage.ERROR_CHANGES_FUNCTION_RETURN_TYPE_ADD],
|
||||
[ApiDiffType.FUNCTION_RETURN_TYPE_REDUCE, ErrorMessage.ERROR_CHANGES_FUNCTION_RETURN_TYPE_REDUCE],
|
||||
[ApiDiffType.FUNCTION_RETURN_TYPE_CHANGE, ErrorMessage.ERROR_CHANGES_FUNCTION_RETURN_TYPE_CHANGE],
|
||||
[ApiDiffType.FUNCTION_PARAM_POS_CHANGE, ErrorMessage.ERROR_CHANGES_FUNCTION_PARAM_POS_CHANGE],
|
||||
[ApiDiffType.FUNCTION_PARAM_REQUIRED_ADD, ErrorMessage.ERROR_CHANGES_FUNCTION_PARAM_REQUIRED_ADD],
|
||||
[ApiDiffType.FUNCTION_PARAM_REDUCE, ErrorMessage.ERROR_CHANGES_FUNCTION_PARAM_REDUCE],
|
||||
[ApiDiffType.FUNCTION_PARAM_TO_REQUIRED, ErrorMessage.ERROR_CHANGES_FUNCTION_PARAM_TO_REQUIRED],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_CHANGE, ErrorMessage.ERROR_CHANGES_FUNCTION_PARAM_TYPE],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_REDUCE, ErrorMessage.ERROR_CHANGES_FUNCTION_PARAM_TYPE_REDUCE],
|
||||
// 12.属性变更
|
||||
[ApiDiffType.PROPERTY_READONLY_TO_REQUIRED, ErrorMessage.ERROR_CHANGES_PROPERTY_READONLY_TO_REQUIRED],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_TO_UNREQUIRED, ErrorMessage.ERROR_CHANGES_PROPERTY_WRITABLE_TO_UNREQUIRED],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_TO_REQUIRED, ErrorMessage.ERROR_CHANGES_PROPERTY_WRITABLE_TO_REQUIRED],
|
||||
[ApiDiffType.PROPERTY_TYPE_CHANGE, ErrorMessage.ERROR_CHANGES_PROPERTY_TYPE_CHANGE],
|
||||
[ApiDiffType.PROPERTY_READONLY_ADD, ErrorMessage.ERROR_CHANGES_PROPERTY_READONLY_ADD],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_ADD, ErrorMessage.ERROR_CHANGES_PROPERTY_WRITABLE_ADD],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_REDUCE, ErrorMessage.ERROR_CHANGES_PROPERTY_WRITABLE_REDUCE],
|
||||
[ApiDiffType.DELETE_DECORATOR, ErrorMessage.ERROR_CHANGES_DELETE_DECORATOR],
|
||||
// 13.常量变更
|
||||
[ApiDiffType.CONSTANT_VALUE_CHANGE, ErrorMessage.ERROR_CHANGES_CONSTANT_VALUE],
|
||||
// 14.自定义类型变更
|
||||
[ApiDiffType.TYPE_ALIAS_CHANGE, ErrorMessage.ERROR_CHANGES_TYPE_ALIAS_VALUE],
|
||||
[ApiDiffType.TYPE_ALIAS_ADD, ErrorMessage.ERROR_CHANGES_TYPE_ALIAS_ADD],
|
||||
[ApiDiffType.TYPE_ALIAS_REDUCE, ErrorMessage.ERROR_CHANGES_TYPE_ALIAS_REDUCE],
|
||||
// 15.枚举类型变更
|
||||
[ApiDiffType.ENUM_MEMBER_VALUE_CHANGE, ErrorMessage.ERROR_CHANGES_ENUM_MEMBER_VALUE],
|
||||
]
|
||||
);
|
||||
|
||||
/**
|
||||
* online error message format
|
||||
@ -215,6 +251,10 @@ export class ApiResultSimpleInfo {
|
||||
message: string = '';
|
||||
type: string = '';
|
||||
apiText: string = '';
|
||||
apiName: string = '';
|
||||
apiType: string = '';
|
||||
hierarchicalRelations: string = '';
|
||||
parentModuleName: string | undefined = '';
|
||||
|
||||
setID(id: number): ApiResultSimpleInfo {
|
||||
this.id = id;
|
||||
@ -278,6 +318,43 @@ export class ApiResultSimpleInfo {
|
||||
getApiText(): string {
|
||||
return this.apiText;
|
||||
}
|
||||
|
||||
|
||||
setApiName(apiName: string): ApiResultSimpleInfo {
|
||||
this.apiName = apiName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiName(): string {
|
||||
return this.apiName;
|
||||
}
|
||||
|
||||
setApiType(apiType: string): ApiResultSimpleInfo {
|
||||
this.apiType = apiType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiType(): string {
|
||||
return this.apiType;
|
||||
}
|
||||
|
||||
setHierarchicalRelations(hierarchicalRelations: string): ApiResultSimpleInfo {
|
||||
this.hierarchicalRelations = hierarchicalRelations;
|
||||
return this;
|
||||
}
|
||||
|
||||
getHierarchicalRelations(): string {
|
||||
return this.hierarchicalRelations;
|
||||
}
|
||||
|
||||
setParentModuleName(parentModuleName: string | undefined): ApiResultSimpleInfo {
|
||||
this.parentModuleName = parentModuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getParentModuleName(): string | undefined {
|
||||
return this.parentModuleName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -293,6 +370,9 @@ export class ApiResultInfo {
|
||||
apiName: string = '';
|
||||
apiFullText: string = '';
|
||||
baseName: string = '';
|
||||
hierarchicalRelations: string = '';
|
||||
parentModuleName: string | undefined = '';
|
||||
defectType: string = '';
|
||||
|
||||
setErrorType(errorType: string): ApiResultInfo {
|
||||
this.errorType = errorType;
|
||||
@ -372,6 +452,33 @@ export class ApiResultInfo {
|
||||
getBaseName(): string {
|
||||
return this.baseName;
|
||||
}
|
||||
|
||||
setHierarchicalRelations(hierarchicalRelations: string): ApiResultInfo {
|
||||
this.hierarchicalRelations = hierarchicalRelations;
|
||||
return this;
|
||||
}
|
||||
|
||||
getHierarchicalRelations(): string {
|
||||
return this.hierarchicalRelations;
|
||||
}
|
||||
|
||||
setParentModuleName(parentModuleName: string | undefined): ApiResultInfo {
|
||||
this.parentModuleName = parentModuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getParentModuleName(): string | undefined {
|
||||
return this.parentModuleName;
|
||||
}
|
||||
|
||||
setDefectType(defectType: string): ApiResultInfo {
|
||||
this.defectType = defectType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getDefectType(): string {
|
||||
return this.defectType;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -427,6 +534,7 @@ export class ApiResultMessage {
|
||||
language: string = 'typescript';
|
||||
mainBuggyCode: string = '';
|
||||
mainBuggyLine: string = '';
|
||||
extendInfo: ApiBaseInfo = new ApiBaseInfo();
|
||||
|
||||
setLocation(codeContextStaerLine: string): ApiResultMessage {
|
||||
this.codeContextStaerLine = codeContextStaerLine;
|
||||
@ -489,4 +597,244 @@ export class ApiResultMessage {
|
||||
getMainBuggyLine(): string {
|
||||
return this.mainBuggyLine;
|
||||
}
|
||||
|
||||
setExtendInfo(extendInfo: ApiBaseInfo): ApiResultMessage {
|
||||
this.extendInfo = extendInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
getExtendInfo(): ApiBaseInfo {
|
||||
return this.extendInfo;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* error message format
|
||||
*/
|
||||
export class ApiCheckInfo {
|
||||
errorID: number = -1;
|
||||
errorLevel: number = -1;
|
||||
filePath: string = '';
|
||||
apiPostion: ts.LineAndCharacter = { line: -1, character: -1 };
|
||||
errorType: string = '';
|
||||
logType: string = '';
|
||||
sinceNumber: number = -1;
|
||||
apiName: string = '';
|
||||
apiType: string = '';
|
||||
apiText: string = '';
|
||||
errorInfo: string = '';
|
||||
hierarchicalRelations: string = '';
|
||||
parentModuleName: string | undefined = '';
|
||||
|
||||
setErrorID(errorID: number): ApiCheckInfo {
|
||||
this.errorID = errorID;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorID(): number {
|
||||
return this.errorID;
|
||||
}
|
||||
|
||||
setErrorLevel(errorLevel: number): ApiCheckInfo {
|
||||
this.errorLevel = errorLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorLevel(): number {
|
||||
return this.errorLevel;
|
||||
}
|
||||
|
||||
setFilePath(filePath: string): ApiCheckInfo {
|
||||
this.filePath = filePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
getFilePath(): string {
|
||||
return this.filePath;
|
||||
}
|
||||
|
||||
setApiPostion(apiPostion: ts.LineAndCharacter): ApiCheckInfo {
|
||||
this.apiPostion = apiPostion;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiPostion(): ts.LineAndCharacter {
|
||||
return this.apiPostion;
|
||||
}
|
||||
|
||||
setErrorType(errorType: string): ApiCheckInfo {
|
||||
this.errorType = errorType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorType(): string {
|
||||
return this.errorType;
|
||||
}
|
||||
|
||||
setLogType(logType: string): ApiCheckInfo {
|
||||
this.logType = logType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getLogType(): string {
|
||||
return this.logType;
|
||||
}
|
||||
|
||||
setSinceNumber(sinceNumber: number): ApiCheckInfo {
|
||||
this.sinceNumber = sinceNumber;
|
||||
return this;
|
||||
}
|
||||
|
||||
getSinceNumber(): number {
|
||||
return this.sinceNumber;
|
||||
}
|
||||
|
||||
setApiName(apiName: string): ApiCheckInfo {
|
||||
this.apiName = apiName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiName(): string {
|
||||
return this.apiName;
|
||||
}
|
||||
|
||||
setApiType(apiType: string): ApiCheckInfo {
|
||||
this.apiType = apiType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiType(): string {
|
||||
return this.apiType;
|
||||
}
|
||||
|
||||
setApiText(apiText: string): ApiCheckInfo {
|
||||
this.apiText = apiText;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiText(): string {
|
||||
return this.apiText;
|
||||
}
|
||||
|
||||
setErrorInfo(errorInfo: string): ApiCheckInfo {
|
||||
this.errorInfo = errorInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorInfo(): string {
|
||||
return this.errorInfo;
|
||||
}
|
||||
|
||||
setHierarchicalRelations(hierarchicalRelations: string): ApiCheckInfo {
|
||||
this.hierarchicalRelations = hierarchicalRelations;
|
||||
return this;
|
||||
}
|
||||
|
||||
getHierarchicalRelations(): string {
|
||||
return this.hierarchicalRelations;
|
||||
}
|
||||
|
||||
setParentModuleName(parentModuleName: string | undefined): ApiCheckInfo {
|
||||
this.parentModuleName = parentModuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getParentModuleName(): string | undefined {
|
||||
return this.parentModuleName;
|
||||
}
|
||||
}
|
||||
|
||||
export class ApiBaseInfo {
|
||||
apiName: string = '';
|
||||
apiType: string = '';
|
||||
hierarchicalRelations: string = '';
|
||||
parentModuleName: string | undefined = '';
|
||||
|
||||
setApiName(apiName: string): ApiBaseInfo {
|
||||
this.apiName = apiName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiName(): string {
|
||||
return this.apiName;
|
||||
}
|
||||
setApiType(apiType: string): ApiBaseInfo {
|
||||
this.apiType = apiType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getApiType(): string {
|
||||
return this.apiType;
|
||||
}
|
||||
setHierarchicalRelations(hierarchicalRelations: string): ApiBaseInfo {
|
||||
this.hierarchicalRelations = hierarchicalRelations;
|
||||
return this;
|
||||
}
|
||||
|
||||
getHierarchicalRelations(): string {
|
||||
return this.hierarchicalRelations;
|
||||
}
|
||||
setParentModuleName(parentModuleName: string | undefined): ApiBaseInfo {
|
||||
this.parentModuleName = parentModuleName;
|
||||
return this;
|
||||
}
|
||||
|
||||
getParentModuleName(): string | undefined {
|
||||
return this.parentModuleName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class ErrorBaseInfo {
|
||||
errorID: number = -1;
|
||||
errorLevel: number = -1;
|
||||
errorType: string = '';
|
||||
logType: string = '';
|
||||
errorInfo: string = '';
|
||||
|
||||
setErrorID(errorID: number): ErrorBaseInfo {
|
||||
this.errorID = errorID;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorID(): number {
|
||||
return this.errorID;
|
||||
}
|
||||
|
||||
setErrorLevel(errorLevel: number): ErrorBaseInfo {
|
||||
this.errorLevel = errorLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorLevel(): number {
|
||||
return this.errorLevel;
|
||||
}
|
||||
|
||||
|
||||
setErrorType(errorType: string): ErrorBaseInfo {
|
||||
this.errorType = errorType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorType(): string {
|
||||
return this.errorType;
|
||||
}
|
||||
|
||||
setLogType(logType: string): ErrorBaseInfo {
|
||||
this.logType = logType;
|
||||
return this;
|
||||
}
|
||||
|
||||
getLogType(): string {
|
||||
return this.logType;
|
||||
}
|
||||
|
||||
setErrorInfo(errorInfo: string): ErrorBaseInfo {
|
||||
this.errorInfo = errorInfo;
|
||||
return this;
|
||||
}
|
||||
|
||||
getErrorInfo(): string {
|
||||
return this.errorInfo;
|
||||
}
|
||||
}
|
@ -60,7 +60,7 @@ export class BasicDiffInfo {
|
||||
newSyscapField: string = '';
|
||||
//kit信息
|
||||
oldKitInfo: string = '';
|
||||
newKitInfo:string = '';
|
||||
newKitInfo: string = '';
|
||||
|
||||
setApiType(apiType: string): BasicDiffInfo {
|
||||
if (apiType) {
|
||||
@ -445,6 +445,7 @@ export enum ApiDiffType {
|
||||
FUNCTION_PARAM_TYPE_ADD,
|
||||
/** 函数的参数类型范围缩小 */
|
||||
FUNCTION_PARAM_TYPE_REDUCE,
|
||||
FUNCTION_PARAM_CHANGE,
|
||||
PROPERTY_READONLY_TO_UNREQUIRED,
|
||||
PROPERTY_READONLY_TO_REQUIRED,
|
||||
PROPERTY_WRITABLE_TO_UNREQUIRED,
|
||||
@ -458,6 +459,25 @@ export enum ApiDiffType {
|
||||
TYPE_ALIAS_CHANGE,
|
||||
TYPE_ALIAS_ADD,
|
||||
TYPE_ALIAS_REDUCE,
|
||||
TYPE_ALIAS_FUNCTION_RETURN_TYPE_ADD,
|
||||
TYPE_ALIAS_FUNCTION_RETURN_TYPE_REDUCE,
|
||||
TYPE_ALIAS_FUNCTION_RETURN_TYPE_CHANGE,
|
||||
TYPE_ALIAS_FUNCTION_PARAM_POS_CHAHGE,
|
||||
/** 自定义类型方法新增可选参数 */
|
||||
TYPE_ALIAS_FUNCTION_PARAM_UNREQUIRED_ADD,
|
||||
/** 自定义类型方法新增必选参数 */
|
||||
TYPE_ALIAS_FUNCTION_PARAM_REQUIRED_ADD,
|
||||
TYPE_ALIAS_FUNCTION_PARAM_REDUCE,
|
||||
TYPE_ALIAS_FUNCTION_PARAM_TYPE_CHANGE,
|
||||
/** 自定义类型方法中的必选参数变为可选参数 */
|
||||
TYPE_ALIAS_FUNCTION_PARAM_TO_UNREQUIRED,
|
||||
/** 自定义类型方法中的可选参数变为必选参数 */
|
||||
TYPE_ALIAS_FUNCTION_PARAM_TO_REQUIRED,
|
||||
/** 自定义类型方法的参数类型范围扩大 */
|
||||
TYPE_ALIAS_FUNCTION_PARAM_TYPE_ADD,
|
||||
/** 自定义类型方法的参数类型范围缩小 */
|
||||
TYPE_ALIAS_FUNCTION_PARAM_TYPE_REDUCE,
|
||||
TYPE_ALIAS_FUNCTION_PARAM_CHANGE,
|
||||
ENUM_MEMBER_VALUE_CHANGE,
|
||||
ADD,
|
||||
REDUCE,
|
||||
@ -518,6 +538,7 @@ export const diffTypeMap: Map<ApiDiffType, string> = new Map([
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_CHANGE, '函数变更'],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_ADD, '函数变更'],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_REDUCE, '函数变更'],
|
||||
[ApiDiffType.FUNCTION_PARAM_CHANGE, '函数变更'],
|
||||
[ApiDiffType.PROPERTY_READONLY_TO_UNREQUIRED, '属性变更'],
|
||||
[ApiDiffType.PROPERTY_READONLY_TO_REQUIRED, '属性变更'],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_TO_UNREQUIRED, '属性变更'],
|
||||
@ -531,6 +552,19 @@ export const diffTypeMap: Map<ApiDiffType, string> = new Map([
|
||||
[ApiDiffType.TYPE_ALIAS_CHANGE, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_ADD, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_REDUCE, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_ADD, '函数变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_REDUCE, '函数变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_CHANGE, '函数变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_POS_CHAHGE, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_UNREQUIRED_ADD, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_REQUIRED_ADD, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_REDUCE, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TO_UNREQUIRED, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TO_REQUIRED, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_CHANGE, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_ADD, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_REDUCE, '自定义类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_CHANGE, '自定义类型变更'],
|
||||
[ApiDiffType.ENUM_MEMBER_VALUE_CHANGE, '枚举赋值发生改变'],
|
||||
[ApiDiffType.ADD, '新增API'],
|
||||
[ApiDiffType.REDUCE, '删除API'],
|
||||
@ -589,6 +623,7 @@ export const diffMap: Map<ApiDiffType, string> = new Map([
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_CHANGE, '函数的参数类型变更'],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_ADD, '函数的参数类型范围扩大'],
|
||||
[ApiDiffType.FUNCTION_PARAM_TYPE_REDUCE, '函数的参数类型范围缩小'],
|
||||
[ApiDiffType.FUNCTION_PARAM_CHANGE, '函数的参数变更'],
|
||||
[ApiDiffType.PROPERTY_READONLY_TO_UNREQUIRED, '只读属性由必选变为可选'],
|
||||
[ApiDiffType.PROPERTY_READONLY_TO_REQUIRED, '只读属性由可选变为必选'],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_TO_UNREQUIRED, '可写属性由必选变为可选'],
|
||||
@ -599,9 +634,22 @@ export const diffMap: Map<ApiDiffType, string> = new Map([
|
||||
[ApiDiffType.PROPERTY_WRITABLE_ADD, '可写属性类型范围扩大'],
|
||||
[ApiDiffType.PROPERTY_WRITABLE_REDUCE, '可写属性类型范围缩小'],
|
||||
[ApiDiffType.CONSTANT_VALUE_CHANGE, '常量值发生改变'],
|
||||
[ApiDiffType.TYPE_ALIAS_CHANGE, '自定义类型值直接改变'],
|
||||
[ApiDiffType.TYPE_ALIAS_CHANGE, '自定义类型值改变'],
|
||||
[ApiDiffType.TYPE_ALIAS_ADD, '自定义类型值范围扩大'],
|
||||
[ApiDiffType.TYPE_ALIAS_REDUCE, '自定义类型值范围缩小'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_ADD, '自定义方法类型返回值类型扩大'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_REDUCE, '自定义方法类型返回值类型缩小'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_RETURN_TYPE_CHANGE, '自定义方法类型返回值类型改变'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_POS_CHAHGE, '自定义方法类型参数位置发生改变'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_UNREQUIRED_ADD, '自定义方法类型新增可选参数'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_REQUIRED_ADD, '自定义方法类型新增必选参数'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_REDUCE, '自定义方法类型删除参数'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TO_UNREQUIRED, '自定义方法类型的必选参数变为可选参数'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TO_REQUIRED, '自定义方法类型的可选参数变为必选参数'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_CHANGE, '自定义方法类型的参数类型变更'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_ADD, '自定义方法类型的参数类型范围扩大'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_REDUCE, '自定义方法类型的参数类型范围缩小'],
|
||||
[ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_CHANGE, '自定义方法类型的参数变更'],
|
||||
[ApiDiffType.ENUM_MEMBER_VALUE_CHANGE, '枚举赋值发生改变'],
|
||||
[ApiDiffType.ADD, '新增API'],
|
||||
[ApiDiffType.REDUCE, '删除API'],
|
||||
@ -639,6 +687,7 @@ export const incompatibleApiDiffTypes: Set<ApiDiffType> = new Set([
|
||||
ApiDiffType.FUNCTION_PARAM_TO_REQUIRED,
|
||||
ApiDiffType.FUNCTION_PARAM_TYPE_CHANGE,
|
||||
ApiDiffType.FUNCTION_PARAM_TYPE_REDUCE,
|
||||
ApiDiffType.FUNCTION_PARAM_CHANGE,
|
||||
ApiDiffType.PROPERTY_READONLY_TO_REQUIRED,
|
||||
ApiDiffType.PROPERTY_WRITABLE_TO_UNREQUIRED,
|
||||
ApiDiffType.PROPERTY_WRITABLE_TO_REQUIRED,
|
||||
@ -654,5 +703,10 @@ export const incompatibleApiDiffTypes: Set<ApiDiffType> = new Set([
|
||||
ApiDiffType.REDUCE,
|
||||
ApiDiffType.HISTORICAL_JSDOC_CHANGE,
|
||||
ApiDiffType.HISTORICAL_API_CHANGE,
|
||||
ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_REDUCE,
|
||||
ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_CHANGE,
|
||||
ApiDiffType.FUNCTION_RETURN_TYPE_REDUCE,
|
||||
ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_TYPE_ADD,
|
||||
ApiDiffType.TYPE_ALIAS_FUNCTION_PARAM_CHANGE,
|
||||
ApiDiffType.ATOMIC_SERVICE_HAVE_TO_NA,
|
||||
]);
|
@ -66,10 +66,12 @@ export class BasicApiInfo {
|
||||
jsDocText: string = '';
|
||||
isJoinType: boolean = false;
|
||||
genericInfo: GenericInfo[] = [];
|
||||
parentApiType: string | undefined = '';
|
||||
|
||||
constructor(apiType: string = '', node: ts.Node, parentApi: BasicApiInfo | undefined) {
|
||||
this.node = node;
|
||||
this.setParentApi(parentApi);
|
||||
this.setParentApiType(parentApi?.getApiType())
|
||||
if (parentApi) {
|
||||
this.setFilePath(parentApi.getFilePath());
|
||||
this.setIsStruct(parentApi.getIsStruct());
|
||||
@ -135,6 +137,14 @@ export class BasicApiInfo {
|
||||
getParentApi(): BasicApiInfo | undefined {
|
||||
return this.parentApi;
|
||||
}
|
||||
|
||||
setParentApiType(parentApiType: string | undefined): void {
|
||||
this.parentApiType = parentApiType;
|
||||
}
|
||||
|
||||
getParentApiType(): string | undefined {
|
||||
return this.parentApiType;
|
||||
}
|
||||
|
||||
setIsExport(isExport: boolean): void {
|
||||
this.isExport = isExport;
|
||||
@ -553,7 +563,7 @@ export class TypeAliasInfo extends ApiInfo {
|
||||
type: string[] = []; // type定义的类型
|
||||
typeName: TypeAliasType = '' as TypeAliasType; //type的类型
|
||||
returnType: string = ''; //type类型为function时的返回值
|
||||
paramInfos: TypeParamInfo[] = []; //type类型为function时的参数名和参数类型
|
||||
paramInfos: ParamInfo[] = []; //type类型为function时的参数名和参数类型
|
||||
typeIsFunction: boolean = false; //type类型是否为function
|
||||
|
||||
addType(type: string[]): void {
|
||||
@ -582,11 +592,11 @@ export class TypeAliasInfo extends ApiInfo {
|
||||
return this.returnType;
|
||||
}
|
||||
|
||||
setParamInfos(paramInfo: TypeParamInfo) {
|
||||
setParamInfos(paramInfo: ParamInfo) {
|
||||
this.paramInfos.push(paramInfo);
|
||||
}
|
||||
|
||||
getParamInfos(): TypeParamInfo[] {
|
||||
getParamInfos(): ParamInfo[] {
|
||||
return this.paramInfos;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,8 @@ import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { FileUtils } from './FileUtils';
|
||||
import { NumberConstant } from './Constant';
|
||||
import { data } from '../../kit.json'
|
||||
import { kitData } from '../../kit.json'
|
||||
import { fileContent } from '../../subsystem.json'
|
||||
|
||||
export class FunctionUtils {
|
||||
/**
|
||||
@ -57,8 +58,6 @@ export class FunctionUtils {
|
||||
}
|
||||
|
||||
static readSubsystemFile(): SubSystemData {
|
||||
const subsystemFilePath: string = path.join(FileUtils.getBaseDirName(), 'subsystem.json');
|
||||
const fileContent: Array<SubSystemInfo> = JSON.parse(fs.readFileSync(subsystemFilePath, 'utf-8'));
|
||||
const subsystemMap: Map<string, string> = new Map();
|
||||
const fileNameMap: Map<string, string> = new Map();
|
||||
|
||||
@ -81,7 +80,7 @@ export class FunctionUtils {
|
||||
const subsystemMap: Map<string, string> = new Map();
|
||||
const kitNameMap: Map<string, string> = new Map();
|
||||
const filePathSet: Set<string> = new Set();
|
||||
data.forEach((subSystemInfo: KitInfo) => {
|
||||
kitData.forEach((subSystemInfo: KitInfo) => {
|
||||
subsystemMap.set(subSystemInfo.filePath, subSystemInfo.subSystem);
|
||||
kitNameMap.set(subSystemInfo.filePath, subSystemInfo.kitName);
|
||||
filePathSet.add(subSystemInfo.filePath);
|
||||
|
@ -20,6 +20,8 @@ export class StringUtils {
|
||||
try {
|
||||
flag = str.search(sub) !== -1;
|
||||
} catch (error) {
|
||||
console.log('str=',str)
|
||||
console.log('sub=',sub)
|
||||
LogUtil.e('StringUtils.hasSubstring', error);
|
||||
}
|
||||
return flag;
|
||||
|
@ -16,11 +16,14 @@ import path, { ParsedPath } from 'path';
|
||||
import fs, { Stats } from 'fs';
|
||||
import { Workbook, Worksheet } from 'exceljs';
|
||||
import ts, { LineAndCharacter } from 'typescript';
|
||||
import { ApiResultSimpleInfo, ApiResultInfo, ApiResultMessage } from '../typedef/checker/result_type';
|
||||
import { ApiInfo, ClassInfo, ParentClass } from '../typedef/parser/ApiInfoDefination';
|
||||
import { ApiResultSimpleInfo, ApiResultInfo, ApiResultMessage, ApiCheckInfo, ErrorBaseInfo } from '../typedef/checker/result_type';
|
||||
import { ApiInfo, BasicApiInfo, ClassInfo, ParentClass } from '../typedef/parser/ApiInfoDefination';
|
||||
import { FileUtils } from './FileUtils';
|
||||
import { ApiCheckVersion } from '../coreImpl/checker/config/api_check_version.json';
|
||||
import { PunctuationMark } from './Constant';
|
||||
import { Comment } from '../typedef/parser/Comment';
|
||||
import { currentFilePath } from '../coreImpl/checker/src/api_check_plugin';
|
||||
import { toNumber } from 'lodash';
|
||||
|
||||
|
||||
export class PosOfNode {
|
||||
@ -99,38 +102,45 @@ export class GenerateFile {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将错误信息输出为excel文件
|
||||
* @param { ApiResultInfo[] } apiCheckArr
|
||||
*/
|
||||
static async writeExcelFile(apiCheckArr: ApiResultInfo[]): Promise<void> {
|
||||
static async writeExcelFile(apiCheckArr: ApiResultMessage[]): Promise<void> {
|
||||
const workbook: Workbook = new Workbook();
|
||||
const sheet: Worksheet = workbook.addWorksheet('Js Api', { views: [{ xSplit: 1 }] });
|
||||
sheet.getRow(1).values = [
|
||||
'order',
|
||||
'level',
|
||||
'errorType',
|
||||
'fileName',
|
||||
'apiName',
|
||||
'apiContent',
|
||||
'type',
|
||||
'errorInfo',
|
||||
'version',
|
||||
'model',
|
||||
'analyzerName',
|
||||
'buggyFilePath',
|
||||
'codeContextStaerLine',
|
||||
'defectLevel',
|
||||
'defectType',
|
||||
'description',
|
||||
'language',
|
||||
'mainBuggyCode',
|
||||
"apiName",
|
||||
"apiType",
|
||||
"hierarchicalRelations",
|
||||
"parentModuleName"
|
||||
];
|
||||
for (let i = 1; i <= apiCheckArr.length; i++) {
|
||||
const apiData: ApiResultInfo = apiCheckArr[i - 1];
|
||||
const apiData: ApiResultMessage = apiCheckArr[i - 1];
|
||||
sheet.getRow(i + 1).values = [
|
||||
i,
|
||||
apiData.getLevel(),
|
||||
apiData.getErrorType(),
|
||||
apiData.analyzerName,
|
||||
apiData.getFilePath(),
|
||||
apiData.getLocation(),
|
||||
apiData.getApiName(),
|
||||
apiData.getApiFullText(),
|
||||
apiData.getApiType(),
|
||||
apiData.getLevel(),
|
||||
apiData.getType(),
|
||||
apiData.getMessage(),
|
||||
apiData.getVersion(),
|
||||
apiData.getBaseName(),
|
||||
apiData.language,
|
||||
apiData.getMainBuggyCode(),
|
||||
apiData.getExtendInfo().getApiName(),
|
||||
apiData.getExtendInfo().getApiType(),
|
||||
apiData.getExtendInfo().getHierarchicalRelations(),
|
||||
apiData.getExtendInfo().getParentModuleName()
|
||||
];
|
||||
}
|
||||
workbook.xlsx.writeBuffer().then((buffer) => {
|
||||
@ -169,7 +179,6 @@ export class ObtainFullPath {
|
||||
}
|
||||
|
||||
export class CommonFunctions {
|
||||
|
||||
static getSinceVersion(sinceValue: string): string {
|
||||
return sinceValue.indexOf(PunctuationMark.LEFT_PARENTHESES) !== -1 ?
|
||||
sinceValue.substring(sinceValue.indexOf(PunctuationMark.LEFT_PARENTHESES) + 1,
|
||||
@ -249,6 +258,31 @@ export class CommonFunctions {
|
||||
return implementsApiValue;
|
||||
}
|
||||
|
||||
|
||||
static getErrorInfo(singleApi: BasicApiInfo | undefined, apiJsdoc: Comment.JsDocInfo | undefined, filePath: string, errorBaseInfo: ErrorBaseInfo): ApiCheckInfo {
|
||||
let apiInfo: ApiCheckInfo = new ApiCheckInfo();
|
||||
if (singleApi === undefined) {
|
||||
return apiInfo
|
||||
}
|
||||
const sinceVersion: number = apiJsdoc === undefined ? -1 : toNumber(apiJsdoc.since);
|
||||
apiInfo
|
||||
.setErrorID(errorBaseInfo.errorID)
|
||||
.setErrorLevel(errorBaseInfo.errorLevel)
|
||||
.setFilePath(filePath)
|
||||
.setApiPostion(singleApi.getPos())
|
||||
.setErrorType(errorBaseInfo.errorType)
|
||||
.setLogType(errorBaseInfo.logType)
|
||||
.setSinceNumber(sinceVersion)
|
||||
.setApiName(singleApi.getApiName())
|
||||
.setApiType(singleApi.getApiType())
|
||||
.setApiText(singleApi.getDefinedText())
|
||||
.setErrorInfo(errorBaseInfo.errorInfo)
|
||||
.setHierarchicalRelations(singleApi.getHierarchicalRelations().join('|'))
|
||||
.setParentModuleName(singleApi.getParentApi()?.getApiName());
|
||||
|
||||
return apiInfo;
|
||||
}
|
||||
|
||||
static getMdFiles(url: string) {
|
||||
const mdFiles: string[] = [];
|
||||
const content: string = fs.readFileSync(url, 'utf-8');
|
||||
@ -270,13 +304,22 @@ export class CommonFunctions {
|
||||
CommonFunctions.splitPath(spliteResult.dir, pathElements);
|
||||
}
|
||||
}
|
||||
|
||||
static isAscending(arr: number[]): boolean {
|
||||
for (let i = 1; i < arr.length; i++) {
|
||||
if (arr[i] < arr[i - 1]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The order between labels
|
||||
*/
|
||||
export const tagsArrayOfOrder: string[] = [
|
||||
'namespace', 'struct', 'extends', 'implements', 'typedef', 'interface', 'permission', 'enum', 'constant', 'type',
|
||||
'namespace', 'struct', 'typedef', 'interface', 'extends', 'implements', 'permission', 'enum', 'constant', 'type',
|
||||
'param', 'default', 'returns', 'readonly', 'throws', 'static', 'fires', 'syscap', 'systemapi', 'famodelonly',
|
||||
'FAModelOnly', 'stagemodelonly', 'StageModelOnly', 'crossplatform', 'form', 'atomicservice', 'since', 'deprecated',
|
||||
'useinstead', 'test', 'example'
|
||||
|
@ -1,244 +1,246 @@
|
||||
[
|
||||
{
|
||||
"syscap": "ArkUI",
|
||||
"subsystem": "ArkUI开发框架",
|
||||
"fileName": "arkui"
|
||||
},
|
||||
{
|
||||
"syscap": "BundleManager",
|
||||
"subsystem": "包管理",
|
||||
"fileName": "bundle"
|
||||
},
|
||||
{
|
||||
"syscap": "Graphic",
|
||||
"subsystem": "图形图像",
|
||||
"fileName": "graphic"
|
||||
},
|
||||
{
|
||||
"syscap": "WindowManager",
|
||||
"subsystem": "窗口管理",
|
||||
"fileName": "window"
|
||||
},
|
||||
{
|
||||
"syscap": "Notification",
|
||||
"subsystem": "事件通知",
|
||||
"fileName": "notification"
|
||||
},
|
||||
{
|
||||
"syscap": "Communication",
|
||||
"subsystem": "基础通信",
|
||||
"fileName": "communication"
|
||||
},
|
||||
{
|
||||
"syscap": "Location",
|
||||
"subsystem": "位置服务",
|
||||
"fileName": "geolocation"
|
||||
},
|
||||
{
|
||||
"syscap": "MultimodalInput",
|
||||
"subsystem": "多模输入",
|
||||
"fileName": "multi-modal-input"
|
||||
},
|
||||
{
|
||||
"syscap": "PowerManager",
|
||||
"subsystem": "电源服务",
|
||||
"fileName": "battery"
|
||||
},
|
||||
{
|
||||
"syscap": "Multimedia",
|
||||
"subsystem": "OS媒体软件",
|
||||
"fileName": "multimedia"
|
||||
},
|
||||
{
|
||||
"syscap": "Telephony",
|
||||
"subsystem": "电话服务",
|
||||
"fileName": "telephony"
|
||||
},
|
||||
{
|
||||
"syscap": "Global",
|
||||
"subsystem": "全球化",
|
||||
"fileName": "global"
|
||||
},
|
||||
{
|
||||
"syscap": "Customization",
|
||||
"subsystem": "定制",
|
||||
"fileName": "customization"
|
||||
},
|
||||
{
|
||||
"syscap": "BarrierFree",
|
||||
"subsystem": "无障碍软件服务",
|
||||
"fileName": "accessibility"
|
||||
},
|
||||
{
|
||||
"syscap": "ResourceSchedule",
|
||||
"subsystem": "资源调度",
|
||||
"fileName": "resource-scheduler"
|
||||
},
|
||||
{
|
||||
"syscap": "Utils",
|
||||
"subsystem": "公共基础类库",
|
||||
"fileName": "compiler-and-runtime"
|
||||
},
|
||||
{
|
||||
"syscap": "HiviewDFX",
|
||||
"subsystem": "DFX",
|
||||
"fileName": "dfx"
|
||||
},
|
||||
{
|
||||
"syscap": "Update",
|
||||
"subsystem": "升级服务",
|
||||
"fileName": "update"
|
||||
},
|
||||
{
|
||||
"syscap": "DistributedHardware",
|
||||
"subsystem": "分布式硬件",
|
||||
"fileName": "distributed-hardware"
|
||||
},
|
||||
{
|
||||
"syscap": "Security",
|
||||
"subsystem": "安全基础能力",
|
||||
"fileName": "security"
|
||||
},
|
||||
{
|
||||
"syscap": "Account",
|
||||
"subsystem": "账号",
|
||||
"fileName": "account"
|
||||
},
|
||||
{
|
||||
"syscap": "UserIAM",
|
||||
"subsystem": "用户IAM",
|
||||
"fileName": "user-iam"
|
||||
},
|
||||
{
|
||||
"syscap": "FileManagement",
|
||||
"subsystem": "文件管理",
|
||||
"fileName": "file-management"
|
||||
},
|
||||
{
|
||||
"syscap": "USB",
|
||||
"subsystem": "USB服务",
|
||||
"fileName": "usb"
|
||||
},
|
||||
{
|
||||
"syscap": "Sensors",
|
||||
"subsystem": "泛sensor服务",
|
||||
"fileName": "sensor"
|
||||
},
|
||||
{
|
||||
"syscap": "Startup",
|
||||
"subsystem": "启动恢复",
|
||||
"fileName": "start-up"
|
||||
},
|
||||
{
|
||||
"syscap": "DistributedDataManager",
|
||||
"subsystem": "分布式数据管理",
|
||||
"fileName": "distributed-data"
|
||||
},
|
||||
{
|
||||
"syscap": "Ability",
|
||||
"subsystem": "元能力",
|
||||
"fileName": "ability"
|
||||
},
|
||||
{
|
||||
"syscap": "Web",
|
||||
"subsystem": "web",
|
||||
"fileName": "web"
|
||||
},
|
||||
{
|
||||
"syscap": "Applications",
|
||||
"subsystem": "应用",
|
||||
"fileName": "application"
|
||||
},
|
||||
{
|
||||
"syscap": "Msdp",
|
||||
"subsystem": "综合传感处理平台",
|
||||
"fileName": "msdp"
|
||||
},
|
||||
{
|
||||
"syscap": "Test",
|
||||
"subsystem": "测试框架",
|
||||
"fileName": "unitest"
|
||||
},
|
||||
{
|
||||
"syscap": "Base",
|
||||
"subsystem": "SDK",
|
||||
"fileName": "sdk"
|
||||
},
|
||||
{
|
||||
"syscap": "AI",
|
||||
"subsystem": "AI业务",
|
||||
"fileName": "ai"
|
||||
},
|
||||
{
|
||||
"syscap": "Request",
|
||||
"subsystem": "上传下载",
|
||||
"fileName": "download-upload"
|
||||
},
|
||||
{
|
||||
"syscap": "Download",
|
||||
"subsystem": "上传下载",
|
||||
"fileName": "download-upload"
|
||||
},
|
||||
{
|
||||
"syscap": "Upload",
|
||||
"subsystem": "上传下载",
|
||||
"fileName": "download-upload"
|
||||
},
|
||||
{
|
||||
"syscap": "Wallpaper",
|
||||
"subsystem": "主题",
|
||||
"fileName": "theme"
|
||||
},
|
||||
{
|
||||
"syscap": "Time",
|
||||
"subsystem": "时间时区",
|
||||
"fileName": "time"
|
||||
},
|
||||
{
|
||||
"syscap": "ScreenLock",
|
||||
"subsystem": "主题",
|
||||
"fileName": "theme"
|
||||
},
|
||||
{
|
||||
"syscap": "Pasteboard",
|
||||
"subsystem": "剪贴板",
|
||||
"fileName": "pasteboard"
|
||||
},
|
||||
{
|
||||
"syscap": "InputMethodFramework",
|
||||
"subsystem": "输入法",
|
||||
"fileName": "input-method-framework"
|
||||
},{
|
||||
"syscap": "Driver",
|
||||
"subsystem": "驱动",
|
||||
"fileName": "driver"
|
||||
},{
|
||||
"syscap": "Developtools",
|
||||
"subsystem": "研发工具链",
|
||||
"fileName": "developtools"
|
||||
},{
|
||||
"syscap": "Bluetooth",
|
||||
"subsystem": "蓝牙",
|
||||
"fileName": "blue-tooth"
|
||||
},{
|
||||
"syscap": "NetManager",
|
||||
"subsystem": "网络管理·",
|
||||
"fileName": "net-manager"
|
||||
},{
|
||||
"syscap": "Print",
|
||||
"subsystem": "打印",
|
||||
"fileName": "print"
|
||||
},{
|
||||
"syscap": "Window",
|
||||
"subsystem": "窗口",
|
||||
"fileName": "window"
|
||||
},{
|
||||
"syscap": "Advertising",
|
||||
"subsystem": "广告服务",
|
||||
"fileName": "advertising"
|
||||
},{
|
||||
"syscap": "XTS",
|
||||
"subsystem": "XTS",
|
||||
"fileName": "xts"
|
||||
}
|
||||
]
|
||||
{
|
||||
"fileContent":[
|
||||
{
|
||||
"syscap": "ArkUI",
|
||||
"subsystem": "ArkUI开发框架",
|
||||
"fileName": "arkui"
|
||||
},
|
||||
{
|
||||
"syscap": "BundleManager",
|
||||
"subsystem": "包管理",
|
||||
"fileName": "bundle"
|
||||
},
|
||||
{
|
||||
"syscap": "Graphic",
|
||||
"subsystem": "图形图像",
|
||||
"fileName": "graphic"
|
||||
},
|
||||
{
|
||||
"syscap": "WindowManager",
|
||||
"subsystem": "窗口管理",
|
||||
"fileName": "window"
|
||||
},
|
||||
{
|
||||
"syscap": "Notification",
|
||||
"subsystem": "事件通知",
|
||||
"fileName": "notification"
|
||||
},
|
||||
{
|
||||
"syscap": "Communication",
|
||||
"subsystem": "基础通信",
|
||||
"fileName": "communication"
|
||||
},
|
||||
{
|
||||
"syscap": "Location",
|
||||
"subsystem": "位置服务",
|
||||
"fileName": "geolocation"
|
||||
},
|
||||
{
|
||||
"syscap": "MultimodalInput",
|
||||
"subsystem": "多模输入",
|
||||
"fileName": "multi-modal-input"
|
||||
},
|
||||
{
|
||||
"syscap": "PowerManager",
|
||||
"subsystem": "电源服务",
|
||||
"fileName": "battery"
|
||||
},
|
||||
{
|
||||
"syscap": "Multimedia",
|
||||
"subsystem": "OS媒体软件",
|
||||
"fileName": "multimedia"
|
||||
},
|
||||
{
|
||||
"syscap": "Telephony",
|
||||
"subsystem": "电话服务",
|
||||
"fileName": "telephony"
|
||||
},
|
||||
{
|
||||
"syscap": "Global",
|
||||
"subsystem": "全球化",
|
||||
"fileName": "global"
|
||||
},
|
||||
{
|
||||
"syscap": "Customization",
|
||||
"subsystem": "定制",
|
||||
"fileName": "customization"
|
||||
},
|
||||
{
|
||||
"syscap": "BarrierFree",
|
||||
"subsystem": "无障碍软件服务",
|
||||
"fileName": "accessibility"
|
||||
},
|
||||
{
|
||||
"syscap": "ResourceSchedule",
|
||||
"subsystem": "资源调度",
|
||||
"fileName": "resource-scheduler"
|
||||
},
|
||||
{
|
||||
"syscap": "Utils",
|
||||
"subsystem": "公共基础类库",
|
||||
"fileName": "compiler-and-runtime"
|
||||
},
|
||||
{
|
||||
"syscap": "HiviewDFX",
|
||||
"subsystem": "DFX",
|
||||
"fileName": "dfx"
|
||||
},
|
||||
{
|
||||
"syscap": "Update",
|
||||
"subsystem": "升级服务",
|
||||
"fileName": "update"
|
||||
},
|
||||
{
|
||||
"syscap": "DistributedHardware",
|
||||
"subsystem": "分布式硬件",
|
||||
"fileName": "distributed-hardware"
|
||||
},
|
||||
{
|
||||
"syscap": "Security",
|
||||
"subsystem": "安全基础能力",
|
||||
"fileName": "security"
|
||||
},
|
||||
{
|
||||
"syscap": "Account",
|
||||
"subsystem": "账号",
|
||||
"fileName": "account"
|
||||
},
|
||||
{
|
||||
"syscap": "UserIAM",
|
||||
"subsystem": "用户IAM",
|
||||
"fileName": "user-iam"
|
||||
},
|
||||
{
|
||||
"syscap": "FileManagement",
|
||||
"subsystem": "文件管理",
|
||||
"fileName": "file-management"
|
||||
},
|
||||
{
|
||||
"syscap": "USB",
|
||||
"subsystem": "USB服务",
|
||||
"fileName": "usb"
|
||||
},
|
||||
{
|
||||
"syscap": "Sensors",
|
||||
"subsystem": "泛sensor服务",
|
||||
"fileName": "sensor"
|
||||
},
|
||||
{
|
||||
"syscap": "Startup",
|
||||
"subsystem": "启动恢复",
|
||||
"fileName": "start-up"
|
||||
},
|
||||
{
|
||||
"syscap": "DistributedDataManager",
|
||||
"subsystem": "分布式数据管理",
|
||||
"fileName": "distributed-data"
|
||||
},
|
||||
{
|
||||
"syscap": "Ability",
|
||||
"subsystem": "元能力",
|
||||
"fileName": "ability"
|
||||
},
|
||||
{
|
||||
"syscap": "Web",
|
||||
"subsystem": "web",
|
||||
"fileName": "web"
|
||||
},
|
||||
{
|
||||
"syscap": "Applications",
|
||||
"subsystem": "应用",
|
||||
"fileName": "application"
|
||||
},
|
||||
{
|
||||
"syscap": "Msdp",
|
||||
"subsystem": "综合传感处理平台",
|
||||
"fileName": "msdp"
|
||||
},
|
||||
{
|
||||
"syscap": "Test",
|
||||
"subsystem": "测试框架",
|
||||
"fileName": "unitest"
|
||||
},
|
||||
{
|
||||
"syscap": "Base",
|
||||
"subsystem": "SDK",
|
||||
"fileName": "sdk"
|
||||
},
|
||||
{
|
||||
"syscap": "AI",
|
||||
"subsystem": "AI业务",
|
||||
"fileName": "ai"
|
||||
},
|
||||
{
|
||||
"syscap": "Request",
|
||||
"subsystem": "上传下载",
|
||||
"fileName": "download-upload"
|
||||
},
|
||||
{
|
||||
"syscap": "Download",
|
||||
"subsystem": "上传下载",
|
||||
"fileName": "download-upload"
|
||||
},
|
||||
{
|
||||
"syscap": "Upload",
|
||||
"subsystem": "上传下载",
|
||||
"fileName": "download-upload"
|
||||
},
|
||||
{
|
||||
"syscap": "Wallpaper",
|
||||
"subsystem": "主题",
|
||||
"fileName": "theme"
|
||||
},
|
||||
{
|
||||
"syscap": "Time",
|
||||
"subsystem": "时间时区",
|
||||
"fileName": "time"
|
||||
},
|
||||
{
|
||||
"syscap": "ScreenLock",
|
||||
"subsystem": "主题",
|
||||
"fileName": "theme"
|
||||
},
|
||||
{
|
||||
"syscap": "Pasteboard",
|
||||
"subsystem": "剪贴板",
|
||||
"fileName": "pasteboard"
|
||||
},
|
||||
{
|
||||
"syscap": "InputMethodFramework",
|
||||
"subsystem": "输入法",
|
||||
"fileName": "input-method-framework"
|
||||
},{
|
||||
"syscap": "Driver",
|
||||
"subsystem": "驱动",
|
||||
"fileName": "driver"
|
||||
},{
|
||||
"syscap": "Developtools",
|
||||
"subsystem": "研发工具链",
|
||||
"fileName": "developtools"
|
||||
},{
|
||||
"syscap": "Bluetooth",
|
||||
"subsystem": "蓝牙",
|
||||
"fileName": "blue-tooth"
|
||||
},{
|
||||
"syscap": "NetManager",
|
||||
"subsystem": "网络管理·",
|
||||
"fileName": "net-manager"
|
||||
},{
|
||||
"syscap": "Print",
|
||||
"subsystem": "打印",
|
||||
"fileName": "print"
|
||||
},{
|
||||
"syscap": "Window",
|
||||
"subsystem": "窗口",
|
||||
"fileName": "window"
|
||||
},{
|
||||
"syscap": "Advertising",
|
||||
"subsystem": "广告服务",
|
||||
"fileName": "advertising"
|
||||
},{
|
||||
"syscap": "XTS",
|
||||
"subsystem": "XTS",
|
||||
"fileName": "xts"
|
||||
}
|
||||
]
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_01.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_01.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about delete systemapi
|
||||
*
|
||||
* @systemapi
|
||||
*/
|
||||
export class Test {}
|
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_02.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_02.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change permission value
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
/**
|
||||
* @permission ohos.permission.GRANT_SENSITIVE_PERMISSIONS and ohos.permission.KEEP_BACKGROUND_RUNNING
|
||||
*/
|
||||
function func(str: string): void;
|
||||
}
|
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_03.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_03.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change permission value
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
/**
|
||||
* @permission ohos.permission.GET_SENSITIVE_PERMISSIONS
|
||||
*/
|
||||
function func(str: string): void;
|
||||
}
|
27
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_04.d.ts
vendored
Normal file
27
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_04.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change throws from na to has
|
||||
*
|
||||
*/
|
||||
export class Test {
|
||||
/**
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - non-system app called system api.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
*/
|
||||
func(str: string): void;
|
||||
}
|
28
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_05.d.ts
vendored
Normal file
28
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_05.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change throws
|
||||
*
|
||||
*/
|
||||
export class Test {
|
||||
/**
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - non-system app called system api.
|
||||
* @throws { BusinessError } 404 - The parameter check failed.
|
||||
*/
|
||||
func(str: string): void;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_06.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_06.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about delete form
|
||||
*
|
||||
*/
|
||||
export class Test {
|
||||
func(str: string): void;
|
||||
}
|
20
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_07.d.ts
vendored
Normal file
20
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_07.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about reduce crossplatform
|
||||
*
|
||||
*/
|
||||
export namespace test {}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_08.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_08.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change api
|
||||
*/
|
||||
export namespace test {
|
||||
function func2(str: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_09.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_09.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change famodelonly to stagemodelonly
|
||||
*
|
||||
* @stagemodelonly
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_10.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_10.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change stagemodelonly to famodelonly
|
||||
*
|
||||
* @famodelonly
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_11.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_11.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about add stagemodelonly
|
||||
*
|
||||
* @stagemodelonly
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_12.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_12.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about add famodelonly
|
||||
*
|
||||
* @famodelonly
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_13.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_13.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for add function return type
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): string | number {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_14.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_14.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for reduce function return type
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): string {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_15.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_15.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change function return type
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): number {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_16.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_16.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change function param pos
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str2: string, str: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_17.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_17.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for add function param which is required
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string, str3: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_18.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_18.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for reduce function param
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_19.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_19.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change function param what from not required to required
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): void {}
|
||||
}
|
26
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_20.d.ts
vendored
Normal file
26
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_20.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default fileIo;
|
||||
|
||||
declare namespace fileIo {
|
||||
export { copyDir };
|
||||
}
|
||||
|
||||
declare function copyDir(src: number, dest: string, mode?: number): Promise<void>;
|
||||
|
||||
declare function copyDir(src: string, dest: string, callback: AsyncCallback<void>): ConflictFiles;
|
||||
|
||||
declare function copyDir(src: string, dest: string, callback: AsyncCallback<void, Array<ConflictFiles>>): void;
|
3
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_21.d.ts
vendored
Normal file
3
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_21.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
declare namespace Test {
|
||||
function testFun(a: number, b: string, c?: number): void;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_22.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_22.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change one which is readonly to required
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
readonly constant: 1;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_23.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_23.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change one which is writable to not required
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str?: string;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_24.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_24.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change one which is writable to required
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str: string;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_25.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_25.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change type
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str: number;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_26.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_26.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about expand type which is readonly
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
readonly constant: string | number;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@Component
|
||||
struct MyComponent {
|
||||
@Prop primaryText: ResourceStrs;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_28.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_28.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about reduce type which is writable
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str: string;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
struct MyComponent {
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_30.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_30.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change constant value
|
||||
*/
|
||||
export namespace test {
|
||||
const CONSTANT = 2;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_31.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_31.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for type value about change
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
type Type = 'new';
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_32.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_32.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for type value about expand
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
type Type = 'none' | 'new';
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_33.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_33.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for type value about reduce
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
type Type = 'none';
|
||||
}
|
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_34.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_34.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change enum menber value
|
||||
*/
|
||||
export enum Test {
|
||||
VALUE_ONE = 2,
|
||||
|
||||
VALUE_TWO,
|
||||
|
||||
VALUE_THREE,
|
||||
}
|
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_35.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_35.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change enum add menber
|
||||
*/
|
||||
export enum Test {
|
||||
VALUE_ONE,
|
||||
|
||||
VALUE_TWO,
|
||||
|
||||
VALUE_THREE,
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_36.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/new/API_CHANGE_INCOMPATIBLE_36.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change constant value
|
||||
*/
|
||||
export namespace test {
|
||||
const CONSTANT = 2;
|
||||
}
|
BIN
build-tools/dts_parser/test/ut/apiChange/new/image.png
Normal file
BIN
build-tools/dts_parser/test/ut/apiChange/new/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
20
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_01.d.ts
vendored
Normal file
20
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_01.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about delete systemapi
|
||||
*
|
||||
*/
|
||||
export class Test {}
|
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_02.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_02.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change permission value
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
/**
|
||||
* @permission ohos.permission.GRANT_SENSITIVE_PERMISSIONS
|
||||
*/
|
||||
function func(str: string): void;
|
||||
}
|
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_03.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_03.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change permission value
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
/**
|
||||
* @permission ohos.permission.GRANT_SENSITIVE_PERMISSIONS
|
||||
*/
|
||||
function func(str: string): void;
|
||||
}
|
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_04.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_04.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change throws from na to has
|
||||
*
|
||||
*/
|
||||
export class Test {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
func(str: string): void;
|
||||
}
|
27
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_05.d.ts
vendored
Normal file
27
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_05.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change throws
|
||||
*
|
||||
*/
|
||||
export class Test {
|
||||
/**
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - non-system app called system api.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
*/
|
||||
func(str: string): void;
|
||||
}
|
23
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_06.d.ts
vendored
Normal file
23
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_06.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about delete form
|
||||
*
|
||||
* @form
|
||||
*/
|
||||
export class Test {
|
||||
func(str: string): void;
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_07.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_07.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about reduce crossplatform
|
||||
*
|
||||
* @crossplatform
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_08.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_08.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change api
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_09.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_09.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change famodelonly to stagemodelonly
|
||||
*
|
||||
* @famodelonly
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_10.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_10.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about change stagemodelonly to famodelonly
|
||||
*
|
||||
* @stagemodelonly
|
||||
*/
|
||||
export namespace test {}
|
20
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_11.d.ts
vendored
Normal file
20
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_11.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about add stagemodelonly
|
||||
*
|
||||
*/
|
||||
export namespace test {}
|
20
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_12.d.ts
vendored
Normal file
20
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_12.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for jsdoc about add famodelonly
|
||||
*
|
||||
*/
|
||||
export namespace test {}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_13.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_13.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for add function return type
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): string {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_14.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_14.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for reduce function return type
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): string | number {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_15.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_15.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change function return type
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): string {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_16.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_16.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change function param pos
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_17.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_17.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for add function param which is required
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_18.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_18.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for reduce function param
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2: string): void {}
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_19.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_19.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change function param what from not required to required
|
||||
*/
|
||||
export namespace test {
|
||||
function func(str: string, str2?: string): void {}
|
||||
}
|
26
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_20.d.ts
vendored
Normal file
26
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_20.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default fileIo;
|
||||
|
||||
declare namespace fileIo {
|
||||
export { copyDir };
|
||||
}
|
||||
|
||||
declare function copyDir(src: string, dest: string, mode?: number): Promise<void>;
|
||||
|
||||
declare function copyDir(src: string, dest: string, callback: AsyncCallback<void>): void;
|
||||
|
||||
declare function copyDir(src: string, dest: string, callback: AsyncCallback<void, Array<ConflictFiles>>): void;
|
3
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_21.d.ts
vendored
Normal file
3
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_21.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
declare namespace Test {
|
||||
function testFun(a: number | string, b: string, c?: number): void;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_22.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_22.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change one which is readonly to required
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
readonly constant?: 1;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_23.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_23.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change one which is writable to not required
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str: string;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_24.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_24.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change one which is writable to required
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str?: string;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_25.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_25.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about change type
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str: string;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_26.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_26.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about expand type which is readonly
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
readonly constant: string;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@Component
|
||||
struct MyComponent {
|
||||
@Prop primaryText: ResourceStr;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_28.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_28.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for property about reduce type which is writable
|
||||
*
|
||||
*/
|
||||
export interface Test {
|
||||
str: string | number;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
@Component
|
||||
struct MyComponent {
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_30.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_30.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change constant value
|
||||
*/
|
||||
export namespace test {
|
||||
const CONSTANT = 1;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_31.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_31.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for type value about change
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
type Type = 'none' ;
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_32.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_32.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for type value about expand
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
type Type = 'none';
|
||||
}
|
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_33.d.ts
vendored
Normal file
22
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_33.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for type value about expand
|
||||
*
|
||||
*/
|
||||
export namespace test {
|
||||
type Type = 'none' | 'new';
|
||||
}
|
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_34.d.ts
vendored
Normal file
25
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_34.d.ts
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change enum menber value
|
||||
*/
|
||||
export enum Test {
|
||||
VALUE_ONE,
|
||||
|
||||
VALUE_TWO,
|
||||
|
||||
VALUE_THREE,
|
||||
}
|
23
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_35.d.ts
vendored
Normal file
23
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_35.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change enum add menber
|
||||
*/
|
||||
export enum Test {
|
||||
VALUE_ONE,
|
||||
|
||||
VALUE_TWO,
|
||||
}
|
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_36.d.ts
vendored
Normal file
21
build-tools/dts_parser/test/ut/apiChange/old/API_CHANGE_INCOMPATIBLE_36.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* the ut for change constant value
|
||||
*/
|
||||
export namespace test {
|
||||
const CONSTANT = 1;
|
||||
}
|
BIN
build-tools/dts_parser/test/ut/apiChange/old/image.png
Normal file
BIN
build-tools/dts_parser/test/ut/apiChange/old/image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user