• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 - 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16export type Range = [number, number];
17
18export class FixInfo {
19    fixed?: boolean = false;
20}
21
22// eslint修复信息
23export class RuleFix extends FixInfo {
24    /**
25     * 被修复字符串的起始位置
26     */
27    range: Range;
28    /**
29     * 要替换的文本
30     */
31    text: string;
32}
33
34// homecheck的修复信息
35export class FunctionFix extends FixInfo {
36    /**
37     * 修复方法,入参为ArkFile和fixkey
38     */
39    fix: Function;
40}
41
42// AI修复的信息
43export class AIFix extends FixInfo {
44    /**
45     * 提供给大模型的修复语义
46     */
47    text: string[];
48}
49
50export enum FixMode {
51    AST,
52    ARKFILE,
53    AI,
54    UNKNOWN
55}