• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3# Copyright (c) 2024 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import enum
17
18
19class Output:
20    file_path = ''
21    error_type = ''
22    defined_text = ''
23    position = ''
24    error_info = ''
25
26    def __init__(self, file_path, error_type, defined_text, position, error_info):
27        self.file_path = file_path
28        self.error_type = error_type
29        self.defined_text = defined_text
30        self.position = position
31        self.error_info = error_info
32
33
34class ErrorMessage(enum.Enum):
35    MUTEX_LABEL = 'In the same API, [$] tag and [&] tag are mutually exclusive'
36    RELATIVE_LABEL = 'Functions that appear in pairs,[$] function missing [&] tag'
37    ENUM_VALUE_LABEL = ('The enumeration type [$] is labeled with [&], but none of the enumeration '
38                        'values are labeled with this label')
39    ENUM_LABEL = ('The enumeration type [$] is not marked with [&], '
40                  'but the enumeration value is marked with this label')
41    PARENT_HAVE_METHOD_NO = '[$] has a [&] label, but none of its methods have a [&] label'
42    METHOD_HAVE_PARENT_NO = '[$]does not have [&] label,but the methods below it has [&] label'
43    METHOD_HAVE_INPUT_PARAM_NO = 'functions have [&] label, but the param do not have [&] label'
44    METHOD_HAVE_OUTPUT_PARAM_NO = 'functions have [&] label, but the return value do not have [&] label'
45    METHOD_HAVE_PARAM_OBJ_NO = 'functions have [&] label, but the argument anonymous object do not have [&] label'
46    METHOD_HAVE_RETURN_OBJ_NO = 'functions have [&] label, but the return anonymous objects do not have [&] label'
47    PROPERTY_HAVE_REFERENCE_NO = 'property have [&] label, but the reference of property do not have [&] label'
48    REFERENCE_HAVE_PROPERTY_NO = 'reference of property have [&] label, but the property do not have [&] label'
49    PROPERTY_HAVE_REFERENCE_OBJ_NO = 'property have [&] label, but the reference_obj of property do not have [&] label'
50    REFERENCE_OBJ_HAVE_PROPERTY_NO = 'reference_obj of property have [&] label, but the property do not have [&] label'
51
52
53class ErrorType(enum.Enum):
54    MUTEX_LABEL = 'mutex_label'
55    ENUM_LABEL = 'enum_missing_label'
56    ENUM_VALUE_LABEL = 'enum_value_missing_label'
57    RELATIVE_LABEL = 'paired_function_omission_label'
58    PARENT_NO_TAG = '$_missing_label'
59    CHILD_NO_TAG = 'method_missing_label'
60    PARAM_NO_TAG = 'param_missing_label'
61    RETURN_NO_TAG = 'return_missing_label'
62    PARAM_OBJ_NO_TAG = 'param_anonymous_object_missing_label'
63    RETURN_OBJ_NO_TAG = 'return_anonymous_object_missing_label'
64    PROPERTY_NO_TAG = 'property_missing_label'
65    PROPERTY_REFERENCE_NO_TAG = 'property_of_reference_missing_label'
66    PROPERTY_REFERENCE_OBJ_NO_TAG = 'property_of_reference_obj_missing_label'
67