1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3# Copyright (c) 2022 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 16class BCWarnInfo: 17 CHECK_RULE_2_1 = r"规则2.1 部件描述文件中字段须准确。" 18 19 NAME_NO_FIELD = r'缺少 "name" 字段。' 20 NAME_EMPTY = r'"name" 字段不能为空。' 21 NAME_FORMAT_ERROR = r"格式错误, 命名规则为: @{organization}/{component_name}。" 22 NAME_LOWCASE = r'"name" 字段的英文字符均为小写。' 23 COMPONENT_NAME_FROMAT = r"部件名使用小写加下划线风格命名, 如: unix_like。" 24 COMPONENT_NAME_FROMAT_LEN = r"部件名不能超过 63 个有效英文字符." 25 26 VERSION_EMPTY = r'"Version" 字段不能为空。' 27 VERSION_NO_FIELD = r'缺少 "version" 字段。' 28 VERSION_ERROR = r'"version" 值有误,请检查。' 29 30 SEGMENT_NO_FIELD = r'缺少 "segment" 字段。' 31 SEGMENT_DESTPATH_NO_FIELD = r'缺少 "segment:destPath" 字段。' 32 SEGMENT_DESTPATH_EMPTY = r'"segment:destPath" 字段不能为空。' 33 SEGMENT_DESTPATH_UNIQUE = r'"segment:destPath" 只能有一个路径。' 34 SEGMENT_DESTPATH_ABS = r'"segment:destPath" 只能为相对路径。' 35 36 COMPONENT_NO_FIELD = r'缺少 "component" 字段。' 37 COMPONENT_NAME_NO_FIELD = r'缺少 "component:name" 字段。' 38 COMPONENT_NAME_EMPTY = r'"component:name" 字段不能为空。' 39 COMPONENT_NAME_VERACITY = r'"component:name" 字段应该与 "name" 字段部件名部分相同。' 40 COMPONENT_SUBSYSTEM_NO_FIELD = r'缺少 "component:subsystem" 字段。' 41 COMPONENT_SUBSYSTEM_EMPTY = r'"component:subsystem" 字段不能为空。' 42 COMPONENT_SUBSYSTEM_LOWCASE = r'"component:subsystem" 值必须为全小写字母。' 43 COMPONENT_SYSCAP_STRING_EMPTY = r'"component:syscap" 中的值不能为空字符串。' 44 COMPONENT_SYSCAP_STRING_FORMAT_ERROR = r'''"component:syscap" 中的值命名规则为 "SystemCapability.子系统.部件能力.子能力(可选)"。 45 如, SystemCapability.Media.Camera, SystemCapability.Media.Camera.Front。并且每个部分必须为大驼峰命名规则''' 46 COMPONENT_FEATURES_STRING_EMPTY = r'"component:features" 中的值不能为空字符串。' 47 COMPONENT_FEATURES_SEPARATOR_ERROR = r'"component:features" 的值须加上部件名为前缀并以 "_" 为分隔符"。' 48 COMPONENT_FEATURES_FORMAT_ERROR = r'"component:features" 命名格式为 "{componentName}_feature_{featureName}"。' 49 COMPONENT_AST_NO_FIELD = r'缺少 "component:adapted_system_type" 字段。' 50 COMPONENT_AST_EMPTY = r'"component:adapted_system_type" 字段不能为空。' 51 COMPONENT_AST_NO_REP = r'"component:adapted_system_type" 值最多只能有 3 个("mini", "small", "standard")且不能重复。' 52 COMPONENT_ROM_NO_FIELD = r'缺少 "component:rom" 字段。' 53 COMPONENT_ROM_EMPTY = r'"component:rom" 字段不能为空。' 54 COMPONENT_ROM_SIZE_ERROR = r'"component:rom" 非数值或者小于0。' 55 COMPONENT_ROM_UNIT_ERROR = r'"component:rom" 的单位错误(KB, KByte, MByte, MB, 默认为KByte)' 56 COMPONENT_RAM_NO_FIELD = r'缺少 "component:ram" 字段。' 57 COMPONENT_RAM_EMPTY = r'"component:ram" 字段不能为空。' 58 COMPONENT_RAM_SIZE_ERROR = r'"component:ram" 非数值或者小于等于0。' 59 COMPONENT_RAM_UNIT_ERROR = r'"component:ram" 的单位错误(KB, KByte, MByte, MB, 默认为KByte)' 60 COMPONENT_DEPS_NO_FIELD = r'缺少 "component:deps" 字段。'