From 714f5a026082164dc1c1d2299a53e9c867c04630 Mon Sep 17 00:00:00 2001 From: Mamatha1718 Date: Sat, 21 Dec 2024 22:36:07 +0530 Subject: [PATCH 1/7] class-declaration-abstractness-changed Signed-off-by: Mamatha Bandi --- .../src/comparers/class-declarations.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/concerto-analysis/src/comparers/class-declarations.ts b/packages/concerto-analysis/src/comparers/class-declarations.ts index 9da52b59b..859eee2d7 100644 --- a/packages/concerto-analysis/src/comparers/class-declarations.ts +++ b/packages/concerto-analysis/src/comparers/class-declarations.ts @@ -54,11 +54,17 @@ const classDeclarationTypeChanged: ComparerFactory = (context) => ({ if (aType === bType) { return; } - context.report({ - key: 'class-declaration-type-changed', - message: `The ${aType} "${a.getName()}" changed type from ${aType} to ${bType}`, - element: a - }); + + const isAbstract = (declaration) => declaration.isAbstract(); + if (isAbstract(a) !== isAbstract(b)) { + const changeType = isAbstract(a) ? 'abstract to concrete' : 'concrete to abstract'; + const changeSeverity = isAbstract(a) ? 'minor' : 'major'; + context.report({ + key: 'class-declaration-abstractness-changed', + message: `The class "${a.getName()}" changed from ${changeType} (${changeSeverity} change).`, + element: a + }); + } } }); From 4b88bfa7a30420ac91d2f11a016e884a9ca68680 Mon Sep 17 00:00:00 2001 From: Mamatha1718 Date: Sun, 22 Dec 2024 10:20:24 +0530 Subject: [PATCH 2/7] wq wq class-declaration-abstractness-changed with adding rules wq Signed-off-by: Mamatha Bandi Signed-off-by: Mamatha Bandi --- packages/concerto-analysis/src/compare-config.ts | 2 ++ .../src/comparers/class-declarations.ts | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/concerto-analysis/src/compare-config.ts b/packages/concerto-analysis/src/compare-config.ts index 511f660dc..25581c9c5 100644 --- a/packages/concerto-analysis/src/compare-config.ts +++ b/packages/concerto-analysis/src/compare-config.ts @@ -53,6 +53,8 @@ export const defaultCompareConfig: CompareConfig = { 'optional-property-added': CompareResult.PATCH, 'required-property-removed': CompareResult.MAJOR, 'optional-property-removed': CompareResult.MAJOR, + 'class-declaration-abstract-to-concrete': CompareResult.MINOR, + 'class-declaration-concrete-to-abstract': CompareResult.MAJOR, 'namespace-changed': CompareResult.ERROR, 'enum-value-added': CompareResult.PATCH, 'enum-value-removed': CompareResult.MAJOR, diff --git a/packages/concerto-analysis/src/comparers/class-declarations.ts b/packages/concerto-analysis/src/comparers/class-declarations.ts index 859eee2d7..a00190a70 100644 --- a/packages/concerto-analysis/src/comparers/class-declarations.ts +++ b/packages/concerto-analysis/src/comparers/class-declarations.ts @@ -54,14 +54,22 @@ const classDeclarationTypeChanged: ComparerFactory = (context) => ({ if (aType === bType) { return; } - + if(aType !== bType){ + context.report({ + key: `class-declaration-type-changed`, + message: `The ${aType} "${a.getName()}" changed from ${aType} to ${bType}`, + element: a + }); + } + + //add Logic for abstractness changes const isAbstract = (declaration) => declaration.isAbstract(); if (isAbstract(a) !== isAbstract(b)) { const changeType = isAbstract(a) ? 'abstract to concrete' : 'concrete to abstract'; - const changeSeverity = isAbstract(a) ? 'minor' : 'major'; + const changeKey =isAbstract(a) ? `class-declaration-abstract-to-concrete` : `class-declaration-concrete-to-abstract`; context.report({ - key: 'class-declaration-abstractness-changed', - message: `The class "${a.getName()}" changed from ${changeType} (${changeSeverity} change).`, + key: changeKey, + message: `The class "${a.getName()}" changed from ${changeType}.`, element: a }); } From 9b3e8c91a50f1fe42993180212fd5f458ea238e4 Mon Sep 17 00:00:00 2001 From: Mamatha Bandi Date: Wed, 22 Jan 2025 23:45:04 +0530 Subject: [PATCH 3/7] class-declaration-abstractness-changed with adding rules Signed-off-by: Mamatha Bandi Signed-off-by: Mamatha Bandi --- "\357\200\272wq" | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 "\357\200\272wq" diff --git "a/\357\200\272wq" "b/\357\200\272wq" new file mode 100644 index 000000000..6449b025a --- /dev/null +++ "b/\357\200\272wq" @@ -0,0 +1,33 @@ +pick b5733c65 class-declaration-abstractness-changed with adding rules +pick b5733c65 wq wq class-declaration-abstractness-changed with adding rules wq Signed-off-by: Mamatha Bandi + +# Rebase eb1fde0c..b5733c65 onto eb1fde0c (1 command) +# +# Commands: +# p, pick = use commit +# r, reword = use commit, but edit the commit message +# e, edit = use commit, but stop for amending +# s, squash = use commit, but meld into previous commit +# f, fixup [-C | -c] = like "squash" but keep only the previous +# commit's log message, unless -C is used, in which case +# keep only this commit's message; -c is same as -C but +# opens the editor +# x, exec = run command (the rest of the line) using shell +# b, break = stop here (continue rebase later with 'git rebase --continue') +# d, drop = remove commit +# l, label