Skip to content

Commit

Permalink
class-declaration-abstractness-changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamatha1718 committed Dec 21, 2024
1 parent 85366be commit eb1fde0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/concerto-analysis/src/comparers/class-declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
}
});

Expand Down

0 comments on commit eb1fde0

Please sign in to comment.