Skip to content

Commit

Permalink
Merge pull request #807 from jecisc/renraku
Browse files Browse the repository at this point in the history
Migrate rules to Renraku
  • Loading branch information
jecisc authored Jul 19, 2024
2 parents ac03287 + 0721274 commit 1b5ccf2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 44 deletions.
10 changes: 0 additions & 10 deletions src/Moose-Core-Tests/FAMIXLintRuleTest.class.st

This file was deleted.

39 changes: 19 additions & 20 deletions src/Moose-Core/FAMIXMetaModelClassesNotDeclaredInFameRule.class.st
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
"
Check if a metamodel class is properly declared using a <MSEClass:super:> pragma.
Check if a metamodel class is properly declared using a <FMClass:super:> pragma.
Additionally, this pragma should be in a #annotation class-side method, although this is not enforced. Default Moose tools are resilient with respect to metamodel descriptions, and accept as metamodel classes any subclass of MooseEntity. This rule enforces that all such classes are properly described in Fame, ensuring proper use by strict tools.
"
Class {
#name : #FamixMetaModelClassesNotDeclaredInFameRule,
#superclass : #RBBlockLintRule,
#superclass : #ReAbstractRule,
#instVars : [
'metaModelClasses'
],
#category : #'Moose-Core'
}

{ #category : #testing }
FamixMetaModelClassesNotDeclaredInFameRule class >> checksClass [

^ true
]

{ #category : #accessing }
FamixMetaModelClassesNotDeclaredInFameRule class >> group [

Expand All @@ -29,28 +35,21 @@ FamixMetaModelClassesNotDeclaredInFameRule class >> uniqueIdentifierName [
]

{ #category : #running }
FamixMetaModelClassesNotDeclaredInFameRule >> checkClass: aContext [
| class pragmas |
class := aContext.

(self metaModelClasses includes: class instanceSide)
ifTrue: [ pragmas := Pragma allNamed: #FMClass:super: in: class.
pragmas
ifEmpty: [ class isMeta ifTrue: [ result addClass: class ].
^ self ].
pragmas size > 1
ifTrue: [ result addClass: class.
^ self ] ]
FamixMetaModelClassesNotDeclaredInFameRule >> basicCheck: aClass [

| pragmas |
(self metaModelClasses includes: aClass instanceSide) ifTrue: [
pragmas := Pragma allNamed: #FMClass:super: in: aClass.
pragmas ifEmpty: [
aClass isMeta ifTrue: [ ^ true ].
^ false ].
pragmas size > 1 ifTrue: [ ^ true ] ].

^ false
]

{ #category : #accessing }
FamixMetaModelClassesNotDeclaredInFameRule >> metaModelClasses [
"return all classes that have to be checked in this rule"
^ metaModelClasses ifNil: [metaModelClasses := MooseEntity withAllSubclasses].
]

{ #category : #running }
FamixMetaModelClassesNotDeclaredInFameRule >> resultClass [

^ RBClassEnvironment
]
25 changes: 11 additions & 14 deletions src/Moose-Core/FAMIXMetaModelClassesShouldNotOverrideRule.class.st
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
Class {
#name : #FamixMetaModelClassesShouldNotOverrideRule,
#superclass : #RBBlockLintRule,
#superclass : #ReAbstractRule,
#instVars : [
'metaModelClasses'
],
#category : #'Moose-Core'
}

{ #category : #testing }
FamixMetaModelClassesShouldNotOverrideRule class >> checksClass [

^ true
]

{ #category : #accessing }
FamixMetaModelClassesShouldNotOverrideRule class >> group [

Expand All @@ -31,19 +37,10 @@ FamixMetaModelClassesShouldNotOverrideRule class >> uniqueIdentifierName [
]

{ #category : #running }
FamixMetaModelClassesShouldNotOverrideRule >> checkClass: aContext [
|class |
class := aContext.

(self metaModelClasses includes: class)
ifTrue: [
self selectorsThatShouldNotBeOverridden do: [:each |
(class includesSelector: each)
ifTrue: [
result addClass: class selector: each
].
].
].
FamixMetaModelClassesShouldNotOverrideRule >> basicCheck: aClass [

(self metaModelClasses includes: aClass) ifTrue: [ self selectorsThatShouldNotBeOverridden do: [ :each | (aClass includesSelector: each) ifTrue: [ ^ true ] ] ].
^ false
]

{ #category : #accessing }
Expand Down

0 comments on commit 1b5ccf2

Please sign in to comment.