From e88959e66bd5b944a46c70c0d7b4ed585d3a1d2e Mon Sep 17 00:00:00 2001 From: Evgeniy Okolnov Date: Thu, 7 Dec 2023 12:37:13 +0300 Subject: [PATCH] [ArkTS][Linter] Fix CodeCheck reports in ArkTS Linter tests Issue: https://gitee.com/openharmony/arkcompiler_ets_frontend/issues/I8ML6C Testing: build and linter tests Signed-off-by: Evgeniy Okolnov --- ets2panda/linter-4.2/test/mapped_types.ts | 60 ++++----- .../test/mapped_types.ts.relax.json | 114 ++++++++++++------ .../test/mapped_types.ts.strict.json | 114 ++++++++++++------ ets2panda/linter/test/mapped_types.ts | 60 ++++----- .../linter/test/mapped_types.ts.relax.json | 114 ++++++++++++------ .../linter/test/mapped_types.ts.strict.json | 114 ++++++++++++------ 6 files changed, 366 insertions(+), 210 deletions(-) diff --git a/ets2panda/linter-4.2/test/mapped_types.ts b/ets2panda/linter-4.2/test/mapped_types.ts index 61abad11d8..47e9d6ef66 100644 --- a/ets2panda/linter-4.2/test/mapped_types.ts +++ b/ets2panda/linter-4.2/test/mapped_types.ts @@ -13,55 +13,57 @@ * limitations under the License. */ -type OptionsFlags = { - [Property in keyof Type]: boolean; +type Flags = { + [P in keyof T]: boolean; }; -type FeatureFlags = { - darkMode: () => void; - newUserProfile: () => void; +type MyFlags = { + firstFlag: () => void; + secondFlag: () => void; }; -type FeatureOptions = OptionsFlags; +type MyOptions = Flags; // Removes 'readonly' attributes from a type's properties -type CreateMutable = { - -readonly [Property in keyof Type]: Type[Property]; +type RemoveReadonly = { + -readonly [P in keyof T]: T[P]; }; -type LockedAccount = { +type MutableObject = { readonly id: string; readonly name: string; }; -type UnlockedAccount = CreateMutable; +type ImmutableObject = RemoveReadonly; // Removes 'optional' attributes from a type's properties -type Concrete = { - [Property in keyof Type]-?: Type[Property]; +type RemoveOptional = { + [P in keyof T]-?: T[P]; }; -type MaybeUser = { +type PartialObject = { id: string; name?: string; age?: number; }; -type User = Concrete; +type CompleteObject = RemoveOptional; // Creates new property names from prior ones: -type Getters = { - [Property in keyof Type as `get${Capitalize< - string & Property - >}`]: () => Type[Property]; +type PropertiesToGetters = { + [P in keyof T as `get${Capitalize< + string & P + >}`]: () => T[P]; }; -interface Person { - name: string; - age: number; - location: string; +interface User { + login: string; + email: string; + data: string; } -type LazyPerson = Getters; +type LazyUser = PropertiesToGetters; // Combine with Conditional type: -type ExtractPII = { - [Property in keyof Type]: Type[Property] extends { pii: true } ? true : false; +type ExtractBar = { + [Prop in keyof T]: T[Prop] extends { bar: true } + ? true + : false; }; -type DBFields = { - id: { format: 'incrementing' }; - name: { type: string; pii: true }; +type Entity = { + identity: { name: 'Object' }; + details: { foo: string; bar: true }; }; -type ObjectsNeedingGDPRDeletion = ExtractPII; +type ExtractedProps = ExtractBar; diff --git a/ets2panda/linter-4.2/test/mapped_types.ts.relax.json b/ets2panda/linter-4.2/test/mapped_types.ts.relax.json index 56c3b30374..6e9f6f0879 100644 --- a/ets2panda/linter-4.2/test/mapped_types.ts.relax.json +++ b/ets2panda/linter-4.2/test/mapped_types.ts.relax.json @@ -16,98 +16,136 @@ "nodes": [ { "line": 16, - "column": 27, - "problem": "MappedType" + "column": 17, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 19, - "column": 21, - "problem": "ObjectTypeLiteral" + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 26, - "column": 28, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 27, - "column": 39, - "problem": "IndexedAccessType" + "column": 29, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 29, "column": 22, - "problem": "ObjectTypeLiteral" + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 36, - "column": 23, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 37, - "column": 31, - "problem": "IndexedAccessType" + "column": 21, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 39, - "column": 18, - "problem": "ObjectTypeLiteral" + "column": 22, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 47, - "column": 22, - "problem": "MappedType" + "column": 31, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 48, - "column": 36, - "problem": "UtilityType" + "column": 26, + "problem": "UtilityType", + "suggest": "", + "rule": "Some of utility types are not supported (arkts-no-utility-types)" }, { "line": 49, "column": 5, - "problem": "IntersectionType" + "problem": "IntersectionType", + "suggest": "", + "rule": "Use inheritance instead of intersection types (arkts-no-intersection-types)" }, { "line": 50, "column": 15, - "problem": "IndexedAccessType" + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 60, - "column": 25, - "problem": "MappedType" + "column": 22, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 61, - "column": 29, - "problem": "ConditionalType" + "column": 22, + "problem": "ConditionalType", + "suggest": "", + "rule": "Conditional types are not supported (arkts-no-conditional-types)" }, { "line": 61, - "column": 29, - "problem": "IndexedAccessType" + "column": 22, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 61, - "column": 52, - "problem": "ObjectTypeLiteral" + "column": 38, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 63, - "column": 17, - "problem": "ObjectTypeLiteral" + "line": 65, + "column": 15, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 64, - "column": 7, - "problem": "ObjectTypeLiteral" + "line": 66, + "column": 13, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 65, - "column": 9, - "problem": "ObjectTypeLiteral" + "line": 67, + "column": 12, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" } ] } \ No newline at end of file diff --git a/ets2panda/linter-4.2/test/mapped_types.ts.strict.json b/ets2panda/linter-4.2/test/mapped_types.ts.strict.json index 56c3b30374..6e9f6f0879 100644 --- a/ets2panda/linter-4.2/test/mapped_types.ts.strict.json +++ b/ets2panda/linter-4.2/test/mapped_types.ts.strict.json @@ -16,98 +16,136 @@ "nodes": [ { "line": 16, - "column": 27, - "problem": "MappedType" + "column": 17, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 19, - "column": 21, - "problem": "ObjectTypeLiteral" + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 26, - "column": 28, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 27, - "column": 39, - "problem": "IndexedAccessType" + "column": 29, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 29, "column": 22, - "problem": "ObjectTypeLiteral" + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 36, - "column": 23, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 37, - "column": 31, - "problem": "IndexedAccessType" + "column": 21, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 39, - "column": 18, - "problem": "ObjectTypeLiteral" + "column": 22, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 47, - "column": 22, - "problem": "MappedType" + "column": 31, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 48, - "column": 36, - "problem": "UtilityType" + "column": 26, + "problem": "UtilityType", + "suggest": "", + "rule": "Some of utility types are not supported (arkts-no-utility-types)" }, { "line": 49, "column": 5, - "problem": "IntersectionType" + "problem": "IntersectionType", + "suggest": "", + "rule": "Use inheritance instead of intersection types (arkts-no-intersection-types)" }, { "line": 50, "column": 15, - "problem": "IndexedAccessType" + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 60, - "column": 25, - "problem": "MappedType" + "column": 22, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 61, - "column": 29, - "problem": "ConditionalType" + "column": 22, + "problem": "ConditionalType", + "suggest": "", + "rule": "Conditional types are not supported (arkts-no-conditional-types)" }, { "line": 61, - "column": 29, - "problem": "IndexedAccessType" + "column": 22, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 61, - "column": 52, - "problem": "ObjectTypeLiteral" + "column": 38, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 63, - "column": 17, - "problem": "ObjectTypeLiteral" + "line": 65, + "column": 15, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 64, - "column": 7, - "problem": "ObjectTypeLiteral" + "line": 66, + "column": 13, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 65, - "column": 9, - "problem": "ObjectTypeLiteral" + "line": 67, + "column": 12, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/mapped_types.ts b/ets2panda/linter/test/mapped_types.ts index 61abad11d8..47e9d6ef66 100644 --- a/ets2panda/linter/test/mapped_types.ts +++ b/ets2panda/linter/test/mapped_types.ts @@ -13,55 +13,57 @@ * limitations under the License. */ -type OptionsFlags = { - [Property in keyof Type]: boolean; +type Flags = { + [P in keyof T]: boolean; }; -type FeatureFlags = { - darkMode: () => void; - newUserProfile: () => void; +type MyFlags = { + firstFlag: () => void; + secondFlag: () => void; }; -type FeatureOptions = OptionsFlags; +type MyOptions = Flags; // Removes 'readonly' attributes from a type's properties -type CreateMutable = { - -readonly [Property in keyof Type]: Type[Property]; +type RemoveReadonly = { + -readonly [P in keyof T]: T[P]; }; -type LockedAccount = { +type MutableObject = { readonly id: string; readonly name: string; }; -type UnlockedAccount = CreateMutable; +type ImmutableObject = RemoveReadonly; // Removes 'optional' attributes from a type's properties -type Concrete = { - [Property in keyof Type]-?: Type[Property]; +type RemoveOptional = { + [P in keyof T]-?: T[P]; }; -type MaybeUser = { +type PartialObject = { id: string; name?: string; age?: number; }; -type User = Concrete; +type CompleteObject = RemoveOptional; // Creates new property names from prior ones: -type Getters = { - [Property in keyof Type as `get${Capitalize< - string & Property - >}`]: () => Type[Property]; +type PropertiesToGetters = { + [P in keyof T as `get${Capitalize< + string & P + >}`]: () => T[P]; }; -interface Person { - name: string; - age: number; - location: string; +interface User { + login: string; + email: string; + data: string; } -type LazyPerson = Getters; +type LazyUser = PropertiesToGetters; // Combine with Conditional type: -type ExtractPII = { - [Property in keyof Type]: Type[Property] extends { pii: true } ? true : false; +type ExtractBar = { + [Prop in keyof T]: T[Prop] extends { bar: true } + ? true + : false; }; -type DBFields = { - id: { format: 'incrementing' }; - name: { type: string; pii: true }; +type Entity = { + identity: { name: 'Object' }; + details: { foo: string; bar: true }; }; -type ObjectsNeedingGDPRDeletion = ExtractPII; +type ExtractedProps = ExtractBar; diff --git a/ets2panda/linter/test/mapped_types.ts.relax.json b/ets2panda/linter/test/mapped_types.ts.relax.json index 56c3b30374..6e9f6f0879 100644 --- a/ets2panda/linter/test/mapped_types.ts.relax.json +++ b/ets2panda/linter/test/mapped_types.ts.relax.json @@ -16,98 +16,136 @@ "nodes": [ { "line": 16, - "column": 27, - "problem": "MappedType" + "column": 17, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 19, - "column": 21, - "problem": "ObjectTypeLiteral" + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 26, - "column": 28, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 27, - "column": 39, - "problem": "IndexedAccessType" + "column": 29, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 29, "column": 22, - "problem": "ObjectTypeLiteral" + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 36, - "column": 23, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 37, - "column": 31, - "problem": "IndexedAccessType" + "column": 21, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 39, - "column": 18, - "problem": "ObjectTypeLiteral" + "column": 22, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 47, - "column": 22, - "problem": "MappedType" + "column": 31, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 48, - "column": 36, - "problem": "UtilityType" + "column": 26, + "problem": "UtilityType", + "suggest": "", + "rule": "Some of utility types are not supported (arkts-no-utility-types)" }, { "line": 49, "column": 5, - "problem": "IntersectionType" + "problem": "IntersectionType", + "suggest": "", + "rule": "Use inheritance instead of intersection types (arkts-no-intersection-types)" }, { "line": 50, "column": 15, - "problem": "IndexedAccessType" + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 60, - "column": 25, - "problem": "MappedType" + "column": 22, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 61, - "column": 29, - "problem": "ConditionalType" + "column": 22, + "problem": "ConditionalType", + "suggest": "", + "rule": "Conditional types are not supported (arkts-no-conditional-types)" }, { "line": 61, - "column": 29, - "problem": "IndexedAccessType" + "column": 22, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 61, - "column": 52, - "problem": "ObjectTypeLiteral" + "column": 38, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 63, - "column": 17, - "problem": "ObjectTypeLiteral" + "line": 65, + "column": 15, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 64, - "column": 7, - "problem": "ObjectTypeLiteral" + "line": 66, + "column": 13, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 65, - "column": 9, - "problem": "ObjectTypeLiteral" + "line": 67, + "column": 12, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" } ] } \ No newline at end of file diff --git a/ets2panda/linter/test/mapped_types.ts.strict.json b/ets2panda/linter/test/mapped_types.ts.strict.json index 56c3b30374..6e9f6f0879 100644 --- a/ets2panda/linter/test/mapped_types.ts.strict.json +++ b/ets2panda/linter/test/mapped_types.ts.strict.json @@ -16,98 +16,136 @@ "nodes": [ { "line": 16, - "column": 27, - "problem": "MappedType" + "column": 17, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 19, - "column": 21, - "problem": "ObjectTypeLiteral" + "column": 16, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 26, - "column": 28, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 27, - "column": 39, - "problem": "IndexedAccessType" + "column": 29, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 29, "column": 22, - "problem": "ObjectTypeLiteral" + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 36, - "column": 23, - "problem": "MappedType" + "column": 26, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 37, - "column": 31, - "problem": "IndexedAccessType" + "column": 21, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 39, - "column": 18, - "problem": "ObjectTypeLiteral" + "column": 22, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { "line": 47, - "column": 22, - "problem": "MappedType" + "column": 31, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 48, - "column": 36, - "problem": "UtilityType" + "column": 26, + "problem": "UtilityType", + "suggest": "", + "rule": "Some of utility types are not supported (arkts-no-utility-types)" }, { "line": 49, "column": 5, - "problem": "IntersectionType" + "problem": "IntersectionType", + "suggest": "", + "rule": "Use inheritance instead of intersection types (arkts-no-intersection-types)" }, { "line": 50, "column": 15, - "problem": "IndexedAccessType" + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 60, - "column": 25, - "problem": "MappedType" + "column": 22, + "problem": "MappedType", + "suggest": "", + "rule": "Mapped type expression is not supported (arkts-no-mapped-types)" }, { "line": 61, - "column": 29, - "problem": "ConditionalType" + "column": 22, + "problem": "ConditionalType", + "suggest": "", + "rule": "Conditional types are not supported (arkts-no-conditional-types)" }, { "line": 61, - "column": 29, - "problem": "IndexedAccessType" + "column": 22, + "problem": "IndexedAccessType", + "suggest": "", + "rule": "Indexed access types are not supported (arkts-no-aliases-by-index)" }, { "line": 61, - "column": 52, - "problem": "ObjectTypeLiteral" + "column": 38, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 63, - "column": 17, - "problem": "ObjectTypeLiteral" + "line": 65, + "column": 15, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 64, - "column": 7, - "problem": "ObjectTypeLiteral" + "line": 66, + "column": 13, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" }, { - "line": 65, - "column": 9, - "problem": "ObjectTypeLiteral" + "line": 67, + "column": 12, + "problem": "ObjectTypeLiteral", + "suggest": "", + "rule": "Object literals cannot be used as type declarations (arkts-no-obj-literals-as-types)" } ] } \ No newline at end of file -- Gitee