From 9c0970178e993cab5312a6ec67fda264651870a7 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 28 Mar 2024 08:33:10 +0100 Subject: [PATCH 01/15] Begin connector GitProject to famix concept --- .../GPCMetamodelGenerator.class.st | 48 +++++++++++++++++++ .../package.st | 1 + .../FamixTSourceEntity.extension.st | 19 ++++++++ .../GLHDiff.extension.st | 19 ++++++++ .../GPCModel.class.st | 20 ++++++++ .../package.st | 1 + 6 files changed, 108 insertions(+) create mode 100644 src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st create mode 100644 src/GitProject-FamixConnector-Generator/package.st create mode 100644 src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st create mode 100644 src/GitProject-FamixConnector-Model/GLHDiff.extension.st create mode 100644 src/GitProject-FamixConnector-Model/GPCModel.class.st create mode 100644 src/GitProject-FamixConnector-Model/package.st diff --git a/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st b/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st new file mode 100644 index 0000000..2bea98a --- /dev/null +++ b/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st @@ -0,0 +1,48 @@ +" +This is a generator to generate a metamodel that aims to link any git repository with file based project in Famix +" +Class { + #name : #GPCMetamodelGenerator, + #superclass : #FamixMetamodelGenerator, + #instVars : [ + 'glhDiff', + 'tSourceEntity' + ], + #category : #'GitProject-FamixConnector-Generator' +} + +{ #category : #accessing } +GPCMetamodelGenerator class >> packageName [ + + ^ #'GitProject-FamixConnector-Model' +] + +{ #category : #accessing } +GPCMetamodelGenerator class >> prefix [ + + ^ #GPC +] + +{ #category : #accessing } +GPCMetamodelGenerator class >> submetamodels [ + + ^ { + GLHMetamodelGenerator. + FamixGenerator } +] + +{ #category : #'as yet unclassified' } +GPCMetamodelGenerator >> defineClasses [ + + super defineClasses. + glhDiff := self remoteEntity: 'Diff' withPrefix: #GLH. + tSourceEntity := self remoteTrait: #TSourceEntity withPrefix: #Famix +] + +{ #category : #'as yet unclassified' } +GPCMetamodelGenerator >> defineRelations [ + + super defineRelations. + (glhDiff property: #onSourceEntities) + *-<> (tSourceEntity property: #appliedDiffs) +] diff --git a/src/GitProject-FamixConnector-Generator/package.st b/src/GitProject-FamixConnector-Generator/package.st new file mode 100644 index 0000000..6fc2581 --- /dev/null +++ b/src/GitProject-FamixConnector-Generator/package.st @@ -0,0 +1 @@ +Package { #name : #'GitProject-FamixConnector-Generator' } diff --git a/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st b/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st new file mode 100644 index 0000000..3c9b216 --- /dev/null +++ b/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st @@ -0,0 +1,19 @@ +Extension { #name : #FamixTSourceEntity } + +{ #category : #'*GitProject-FamixConnector-Model-accessing' } +FamixTSourceEntity >> appliedDiffs [ + "Relation named: #appliedDiffs type: #GLHDiff opposite: #onSourceEntities" + + + + + + ^ self attributeAt: #appliedDiffs ifAbsentPut: [ FMMultivalueLink on: self opposite: #onSourceEntities: ] +] + +{ #category : #'*GitProject-FamixConnector-Model-accessing' } +FamixTSourceEntity >> appliedDiffs: anObject [ + + + self appliedDiffs value: anObject +] diff --git a/src/GitProject-FamixConnector-Model/GLHDiff.extension.st b/src/GitProject-FamixConnector-Model/GLHDiff.extension.st new file mode 100644 index 0000000..8796e79 --- /dev/null +++ b/src/GitProject-FamixConnector-Model/GLHDiff.extension.st @@ -0,0 +1,19 @@ +Extension { #name : #GLHDiff } + +{ #category : #'*GitProject-FamixConnector-Model-accessing' } +GLHDiff >> onSourceEntities [ + "Relation named: #onSourceEntities type: #FamixTSourceEntity opposite: #appliedDiffs" + + + + + + ^ self attributeAt: #onSourceEntities ifAbsent: [ nil ] +] + +{ #category : #'*GitProject-FamixConnector-Model-accessing' } +GLHDiff >> onSourceEntities: anObject [ + + + self attributeAt: #onSourceEntities put: (FMMultivalueLink on: self update: #appliedDiffs from: self onSourceEntities to: anObject). +] diff --git a/src/GitProject-FamixConnector-Model/GPCModel.class.st b/src/GitProject-FamixConnector-Model/GPCModel.class.st new file mode 100644 index 0000000..c3251a4 --- /dev/null +++ b/src/GitProject-FamixConnector-Model/GPCModel.class.st @@ -0,0 +1,20 @@ +Class { + #name : #GPCModel, + #superclass : #MooseModel, + #traits : 'GLHTEntityCreator', + #classTraits : 'GLHTEntityCreator classTrait', + #category : #'GitProject-FamixConnector-Model-Model' +} + +{ #category : #accessing } +GPCModel class >> allSubmetamodelsPackagesNames [ + + ^ #(#'Moose-Query' #'GitLabHealth-Model' #'Famix-Traits') +] + +{ #category : #meta } +GPCModel class >> annotation [ + + + +] diff --git a/src/GitProject-FamixConnector-Model/package.st b/src/GitProject-FamixConnector-Model/package.st new file mode 100644 index 0000000..a30d63c --- /dev/null +++ b/src/GitProject-FamixConnector-Model/package.st @@ -0,0 +1 @@ +Package { #name : #'GitProject-FamixConnector-Model' } From 1409ed57eab0e2c82462234298543cac1ee51f88 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 28 Mar 2024 08:45:07 +0100 Subject: [PATCH 02/15] add infrastructure for connector --- .../GPCGitToFamixConnector.class.st | 69 +++++++++++++++++++ src/GitProject-FamixConnector/package.st | 1 + 2 files changed, 70 insertions(+) create mode 100644 src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st create mode 100644 src/GitProject-FamixConnector/package.st diff --git a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st new file mode 100644 index 0000000..ca9ef3e --- /dev/null +++ b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st @@ -0,0 +1,69 @@ +" +I am a connector between a git project represented using a `GLHProject` and any Famix model that use file base source anchor. +I might be adapted to support more options + +## Example + +This is a basic usage example + +```st +GPCGitToFamixConnector new + famixModel: myFamixModel; + glhProject: myGitProject; + connect +``` +" +Class { + #name : #GPCGitToFamixConnector, + #superclass : #Object, + #instVars : [ + 'famixModel', + 'glhProject' + ], + #category : #'GitProject-FamixConnector' +} + +{ #category : #accessing } +GPCGitToFamixConnector >> connect [ + + self glhProject repository commits do: [ :commit | + self connectCommit: commit ] +] + +{ #category : #accessing } +GPCGitToFamixConnector >> connectCommit: commit [ + "I connect a glhCommit with the famix model" + + commit diffs do: [ :diff | self connectDiff: diff ] +] + +{ #category : #accessing } +GPCGitToFamixConnector >> connectDiff: diff [ + "I connect a glhDiff with the famix model" + + self halt +] + +{ #category : #accessing } +GPCGitToFamixConnector >> famixModel [ + + ^ famixModel +] + +{ #category : #accessing } +GPCGitToFamixConnector >> famixModel: anObject [ + + famixModel := anObject +] + +{ #category : #accessing } +GPCGitToFamixConnector >> glhProject [ + + ^ glhProject +] + +{ #category : #accessing } +GPCGitToFamixConnector >> glhProject: anObject [ + + glhProject := anObject +] diff --git a/src/GitProject-FamixConnector/package.st b/src/GitProject-FamixConnector/package.st new file mode 100644 index 0000000..617b491 --- /dev/null +++ b/src/GitProject-FamixConnector/package.st @@ -0,0 +1 @@ +Package { #name : #'GitProject-FamixConnector' } From 776db7b3ea7b891c761164a0b3166b2e802a8a2f Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 28 Mar 2024 15:33:37 +0100 Subject: [PATCH 03/15] can link class java --- .../GPCMetamodelGenerator.class.st | 2 +- .../FamixTSourceEntity.extension.st | 6 +-- .../GLHDiff.extension.st | 12 ++--- .../GPCGitToFamixConnectorTest.class.st | 53 +++++++++++++++++++ .../package.st | 1 + .../GPCGitToFamixConnector.class.st | 13 ++++- 6 files changed, 76 insertions(+), 11 deletions(-) create mode 100644 src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st create mode 100644 src/GitProject-FamixConnector-Tests/package.st diff --git a/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st b/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st index 2bea98a..864f094 100644 --- a/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st +++ b/src/GitProject-FamixConnector-Generator/GPCMetamodelGenerator.class.st @@ -43,6 +43,6 @@ GPCMetamodelGenerator >> defineClasses [ GPCMetamodelGenerator >> defineRelations [ super defineRelations. - (glhDiff property: #onSourceEntities) + (glhDiff property: #onSourceEntity) *-<> (tSourceEntity property: #appliedDiffs) ] diff --git a/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st b/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st index 3c9b216..ce3584c 100644 --- a/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st +++ b/src/GitProject-FamixConnector-Model/FamixTSourceEntity.extension.st @@ -2,13 +2,13 @@ Extension { #name : #FamixTSourceEntity } { #category : #'*GitProject-FamixConnector-Model-accessing' } FamixTSourceEntity >> appliedDiffs [ - "Relation named: #appliedDiffs type: #GLHDiff opposite: #onSourceEntities" + "Relation named: #appliedDiffs type: #GLHDiff opposite: #onSourceEntity" - + - ^ self attributeAt: #appliedDiffs ifAbsentPut: [ FMMultivalueLink on: self opposite: #onSourceEntities: ] + ^ self attributeAt: #appliedDiffs ifAbsentPut: [ FMMultivalueLink on: self opposite: #onSourceEntity: ] ] { #category : #'*GitProject-FamixConnector-Model-accessing' } diff --git a/src/GitProject-FamixConnector-Model/GLHDiff.extension.st b/src/GitProject-FamixConnector-Model/GLHDiff.extension.st index 8796e79..3e04344 100644 --- a/src/GitProject-FamixConnector-Model/GLHDiff.extension.st +++ b/src/GitProject-FamixConnector-Model/GLHDiff.extension.st @@ -1,19 +1,19 @@ Extension { #name : #GLHDiff } { #category : #'*GitProject-FamixConnector-Model-accessing' } -GLHDiff >> onSourceEntities [ - "Relation named: #onSourceEntities type: #FamixTSourceEntity opposite: #appliedDiffs" +GLHDiff >> onSourceEntity [ + "Relation named: #onSourceEntity type: #FamixTSourceEntity opposite: #appliedDiffs" - + - ^ self attributeAt: #onSourceEntities ifAbsent: [ nil ] + ^ self attributeAt: #onSourceEntity ifAbsent: [ nil ] ] { #category : #'*GitProject-FamixConnector-Model-accessing' } -GLHDiff >> onSourceEntities: anObject [ +GLHDiff >> onSourceEntity: anObject [ - self attributeAt: #onSourceEntities put: (FMMultivalueLink on: self update: #appliedDiffs from: self onSourceEntities to: anObject). + self attributeAt: #onSourceEntity put: (FMMultivalueLink on: self update: #appliedDiffs from: self onSourceEntity to: anObject). ] diff --git a/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st b/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st new file mode 100644 index 0000000..2c71e9c --- /dev/null +++ b/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st @@ -0,0 +1,53 @@ +" +A GPCGitToFamixConnectorTest is a test class for testing the behavior of GPCGitToFamixConnector +" +Class { + #name : #GPCGitToFamixConnectorTest, + #superclass : #TestCase, + #instVars : [ + 'famixModel', + 'gitModel', + 'diff', + 'javaClass', + 'javaIndexedFileAnchor', + 'connector', + 'gitProject', + 'gitRepository' + ], + #category : #'GitProject-FamixConnector-Tests' +} + +{ #category : #running } +GPCGitToFamixConnectorTest >> setUp [ + + super setUp. + connector := GPCGitToFamixConnector new. + famixModel := FamixJavaModel new. + gitModel := GLHModel new. + gitProject := gitModel newProject. + gitRepository := gitModel newRepository. + gitProject repository: gitRepository. + connector famixModel: famixModel. + connector glhProject: gitProject +] + +{ #category : #tests } +GPCGitToFamixConnectorTest >> testConnectDiffToJavaClass [ + + | pathUnderTests commit | + pathUnderTests := 'a/b/c.java'. + + commit := gitModel newCommit. + commit repository: gitRepository. + diff := gitModel newDiff. + diff new_path: pathUnderTests. + commit diffs add: diff. + + javaClass := famixModel newClass. + javaIndexedFileAnchor := famixModel newIndexedFileAnchor. + javaIndexedFileAnchor fileName: '../../dede/../' , pathUnderTests. + javaClass sourceAnchor: javaIndexedFileAnchor. + connector connect. + self assert: diff onSourceEntity equals: javaClass. + self assert: javaClass appliedDiffs anyOne equals: diff +] diff --git a/src/GitProject-FamixConnector-Tests/package.st b/src/GitProject-FamixConnector-Tests/package.st new file mode 100644 index 0000000..2dba0da --- /dev/null +++ b/src/GitProject-FamixConnector-Tests/package.st @@ -0,0 +1 @@ +Package { #name : #'GitProject-FamixConnector-Tests' } diff --git a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st index ca9ef3e..9bbcad0 100644 --- a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st +++ b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st @@ -41,7 +41,10 @@ GPCGitToFamixConnector >> connectCommit: commit [ GPCGitToFamixConnector >> connectDiff: diff [ "I connect a glhDiff with the famix model" - self halt + famixModel allModelClasses + detect: [ :class | + class sourceAnchor fileName endsWith: diff new_path ] + ifFound: [ :class | class appliedDiffs add: diff ] ] { #category : #accessing } @@ -67,3 +70,11 @@ GPCGitToFamixConnector >> glhProject: anObject [ glhProject := anObject ] + +{ #category : #accessing } +GPCGitToFamixConnector >> resetConnection [ + "I connect a glhDiff with the famix model" + + famixModel allModelClasses do: [ :class | + class appliedDiffs removeAll ] +] From 4c1c8a21c48c95d564063aaf35927cccd036c835 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 28 Mar 2024 15:44:09 +0100 Subject: [PATCH 04/15] most basic tests are working. But it probably fails with case such as famixMethod and other --- .../GPCGitToFamixConnectorTest.class.st | 42 +++++++++++++++++++ .../GPCGitToFamixConnector.class.st | 4 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st b/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st index 2c71e9c..8ad8db1 100644 --- a/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st +++ b/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st @@ -51,3 +51,45 @@ GPCGitToFamixConnectorTest >> testConnectDiffToJavaClass [ self assert: diff onSourceEntity equals: javaClass. self assert: javaClass appliedDiffs anyOne equals: diff ] + +{ #category : #tests } +GPCGitToFamixConnectorTest >> testConnectDiffToJavaEnum [ + + | pathUnderTests commit | + pathUnderTests := 'a/b/c.java'. + + commit := gitModel newCommit. + commit repository: gitRepository. + diff := gitModel newDiff. + diff new_path: pathUnderTests. + commit diffs add: diff. + + javaClass := famixModel newEnum. + javaIndexedFileAnchor := famixModel newIndexedFileAnchor. + javaIndexedFileAnchor fileName: '../../dede/../' , pathUnderTests. + javaClass sourceAnchor: javaIndexedFileAnchor. + connector connect. + self assert: diff onSourceEntity equals: javaClass. + self assert: javaClass appliedDiffs anyOne equals: diff +] + +{ #category : #tests } +GPCGitToFamixConnectorTest >> testConnectDiffToJavaInterface [ + + | pathUnderTests commit | + pathUnderTests := 'a/b/c.java'. + + commit := gitModel newCommit. + commit repository: gitRepository. + diff := gitModel newDiff. + diff new_path: pathUnderTests. + commit diffs add: diff. + + javaClass := famixModel newInterface. + javaIndexedFileAnchor := famixModel newIndexedFileAnchor. + javaIndexedFileAnchor fileName: '../../dede/../' , pathUnderTests. + javaClass sourceAnchor: javaIndexedFileAnchor. + connector connect. + self assert: diff onSourceEntity equals: javaClass. + self assert: javaClass appliedDiffs anyOne equals: diff +] diff --git a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st index 9bbcad0..4ec1793 100644 --- a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st +++ b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st @@ -41,7 +41,7 @@ GPCGitToFamixConnector >> connectCommit: commit [ GPCGitToFamixConnector >> connectDiff: diff [ "I connect a glhDiff with the famix model" - famixModel allModelClasses + (famixModel allUsing: FamixTSourceEntity) detect: [ :class | class sourceAnchor fileName endsWith: diff new_path ] ifFound: [ :class | class appliedDiffs add: diff ] @@ -75,6 +75,6 @@ GPCGitToFamixConnector >> glhProject: anObject [ GPCGitToFamixConnector >> resetConnection [ "I connect a glhDiff with the famix model" - famixModel allModelClasses do: [ :class | + (famixModel allUsing: FamixTSourceEntity) do: [ :class | class appliedDiffs removeAll ] ] From c4df350642d2d569f0914442d091129d72fc3001 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 28 Mar 2024 15:54:48 +0100 Subject: [PATCH 05/15] I dunno. Maybe better to start --- src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st index 4ec1793..1e1d0f4 100644 --- a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st +++ b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st @@ -41,7 +41,9 @@ GPCGitToFamixConnector >> connectCommit: commit [ GPCGitToFamixConnector >> connectDiff: diff [ "I connect a glhDiff with the famix model" - (famixModel allUsing: FamixTSourceEntity) + (famixModel allUsing: FamixTClass) + , (famixModel allUsing: FamixTEnum) + , (famixModel allWithType: FamixJavaInterface) detect: [ :class | class sourceAnchor fileName endsWith: diff new_path ] ifFound: [ :class | class appliedDiffs add: diff ] From e81a2cbcc52ab89d2d09376f2e3351dd6a1dcd18 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 28 Mar 2024 16:19:17 +0100 Subject: [PATCH 06/15] a test for anonymous class --- .../GPCGitToFamixConnectorTest.class.st | 33 +++++++++++++++++++ .../GPCGitToFamixConnector.class.st | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st b/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st index 8ad8db1..92ef3d1 100644 --- a/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st +++ b/src/GitProject-FamixConnector-Tests/GPCGitToFamixConnectorTest.class.st @@ -31,6 +31,39 @@ GPCGitToFamixConnectorTest >> setUp [ connector glhProject: gitProject ] +{ #category : #tests } +GPCGitToFamixConnectorTest >> testConnectDiffToAnonymousJavaClass [ + + | pathUnderTests commit javaMethod javaAnonymousClass javaAnonymousClassIndexedFileAnchor | + "Have to be ignore" + pathUnderTests := 'a/b/c.java'. + + commit := gitModel newCommit. + commit repository: gitRepository. + diff := gitModel newDiff. + diff new_path: pathUnderTests. + commit diffs add: diff. + + javaClass := famixModel newClass. + javaIndexedFileAnchor := famixModel newIndexedFileAnchor. + javaIndexedFileAnchor fileName: '../../dede/../' , pathUnderTests. + javaClass sourceAnchor: javaIndexedFileAnchor. + javaMethod := famixModel newMethod. + javaClass addMethod: javaMethod. + javaAnonymousClass := famixModel newClass. + javaAnonymousClassIndexedFileAnchor := famixModel + newIndexedFileAnchor. + javaAnonymousClassIndexedFileAnchor fileName: + '../../dede/../' , pathUnderTests. + javaAnonymousClass sourceAnchor: javaAnonymousClassIndexedFileAnchor. + + javaMethod addType: javaAnonymousClass. + connector connect. + self assert: diff onSourceEntity equals: javaClass. + self assert: javaClass appliedDiffs anyOne equals: diff. + self assert: javaAnonymousClass appliedDiffs size equals: 0 +] + { #category : #tests } GPCGitToFamixConnectorTest >> testConnectDiffToJavaClass [ diff --git a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st index 1e1d0f4..53c5041 100644 --- a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st +++ b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st @@ -41,7 +41,7 @@ GPCGitToFamixConnector >> connectCommit: commit [ GPCGitToFamixConnector >> connectDiff: diff [ "I connect a glhDiff with the famix model" - (famixModel allUsing: FamixTClass) + ((famixModel allUsing: FamixTClass) reject: #isAnonymousClass) , (famixModel allUsing: FamixTEnum) , (famixModel allWithType: FamixJavaInterface) detect: [ :class | From edd9328826e1ab63cb3fe7439f9f8aeb903b9392 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Fri, 29 Mar 2024 09:31:35 +0100 Subject: [PATCH 07/15] better reset and connect diff --- .../GPCGitToFamixConnector.class.st | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st index 53c5041..a824dd1 100644 --- a/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st +++ b/src/GitProject-FamixConnector/GPCGitToFamixConnector.class.st @@ -41,9 +41,10 @@ GPCGitToFamixConnector >> connectCommit: commit [ GPCGitToFamixConnector >> connectDiff: diff [ "I connect a glhDiff with the famix model" - ((famixModel allUsing: FamixTClass) reject: #isAnonymousClass) - , (famixModel allUsing: FamixTEnum) - , (famixModel allWithType: FamixJavaInterface) + (((famixModel allUsing: FamixTClass) reject: #isAnonymousClass) + , (famixModel allUsing: FamixTEnum) + , (famixModel allWithType: FamixJavaInterface) reject: [ :type | + type sourceAnchor isNil ]) detect: [ :class | class sourceAnchor fileName endsWith: diff new_path ] ifFound: [ :class | class appliedDiffs add: diff ] @@ -78,5 +79,6 @@ GPCGitToFamixConnector >> resetConnection [ "I connect a glhDiff with the famix model" (famixModel allUsing: FamixTSourceEntity) do: [ :class | - class appliedDiffs removeAll ] + class appliedDiffs removeAll. + class removeAttribute: #appliedDiffs ] ] From 50f62d047e9e57e17c509cd0a76e2d3623619c58 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Wed, 17 Apr 2024 10:20:50 +0200 Subject: [PATCH 08/15] fix import of pipeline run in gitlab --- .../GHModelImporter.class.st | 18 +++++++++--------- .../GLHModelImporter.class.st | 10 ++++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/GitHubHealth-Model-Importer/GHModelImporter.class.st b/src/GitHubHealth-Model-Importer/GHModelImporter.class.st index 4454c69..60c3d04 100644 --- a/src/GitHubHealth-Model-Importer/GHModelImporter.class.st +++ b/src/GitHubHealth-Model-Importer/GHModelImporter.class.st @@ -228,20 +228,20 @@ GHModelImporter >> parsePipelinesResult: pipelineOverview [ | reader | reader := NeoJSONReader on: pipelineOverview readStream. - reader for: GHAPIPipelineOverview do: [ :mapping | + reader for: GHAPIPipelineOverview do: [ :mapping | mapping mapInstVar: #total_count to: #total_count. (mapping mapInstVar: #workflow_runs) valueSchema: #ArrayOfPipelines ]. reader for: #ArrayOfPipelines - customDo: [ :customMappting | + customDo: [ :customMappting | customMappting listOfElementSchema: GLHPipeline ]. - reader - for: GLHPipeline - do: [ :mapping | - mapping - mapInstVar: #status to: #conclusion ; - mapProperty: #run_started_at getter: [ :object | #ignore ] setter: [ :object : value | object runDate: (DateAndTime fromString: value) ] - ]. + reader for: GLHPipeline do: [ :mapping | + mapping + mapInstVar: #status to: #conclusion; + mapProperty: #run_started_at + getter: [ :object | #ignore ] + setter: [ :object :value | + object runDate: (DateAndTime fromString: value) ] ]. ^ reader nextAs: GHAPIPipelineOverview ] diff --git a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st index ce20ac8..3beea7e 100644 --- a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st @@ -236,7 +236,7 @@ GLHModelImporter >> importRepository: aGLHRepository [ GLHModelImporter >> importUser: aUserID [ | result userResult | - (glhModel allWithType: GLHUser) detect: [ :user | user id = aUserID ] ifFound: [ :user | ^ user ]. + (glhModel allWithType: GLHUser) asOrderedCollection detect: [ :user | user id = aUserID ] ifFound: [ :user | ^ user ]. ('Import user: ' , aUserID printString) recordInfo. result := self glhApi user: aUserID. userResult := self parseUserResult: result. @@ -344,9 +344,15 @@ GLHModelImporter >> parsePipelinesResult: result [ | reader | reader := NeoJSONReader on: result readStream. reader mapInstVarsFor: GLHPipeline. + reader for: GLHPipeline do: [ :mapping | + mapping + mapProperty: #created_at + getter: [ :object | #ignore ] + setter: [ :object :value | + object runDate: (DateAndTime fromString: value) ] ]. reader for: #ArrayOfPipelines - customDo: [ :customMappting | + customDo: [ :customMappting | customMappting listOfElementSchema: GLHPipeline ]. ^ reader nextAs: #ArrayOfPipelines ] From 84a154c8e5b2e4d158f3a533754ec7003bb52f65 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Wed, 17 Apr 2024 12:03:50 +0200 Subject: [PATCH 09/15] begin work to retrieve information about jobs --- .../GLHMetamodelGenerator.class.st | 39 +++- .../GLHApi.class.st | 8 + .../GLHModelImporter.class.st | 37 +++- src/GitLabHealth-Model/GLHBranch.class.st | 23 +++ src/GitLabHealth-Model/GLHCommit.class.st | 69 ++++++- src/GitLabHealth-Model/GLHDiff.class.st | 22 +++ src/GitLabHealth-Model/GLHFile.class.st | 18 ++ src/GitLabHealth-Model/GLHFileBlob.class.st | 2 + .../GLHFileDirectory.class.st | 11 ++ src/GitLabHealth-Model/GLHGroup.class.st | 28 +++ src/GitLabHealth-Model/GLHJob.class.st | 177 ++++++++++++++++++ src/GitLabHealth-Model/GLHPipeline.class.st | 74 +++++++- src/GitLabHealth-Model/GLHProject.class.st | 37 ++++ src/GitLabHealth-Model/GLHRepository.class.st | 17 ++ .../GLHTEntityCreator.trait.st | 16 ++ src/GitLabHealth-Model/GLHUser.class.st | 74 +++++++- 16 files changed, 638 insertions(+), 14 deletions(-) create mode 100644 src/GitLabHealth-Model/GLHJob.class.st diff --git a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st index 5392ba0..8cea00c 100644 --- a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st +++ b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st @@ -13,7 +13,8 @@ Class { 'fileDirectory', 'commit', 'commitStats', - 'diff' + 'diff', + 'job' ], #category : #'GitLabHealth-Model-Generator' } @@ -86,7 +87,9 @@ GLHMetamodelGenerator >> defineClasses [ commit := builder newClassNamed: #Commit comment: 'a commit attached to a repository'. - diff := builder newClassNamed: #Diff comment: 'The diff of a commit' + diff := builder newClassNamed: #Diff comment: 'The diff of a commit'. + + job := builder newClassNamed: #Job comment: 'A CI Job' ] { #category : #definition } @@ -96,9 +99,10 @@ GLHMetamodelGenerator >> defineHierarchy [ (builder ensureClassNamed: #Entity) --|> #TEntityMetaLevelDependency. fileDirectory --|> file. fileBlob --|> file. - + group --|> #TNamedEntity. project --|> #TNamedEntity. + job --|> #TNamedEntity ] { #category : #definition } @@ -124,14 +128,19 @@ GLHMetamodelGenerator >> defineProperties [ project property: #creator_id type: #Number. "Pipelines properties" - (pipeline property: #status type: #String) comment: '#success or #failure'. - (pipeline property: #runDate type: #Object) comment: 'Date this pipeline was run'. + (pipeline property: #status type: #String) comment: + '#success or #failure'. + (pipeline property: #runDate type: #Object) comment: + 'Date this pipeline was run'. + (pipeline property: #id type: #String) comment: + 'The id of the pipeline'. self userProperties. self branchProperties. self fileProperties. self commitProperties. - self diffProperties + self diffProperties. + self jobProperties ] { #category : #definition } @@ -145,10 +154,14 @@ GLHMetamodelGenerator >> defineRelations [ (project property: #repository) <>- (repository property: #project). (repository property: #branches) <>-* (branch property: #repository). (branch property: #files) <>-* (file property: #branch). - (fileDirectory property: #files) <>-* (file property: #directoryOwner). + (fileDirectory property: #files) + <>-* (file property: #directoryOwner). (repository property: #commits) <>-* (commit property: #repository). (branch property: #commits) <>-* (commit property: #branch). - (commit property: #diffs) <>-* (diff property: #commit) + (commit property: #diffs) <>-* (diff property: #commit). + (commit property: #jobs) <>-* (job property: #commit). + (pipeline property: #jobs) <>-* (job property: #pipeline). + (user property: #jobs) <>-* (job property: #user) ] { #category : #definition } @@ -180,6 +193,16 @@ GLHMetamodelGenerator >> fileProperties [ file property: #name type: #String ] +{ #category : #definition } +GLHMetamodelGenerator >> jobProperties [ + + job property: #id type: #Number. + job property: #allow_failure type: #Boolean. + job property: #web_url type: #String. + job property: #duration type: #Object. + job property: #allow_failure type: #Boolean +] + { #category : #definition } GLHMetamodelGenerator >> userProperties [ user property: #id type: #Number. diff --git a/src/GitLabHealth-Model-Importer/GLHApi.class.st b/src/GitLabHealth-Model-Importer/GLHApi.class.st index 2d8f80b..b1da2c5 100644 --- a/src/GitLabHealth-Model-Importer/GLHApi.class.st +++ b/src/GitLabHealth-Model-Importer/GLHApi.class.st @@ -181,6 +181,14 @@ GLHApi >> initialize [ yourself) ] +{ #category : #'api - jobs' } +GLHApi >> jobsOfProject: aProjectID ofPipelines: aPipelineID [ + + ^ self client get: + self baseAPIUrl , '/projects/' , aProjectID printString + , '/pipelines/' , aPipelineID printString , '/jobs' +] + { #category : #api } GLHApi >> pipelinesOfProject: aProjectID [ ^ self client get: self baseAPIUrl , '/projects/' , aProjectID printString, '/pipelines' diff --git a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st index 3beea7e..9c37b39 100644 --- a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st @@ -31,9 +31,10 @@ GLHModelImporter >> beWithouFiles [ GLHModelImporter >> completeImportProject: aGLHProject [ ('Complete import project: ' , aGLHProject id printString) recordInfo. - (self pipelinesOf: aGLHProject id) do: [ :pipeline | + (self pipelinesOf: aGLHProject id) do: [ :pipeline | self glhModel add: pipeline. - aGLHProject addPipeline: pipeline ]. + aGLHProject addPipeline: pipeline. + self importJobsOf: pipeline ]. aGLHProject creator: (self importUser: aGLHProject creator_id). aGLHProject repository: GLHRepository new. self glhModel add: aGLHProject repository. @@ -216,6 +217,18 @@ GLHModelImporter >> importGroup: aGroupID [ ^ groupResult ] +{ #category : #api } +GLHModelImporter >> importJobsOf: aPipeline [ + + | result jobs | + result := self glhApi + jobsOfProject: aPipeline project id + ofPipelines: aPipeline id. + jobs := self parseJobsResult: result. + jobs do: [ :job | aPipeline addJob: job ]. + self glhModel addAll: jobs +] + { #category : #'private - api' } GLHModelImporter >> importRepository: aGLHRepository [ @@ -338,6 +351,26 @@ GLHModelImporter >> parseGroupResult: aResult [ ^ reader nextAs: GLHGroup ] +{ #category : #private } +GLHModelImporter >> parseJobsResult: result [ + + | reader | + reader := NeoJSONReader on: result readStream. + reader for: GLHJob do: [ :mapping | + mapping mapInstVars: #( id allow_failure web_url name ). + + mapping + mapProperty: #user + getter: [ :object | #ignore ] + setter: [ :object :value | object user: (self importUser: (value at: #id)) ] ]. + + reader + for: #ArrayOfGLHJob + customDo: [ :customMappting | + customMappting listOfElementSchema: GLHJob ]. + ^ reader nextAs: #ArrayOfGLHJob +] + { #category : #private } GLHModelImporter >> parsePipelinesResult: result [ diff --git a/src/GitLabHealth-Model/GLHBranch.class.st b/src/GitLabHealth-Model/GLHBranch.class.st index e50f03d..5373566 100644 --- a/src/GitLabHealth-Model/GLHBranch.class.st +++ b/src/GitLabHealth-Model/GLHBranch.class.st @@ -1,5 +1,28 @@ " A git branch + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `repository` | `GLHBranch` | `branches` | `GLHRepository` | | + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `commits` | `GLHBranch` | `branch` | `GLHCommit` | | +| `files` | `GLHBranch` | `branch` | `GLHFile` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `name` | `String` | nil | | + " Class { #name : #GLHBranch, diff --git a/src/GitLabHealth-Model/GLHCommit.class.st b/src/GitLabHealth-Model/GLHCommit.class.st index f11639a..99fa301 100644 --- a/src/GitLabHealth-Model/GLHCommit.class.st +++ b/src/GitLabHealth-Model/GLHCommit.class.st @@ -1,5 +1,42 @@ " a commit attached to a repository + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `branch` | `GLHCommit` | `commits` | `GLHBranch` | | +| `repository` | `GLHCommit` | `commits` | `GLHRepository` | | + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `diffs` | `GLHCommit` | `commit` | `GLHDiff` | | +| `jobs` | `GLHCommit` | `commit` | `GLHJob` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `additions` | `Number` | nil | The number of line that git consider added| +| `author_email` | `String` | nil | | +| `author_name` | `String` | nil | | +| `authored_date` | `Object` | nil | | +| `committed_date` | `Object` | nil | | +| `committer_email` | `String` | nil | | +| `committer_name` | `String` | nil | | +| `created_at` | `Object` | nil | | +| `deletions` | `Number` | nil | The number of line that git consider deleted| +| `id` | `String` | nil | | +| `message` | `String` | nil | | +| `short_id` | `String` | nil | | +| `title` | `String` | nil | | +| `web_url` | `String` | nil | | + " Class { #name : #GLHCommit, @@ -21,7 +58,8 @@ Class { '#deletions => FMProperty', '#repository => FMOne type: #GLHRepository opposite: #commits', '#branch => FMOne type: #GLHBranch opposite: #commits', - '#diffs => FMMany type: #GLHDiff opposite: #commit' + '#diffs => FMMany type: #GLHDiff opposite: #commit', + '#jobs => FMMany type: #GLHJob opposite: #commit' ], #category : #'GitLabHealth-Model-Entities' } @@ -41,6 +79,12 @@ GLHCommit >> addDiff: anObject [ ^ self diffs add: anObject ] +{ #category : #adding } +GLHCommit >> addJob: anObject [ + + ^ self jobs add: anObject +] + { #category : #accessing } GLHCommit >> additions [ @@ -229,6 +273,29 @@ GLHCommit >> id: anObject [ id := anObject ] +{ #category : #accessing } +GLHCommit >> jobs [ + "Relation named: #jobs type: #GLHJob opposite: #commit" + + + + ^ jobs +] + +{ #category : #accessing } +GLHCommit >> jobs: anObject [ + + + jobs value: anObject +] + +{ #category : #navigation } +GLHCommit >> jobsGroup [ + + + ^ MooseSpecializedGroup withAll: self jobs asSet +] + { #category : #accessing } GLHCommit >> message [ diff --git a/src/GitLabHealth-Model/GLHDiff.class.st b/src/GitLabHealth-Model/GLHDiff.class.st index ca234a0..8c9be42 100644 --- a/src/GitLabHealth-Model/GLHDiff.class.st +++ b/src/GitLabHealth-Model/GLHDiff.class.st @@ -1,5 +1,27 @@ " The diff of a commit + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `commit` | `GLHDiff` | `diffs` | `GLHCommit` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `deleted_file` | `Boolean` | false | Is the file of the diff has been removed| +| `diffString` | `String` | nil | The string presenting the diff. It should follow the [Detailed-Unified](https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html) format| +| `new_file` | `Boolean` | false | Is the file of the diff is a new file| +| `new_path` | `String` | nil | The path to the file in the resulted repository commitish| +| `old_path` | `String` | nil | The path to the file in the origin repository commitish| +| `renamed_file` | `Boolean` | false | Is the file of the diff has been renamed (see old_path/new_path) file| + " Class { #name : #GLHDiff, diff --git a/src/GitLabHealth-Model/GLHFile.class.st b/src/GitLabHealth-Model/GLHFile.class.st index f01af30..7f34602 100644 --- a/src/GitLabHealth-Model/GLHFile.class.st +++ b/src/GitLabHealth-Model/GLHFile.class.st @@ -1,5 +1,23 @@ " A file + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `branch` | `GLHFile` | `files` | `GLHBranch` | | +| `directoryOwner` | `GLHFile` | `files` | `GLHFileDirectory` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `name` | `String` | nil | | + " Class { #name : #GLHFile, diff --git a/src/GitLabHealth-Model/GLHFileBlob.class.st b/src/GitLabHealth-Model/GLHFileBlob.class.st index f8099bb..d646f8a 100644 --- a/src/GitLabHealth-Model/GLHFileBlob.class.st +++ b/src/GitLabHealth-Model/GLHFileBlob.class.st @@ -1,5 +1,7 @@ " A file blob + + " Class { #name : #GLHFileBlob, diff --git a/src/GitLabHealth-Model/GLHFileDirectory.class.st b/src/GitLabHealth-Model/GLHFileDirectory.class.st index 0254002..9838cb5 100644 --- a/src/GitLabHealth-Model/GLHFileDirectory.class.st +++ b/src/GitLabHealth-Model/GLHFileDirectory.class.st @@ -1,5 +1,16 @@ " A file directory + +## Relations +====================== + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `files` | `GLHFileDirectory` | `directoryOwner` | `GLHFile` | | + + + " Class { #name : #GLHFileDirectory, diff --git a/src/GitLabHealth-Model/GLHGroup.class.st b/src/GitLabHealth-Model/GLHGroup.class.st index 60309df..b6d3126 100644 --- a/src/GitLabHealth-Model/GLHGroup.class.st +++ b/src/GitLabHealth-Model/GLHGroup.class.st @@ -1,5 +1,33 @@ " A GitLab Group + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `group` | `GLHGroup` | `subGroups` | `GLHGroup` | | + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `projects` | `GLHGroup` | `group` | `GLHProject` | | +| `subGroups` | `GLHGroup` | `group` | `GLHGroup` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `avatar_url` | `String` | nil | | +| `description` | `String` | nil | | +| `id` | `Number` | nil | | +| `name` | `String` | nil | Basic name of the entity, not full reference.| +| `visibility` | `String` | nil | | +| `web_url` | `String` | nil | | + " Class { #name : #GLHGroup, diff --git a/src/GitLabHealth-Model/GLHJob.class.st b/src/GitLabHealth-Model/GLHJob.class.st new file mode 100644 index 0000000..e597219 --- /dev/null +++ b/src/GitLabHealth-Model/GLHJob.class.st @@ -0,0 +1,177 @@ +" +A CI Job + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `commit` | `GLHJob` | `jobs` | `GLHCommit` | | +| `pipeline` | `GLHJob` | `jobs` | `GLHPipeline` | | +| `user` | `GLHJob` | `jobs` | `GLHUser` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `allow_failure` | `Boolean` | nil | | +| `allow_failure` | `Boolean` | nil | | +| `duration` | `Object` | nil | | +| `id` | `Number` | nil | | +| `name` | `String` | nil | Basic name of the entity, not full reference.| +| `web_url` | `String` | nil | | + +" +Class { + #name : #GLHJob, + #superclass : #GLHEntity, + #traits : 'FamixTNamedEntity', + #classTraits : 'FamixTNamedEntity classTrait', + #instVars : [ + '#allow_failure => FMProperty', + '#commit => FMOne type: #GLHCommit opposite: #jobs', + '#duration => FMProperty', + '#id => FMProperty', + '#pipeline => FMOne type: #GLHPipeline opposite: #jobs', + '#user => FMOne type: #GLHUser opposite: #jobs', + '#web_url => FMProperty' + ], + #category : #'GitLabHealth-Model-Entities' +} + +{ #category : #meta } +GLHJob class >> annotation [ + + + + + ^ self +] + +{ #category : #accessing } +GLHJob >> allow_failure [ + + + + ^ allow_failure +] + +{ #category : #accessing } +GLHJob >> allow_failure: anObject [ + + allow_failure := anObject +] + +{ #category : #accessing } +GLHJob >> commit [ + "Relation named: #commit type: #GLHCommit opposite: #jobs" + + + + ^ commit +] + +{ #category : #accessing } +GLHJob >> commit: anObject [ + + + commit := anObject +] + +{ #category : #navigation } +GLHJob >> commitGroup [ + + + ^ MooseSpecializedGroup with: self commit +] + +{ #category : #accessing } +GLHJob >> duration [ + + + + ^ duration +] + +{ #category : #accessing } +GLHJob >> duration: anObject [ + + duration := anObject +] + +{ #category : #accessing } +GLHJob >> id [ + + + + ^ id +] + +{ #category : #accessing } +GLHJob >> id: anObject [ + + id := anObject +] + +{ #category : #accessing } +GLHJob >> pipeline [ + "Relation named: #pipeline type: #GLHPipeline opposite: #jobs" + + + + ^ pipeline +] + +{ #category : #accessing } +GLHJob >> pipeline: anObject [ + + + pipeline := anObject +] + +{ #category : #navigation } +GLHJob >> pipelineGroup [ + + + ^ MooseSpecializedGroup with: self pipeline +] + +{ #category : #accessing } +GLHJob >> user [ + "Relation named: #user type: #GLHUser opposite: #jobs" + + + + ^ user +] + +{ #category : #accessing } +GLHJob >> user: anObject [ + + + user := anObject +] + +{ #category : #navigation } +GLHJob >> userGroup [ + + + ^ MooseSpecializedGroup with: self user +] + +{ #category : #accessing } +GLHJob >> web_url [ + + + + ^ web_url +] + +{ #category : #accessing } +GLHJob >> web_url: anObject [ + + web_url := anObject +] diff --git a/src/GitLabHealth-Model/GLHPipeline.class.st b/src/GitLabHealth-Model/GLHPipeline.class.st index 06b3002..2eeedd7 100644 --- a/src/GitLabHealth-Model/GLHPipeline.class.st +++ b/src/GitLabHealth-Model/GLHPipeline.class.st @@ -1,13 +1,39 @@ " A GitLab Pipeline execution + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `project` | `GLHPipeline` | `pipelines` | `GLHProject` | | + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `jobs` | `GLHPipeline` | `pipeline` | `GLHJob` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `id` | `String` | nil | The id of the pipeline| +| `runDate` | `Object` | nil | Date this pipeline was run| +| `status` | `String` | nil | #success or #failure| + " Class { #name : #GLHPipeline, #superclass : #GLHEntity, #instVars : [ - '#status => FMProperty', + '#id => FMProperty', + '#jobs => FMMany type: #GLHJob opposite: #pipeline', + '#project => FMOne type: #GLHProject opposite: #pipelines', '#runDate => FMProperty', - '#project => FMOne type: #GLHProject opposite: #pipelines' + '#status => FMProperty' ], #category : #'GitLabHealth-Model-Entities' } @@ -21,6 +47,50 @@ GLHPipeline class >> annotation [ ^ self ] +{ #category : #adding } +GLHPipeline >> addJob: anObject [ + + ^ self jobs add: anObject +] + +{ #category : #accessing } +GLHPipeline >> id [ + + + + + ^ id +] + +{ #category : #accessing } +GLHPipeline >> id: anObject [ + + id := anObject +] + +{ #category : #accessing } +GLHPipeline >> jobs [ + "Relation named: #jobs type: #GLHJob opposite: #pipeline" + + + + ^ jobs +] + +{ #category : #accessing } +GLHPipeline >> jobs: anObject [ + + + jobs value: anObject +] + +{ #category : #navigation } +GLHPipeline >> jobsGroup [ + + + ^ MooseSpecializedGroup withAll: self jobs asSet +] + { #category : #accessing } GLHPipeline >> project [ "Relation named: #project type: #GLHProject opposite: #pipelines" diff --git a/src/GitLabHealth-Model/GLHProject.class.st b/src/GitLabHealth-Model/GLHProject.class.st index 167489d..f74e08f 100644 --- a/src/GitLabHealth-Model/GLHProject.class.st +++ b/src/GitLabHealth-Model/GLHProject.class.st @@ -1,5 +1,42 @@ " A GitLab Project + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `group` | `GLHProject` | `projects` | `GLHGroup` | | + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `pipelines` | `GLHProject` | `project` | `GLHPipeline` | | +| `repository` | `GLHProject` | `project` | `GLHRepository` | | + +### Other +| Relation | Origin | Opposite | Type | Comment | +|---| +| `creator` | `GLHProject` | `createdProjects` | `GLHUser` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `archived` | `Boolean` | nil | | +| `archived` | `Boolean` | nil | | +| `avatar_url` | `String` | nil | | +| `creator_id` | `Number` | nil | | +| `description` | `String` | nil | | +| `id` | `Number` | nil | | +| `name` | `String` | nil | Basic name of the entity, not full reference.| +| `readme_url` | `String` | nil | | +| `topics` | `Object` | nil | | +| `web_url` | `String` | nil | | + " Class { #name : #GLHProject, diff --git a/src/GitLabHealth-Model/GLHRepository.class.st b/src/GitLabHealth-Model/GLHRepository.class.st index e2023a0..e761250 100644 --- a/src/GitLabHealth-Model/GLHRepository.class.st +++ b/src/GitLabHealth-Model/GLHRepository.class.st @@ -1,5 +1,22 @@ " A git repository + +## Relations +====================== + +### Parents +| Relation | Origin | Opposite | Type | Comment | +|---| +| `project` | `GLHRepository` | `repository` | `GLHProject` | | + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `branches` | `GLHRepository` | `repository` | `GLHBranch` | | +| `commits` | `GLHRepository` | `repository` | `GLHCommit` | | + + + " Class { #name : #GLHRepository, diff --git a/src/GitLabHealth-Model/GLHTEntityCreator.trait.st b/src/GitLabHealth-Model/GLHTEntityCreator.trait.st index ac070be..39981f6 100644 --- a/src/GitLabHealth-Model/GLHTEntityCreator.trait.st +++ b/src/GitLabHealth-Model/GLHTEntityCreator.trait.st @@ -1,6 +1,8 @@ " This trait is used by Famix models. It provides an API for creating entities and adding them to the model. + + " Trait { #name : #GLHTEntityCreator, @@ -72,6 +74,20 @@ GLHTEntityCreator >> newGroupNamed: aName [ ^ self add: (GLHGroup named: aName) ] +{ #category : #'entity creation' } +GLHTEntityCreator >> newJob [ + + + ^ self add: GLHJob new +] + +{ #category : #'entity creation' } +GLHTEntityCreator >> newJobNamed: aName [ + + + ^ self add: (GLHJob named: aName) +] + { #category : #'entity creation' } GLHTEntityCreator >> newPipeline [ diff --git a/src/GitLabHealth-Model/GLHUser.class.st b/src/GitLabHealth-Model/GLHUser.class.st index 7e2b6b8..887973e 100644 --- a/src/GitLabHealth-Model/GLHUser.class.st +++ b/src/GitLabHealth-Model/GLHUser.class.st @@ -1,5 +1,47 @@ " A GitLab User + +## Relations +====================== + +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `jobs` | `GLHUser` | `user` | `GLHJob` | | + +### Other +| Relation | Origin | Opposite | Type | Comment | +|---| +| `createdProjects` | `GLHUser` | `creator` | `GLHProject` | | + + +## Properties +====================== + +| Name | Type | Default value | Comment | +|---| +| `avatar_url` | `String` | nil | | +| `bio` | `String` | nil | | +| `bot` | `String` | nil | | +| `created_at` | `String` | nil | | +| `followers` | `String` | nil | | +| `following` | `String` | nil | | +| `id` | `Number` | nil | | +| `job_title` | `String` | nil | | +| `linkedin` | `String` | nil | | +| `location` | `String` | nil | | +| `name` | `String` | nil | | +| `organization` | `String` | nil | | +| `pronouns` | `String` | nil | | +| `public_email` | `String` | nil | | +| `skype` | `String` | nil | | +| `state` | `String` | nil | | +| `twitter` | `String` | nil | | +| `username` | `String` | nil | | +| `web_url` | `String` | nil | | +| `website_url` | `String` | nil | | +| `work_information` | `String` | nil | | + " Class { #name : #GLHUser, @@ -26,7 +68,8 @@ Class { '#work_information => FMProperty', '#followers => FMProperty', '#following => FMProperty', - '#createdProjects => FMMany type: #GLHProject opposite: #creator' + '#createdProjects => FMMany type: #GLHProject opposite: #creator', + '#jobs => FMMany type: #GLHJob opposite: #user' ], #category : #'GitLabHealth-Model-Entities' } @@ -46,6 +89,12 @@ GLHUser >> addCreatedProject: anObject [ ^ self createdProjects add: anObject ] +{ #category : #adding } +GLHUser >> addJob: anObject [ + + ^ self jobs add: anObject +] + { #category : #accessing } GLHUser >> avatar_url [ @@ -174,6 +223,29 @@ GLHUser >> job_title: anObject [ job_title := anObject ] +{ #category : #accessing } +GLHUser >> jobs [ + "Relation named: #jobs type: #GLHJob opposite: #user" + + + + ^ jobs +] + +{ #category : #accessing } +GLHUser >> jobs: anObject [ + + + jobs value: anObject +] + +{ #category : #navigation } +GLHUser >> jobsGroup [ + + + ^ MooseSpecializedGroup withAll: self jobs asSet +] + { #category : #accessing } GLHUser >> linkedin [ From 531fc318a244def05ef83f77a2d919396243ae67 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Wed, 17 Apr 2024 14:30:22 +0200 Subject: [PATCH 10/15] add duration --- .../GLHModelImporter.class.st | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st index 9c37b39..e074acf 100644 --- a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st @@ -362,7 +362,14 @@ GLHModelImporter >> parseJobsResult: result [ mapping mapProperty: #user getter: [ :object | #ignore ] - setter: [ :object :value | object user: (self importUser: (value at: #id)) ] ]. + setter: [ :object :value | + object user: (self importUser: (value at: #id)) ]. + + mapping + mapProperty: #duration + getter: [ :object | #ignore ] + setter: [ :object :value | + value ifNotNil: [ object duration: value seconds ] ] ]. reader for: #ArrayOfGLHJob From a6227d3534dae5d03c9b9c5b63b8925dfb6ec59c Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Thu, 18 Apr 2024 14:24:56 +0200 Subject: [PATCH 11/15] import parse of job result to add the link with a commit --- .../GLHCommit.extension.st | 10 ++ .../GLHApi.class.st | 16 +++ .../GLHModelImporter.class.st | 114 +++++++++++++----- 3 files changed, 113 insertions(+), 27 deletions(-) create mode 100644 src/GitLabHealth-Model-Extension/GLHCommit.extension.st diff --git a/src/GitLabHealth-Model-Extension/GLHCommit.extension.st b/src/GitLabHealth-Model-Extension/GLHCommit.extension.st new file mode 100644 index 0000000..3ad0669 --- /dev/null +++ b/src/GitLabHealth-Model-Extension/GLHCommit.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #GLHCommit } + +{ #category : #'*GitLabHealth-Model-Extension' } +GLHCommit >> displayStringOn: aStream [ + + aStream + << self short_id; + << ' '; + << self message +] diff --git a/src/GitLabHealth-Model-Importer/GLHApi.class.st b/src/GitLabHealth-Model-Importer/GLHApi.class.st index b1da2c5..9138fa0 100644 --- a/src/GitLabHealth-Model-Importer/GLHApi.class.st +++ b/src/GitLabHealth-Model-Importer/GLHApi.class.st @@ -44,6 +44,22 @@ GLHApi >> client: anObject [ client := anObject ] +{ #category : #'api - commits' } +GLHApi >> commit: commitSHA ofProject: aProjectId withStat: stats [ + + self client path: (String streamContents: [ :str | + str + << self baseAPIUrl; + << '/projects/'; + << aProjectId asString; + << '/repository/commits/'; + << commitSHA asString ]). + + stats ifNotNil: [ self client queryAt: #stats put: stats ]. + + ^ self client get +] + { #category : #'api - commits' } GLHApi >> commitDiff: commitSHA ofProject: aProjectId unidiff: unidiff [ diff --git a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st index e074acf..9f15460 100644 --- a/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GLHModelImporter.class.st @@ -10,6 +10,23 @@ Class { #category : #'GitLabHealth-Model-Importer' } +{ #category : #'private - api' } +GLHModelImporter >> addCommits: commitsList toRepository: aProjectRepository [ + "I take a list of GLHCommit. But some might have been parsed but are already on the model..." + + "I return the list of added commits" + + | existingCommits newlyFoundCommit | + existingCommits := aProjectRepository mooseModel allWithType: + GLHCommit. + newlyFoundCommit := commitsList reject: [ :commitParsed | + existingCommits anySatisfy: [ :existingCommit | + existingCommit id = commitParsed id ] ]. + aProjectRepository mooseModel addAll: newlyFoundCommit. + aProjectRepository commits addAll: newlyFoundCommit. + ^ newlyFoundCommit +] + { #category : #private } GLHModelImporter >> addGroupResultToModel: groupResult [ @@ -31,15 +48,36 @@ GLHModelImporter >> beWithouFiles [ GLHModelImporter >> completeImportProject: aGLHProject [ ('Complete import project: ' , aGLHProject id printString) recordInfo. - (self pipelinesOf: aGLHProject id) do: [ :pipeline | - self glhModel add: pipeline. - aGLHProject addPipeline: pipeline. - self importJobsOf: pipeline ]. + aGLHProject creator: (self importUser: aGLHProject creator_id). aGLHProject repository: GLHRepository new. self glhModel add: aGLHProject repository. self importRepository: aGLHProject repository. - self importCommits: aGLHProject + self importCommits: aGLHProject. + (self pipelinesOf: aGLHProject id) do: [ :pipeline | + self glhModel add: pipeline. + aGLHProject addPipeline: pipeline. + self importJobsOf: pipeline ] +] + +{ #category : #private } +GLHModelImporter >> configureReaderForCommit: reader [ + + reader for: DateAndTime customDo: [ :mapping | + mapping decoder: [ :string | DateAndTime fromString: string ] ]. + reader for: GLHCommit do: [ :mapping | + mapping mapInstVars: + #( id short_id title author_name author_email committer_name + committer_email message web_url ). + (mapping mapInstVar: #authored_date) valueSchema: DateAndTime. + (mapping mapInstVar: #committed_date) valueSchema: DateAndTime. + (mapping mapInstVar: #created_at) valueSchema: DateAndTime. + mapping + mapProperty: 'stats' + getter: [ :el | "Not used" ] + setter: [ :commit :value | + commit deletions: (value at: #deletions). + commit additions: (value at: #additions) ] ] ] { #category : #private } @@ -78,6 +116,24 @@ GLHModelImporter >> glhModel: anObject [ glhModel := anObject ] +{ #category : #'private - api' } +GLHModelImporter >> importCommit: aCommitID ofProject: aGLHProject [ + + | result parsedResult | + (glhModel allWithType: GLHCommit) asOrderedCollection + detect: [ :commit | commit id = aCommitID ] + ifFound: [ :commit | ^ commit ]. + result := self glhApi + commit: aCommitID + ofProject: aGLHProject id + withStat: false. + parsedResult := self parseCommitResult: result. + self + addCommits: { parsedResult } + toRepository: aGLHProject repository. + ^ parsedResult +] + { #category : #'private - api' } GLHModelImporter >> importCommits: aGLHProject [ @@ -97,9 +153,10 @@ GLHModelImporter >> importCommits: aGLHProject [ perPage: nil page: nil. parsedResults := self parseCommitsResult: results. - aGLHProject repository mooseModel addAll: parsedResults. - aGLHProject repository commits addAll: parsedResults. - self withCommitDiffs ifTrue: [ aGLHProject repository commits do: [ :commit | self importDiffOfCommit: commit ] ]. + self addCommits: parsedResults toRepository: aGLHProject repository. + self withCommitDiffs ifTrue: [ + aGLHProject repository commits do: [ :commit | + self importDiffOfCommit: commit ] ] ] { #category : #api } @@ -209,9 +266,10 @@ GLHModelImporter >> importGroup: aGroupID [ ('Import group: ' , aGroupID printString) recordInfo. result := self glhApi group: aGroupID. groupResult := self parseGroupResult: result. + self addGroupResultToModel: groupResult. groupResult projects do: [ :project | self completeImportProject: project ]. - self addGroupResultToModel: groupResult. + (self subGroupsOf: aGroupID) do: [ :subGroup | groupResult addSubGroup: (self importGroup: subGroup id) ]. ^ groupResult @@ -224,7 +282,7 @@ GLHModelImporter >> importJobsOf: aPipeline [ result := self glhApi jobsOfProject: aPipeline project id ofPipelines: aPipeline id. - jobs := self parseJobsResult: result. + jobs := self parseJobsResult: result ofProject: aPipeline project. jobs do: [ :job | aPipeline addJob: job ]. self glhModel addAll: jobs ] @@ -278,26 +336,20 @@ GLHModelImporter >> parseBranchesResult: result [ ] { #category : #private } -GLHModelImporter >> parseCommitsResult: result [ +GLHModelImporter >> parseCommitResult: result [ | reader | reader := NeoJSONReader on: result readStream. - reader for: GLHCommit do: [ :mapping | - mapping mapInstVars: - #( id short_id title author_name author_email committer_name - committer_email message web_url ). - (mapping mapInstVar: #authored_date) valueSchema: DateAndTime. - (mapping mapInstVar: #committed_date) valueSchema: DateAndTime. - (mapping mapInstVar: #created_at) valueSchema: DateAndTime. - mapping - mapProperty: 'stats' - getter: [ :el | "Not used" ] - setter: [ :commit :value | - commit deletions: (value at: #deletions). - commit additions: (value at: #additions) ] ]. + self configureReaderForCommit: reader. + ^ reader nextAs: GLHCommit +] - reader for: DateAndTime customDo: [ :mapping | - mapping decoder: [ :string | DateAndTime fromString: string ] ]. +{ #category : #private } +GLHModelImporter >> parseCommitsResult: result [ + + | reader | + reader := NeoJSONReader on: result readStream. + self configureReaderForCommit: reader. reader for: #ArrayOfCommit customDo: [ :customMappting | @@ -352,7 +404,7 @@ GLHModelImporter >> parseGroupResult: aResult [ ] { #category : #private } -GLHModelImporter >> parseJobsResult: result [ +GLHModelImporter >> parseJobsResult: result ofProject: aProject [ | reader | reader := NeoJSONReader on: result readStream. @@ -365,6 +417,14 @@ GLHModelImporter >> parseJobsResult: result [ setter: [ :object :value | object user: (self importUser: (value at: #id)) ]. + mapping + mapProperty: #commit + getter: [ :object | #ignore ] + setter: [ :object :value | + value ifNotNil: [ + object commit: + (self importCommit: (value at: #id) ofProject: aProject) ] ]. + mapping mapProperty: #duration getter: [ :object | #ignore ] From f79d3b88386b53fc1ed65a72be2f9a0db6856401 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Fri, 19 Apr 2024 15:06:00 +0200 Subject: [PATCH 12/15] add file blame --- src/GitLabHealth-Model-Importer/GLHApi.class.st | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/GitLabHealth-Model-Importer/GLHApi.class.st b/src/GitLabHealth-Model-Importer/GLHApi.class.st index 9138fa0..cf02e42 100644 --- a/src/GitLabHealth-Model-Importer/GLHApi.class.st +++ b/src/GitLabHealth-Model-Importer/GLHApi.class.st @@ -183,6 +183,23 @@ GLHApi >> editProject: aProjectID usingDictionary: aDictionaryOfNewParam [ ^ self client put ] +{ #category : #'api - repository files' } +GLHApi >> getFileBlameForProject: aProjectId andFilePath: aFilePath inRef: aRef fromLine: rangeStart toLine: rangeEnd [ + "filePath is converted here. So give a path such as ""path/to/file.md""" + + "https://docs.gitlab.com/ee/api/repository_files.html#get-file-blame-from-repository" + + self client url: + self baseAPIUrl , '/projects/' , aProjectId printString + , '/repository/files/' , (aFilePath withoutPrefix: '/') urlEncoded + , '/blame'. + self client queryAt: #ref put: aRef. + self client queryAt: #'range[start]' put: rangeStart. + self client queryAt: #'range[end]' put: rangeEnd. + + ^ self client get +] + { #category : #api } GLHApi >> group: aGroupID [ From e85cf7d0352b7de231a66023386c3844df3bfb9c Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Fri, 19 Apr 2024 15:17:27 +0200 Subject: [PATCH 13/15] add ci github --- .github/workflows/ci-moose11.yml | 63 ++++++++++++++++++++++++++++++++ .gitlab-ci.yml | 14 ------- ci/generatePUML.st | 13 +++++++ 3 files changed, 76 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/ci-moose11.yml delete mode 100644 .gitlab-ci.yml create mode 100644 ci/generatePUML.st diff --git a/.github/workflows/ci-moose11.yml b/.github/workflows/ci-moose11.yml new file mode 100644 index 0000000..6c87065 --- /dev/null +++ b/.github/workflows/ci-moose11.yml @@ -0,0 +1,63 @@ +name: CI + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + smalltalk: [ Moose64-11] + name: ${{ matrix.smalltalk }} + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. + fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. + + - uses: hpi-swa/setup-smalltalkCI@v1 + with: + smalltalk-image: ${{ matrix.smalltalk }} + + - run: smalltalkci -s ${{ matrix.smalltalk }} + shell: bash + timeout-minutes: 15 + + - name: Build meta-model planuml image + run: | + $SMALLTALK_CI_VM $SMALLTALK_CI_IMAGE st ./ci/generatePUML.st + + - name: Generate PNG UML Diagrams + uses: Timmy/plantuml-action@v1 + with: + args: -v -tpng gitproject.puml + + - name: Move artifact + run: | + mkdir doc-uml + mv *.png doc-uml + + - name: Init new repo in dist folder and commit generated files + run: | + cd doc-uml/ + git init + git add -A + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m 'update doc' + + # Careful, this can kill your project + - name: Force push to destination branch + uses: ad-m/github-push-action@v0.8.0 + with: + # Token for the repo. Can be passed in using $\{{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + force: true + # Destination branch to push changes + branch: v1/doc + # We have to push from the folder where files were generated. + # Same were the new repo was initialized in the previous step + directory: ./doc-uml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 4848b30..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,14 +0,0 @@ -image: hpiswa/smalltalkci - -stages: - - test - -Moose64-9.0: - stage: test - script: - - smalltalkci -s "Moose64-9.0" - -Moose64-10.0: - stage: test - script: - - smalltalkci -s "Moose64-10" diff --git a/ci/generatePUML.st b/ci/generatePUML.st new file mode 100644 index 0000000..c4a8b6b --- /dev/null +++ b/ci/generatePUML.st @@ -0,0 +1,13 @@ +documentor := FamixUMLDocumentor new. +documentor + model: GLHModel; + beWithStubs; + generate. + +'gitproject.puml' asFileReference writeStreamDo: [ :stream | + FamixUMLPlantUMLBackend new + outputStream: stream; + export: documentor umlEntities. +]. + +Smalltalk snapshot: false andQuit: true From f0d3ea0a96c25ff7458084f2101912022a5a803e Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Fri, 19 Apr 2024 15:22:02 +0200 Subject: [PATCH 14/15] improve export of the model --- ci/generatePUML.st | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/generatePUML.st b/ci/generatePUML.st index c4a8b6b..3628d94 100644 --- a/ci/generatePUML.st +++ b/ci/generatePUML.st @@ -2,6 +2,7 @@ documentor := FamixUMLDocumentor new. documentor model: GLHModel; beWithStubs; + excludeClasses: { GLHModel. TEntityMetaLevelDependency. Object }; generate. 'gitproject.puml' asFileReference writeStreamDo: [ :stream | From 10a839f2fccc31f4655818b8416791dea1054b3f Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Fri, 19 Apr 2024 15:25:37 +0200 Subject: [PATCH 15/15] up readme with correct model + autogenerate it --- README.md | 71 +--------------------------------------------- ci/generatePUML.st | 2 +- 2 files changed, 2 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 1410fa5..2705200 100644 --- a/README.md +++ b/README.md @@ -97,76 +97,7 @@ canvas svgExporter Here is the metamodel used in this project -```mermaid -classDiagram - class Group { - avatar_url - name - id - web_url - description - visibility - } - class Repository - class Branch { - name - } - class FileDirectory { - name - } - class Pipeline { - status - } - class FileBlob { - name - } - class File { - name - } - class Project { - creator_id - avatar_url - name - id - readme_url - web_url - archived - description - } - class User { - created_at - pronouns - twitter - linkedin - avatar_url - name - id - work_information - bot - job_title - public_email - following - web_url - bio - website_url - skype - username - state - followers - organization - location - } - File <|-- FileDirectory - File <|-- FileBlob - Group *-- Group : group - Repository *-- Branch : repository - Project *-- Pipeline : project - Branch *-- File : branch - FileDirectory *-- File : directoryOwner - Repository -- Project : repository - Group *-- Project : group - User -- Project : creator -``` +![GitProject meta-model png](https://raw.githubusercontent.com/moosetechnology/GitProjectHealth/v1/doc/gitproject.png) ## Contributor diff --git a/ci/generatePUML.st b/ci/generatePUML.st index 3628d94..f957676 100644 --- a/ci/generatePUML.st +++ b/ci/generatePUML.st @@ -2,7 +2,7 @@ documentor := FamixUMLDocumentor new. documentor model: GLHModel; beWithStubs; - excludeClasses: { GLHModel. TEntityMetaLevelDependency. Object }; + excludeClasses: { GLHModel. TEntityMetaLevelDependency. Object . GLHEntity . GLHTEntityCreator }; generate. 'gitproject.puml' asFileReference writeStreamDo: [ :stream |