From 48d135610827e1e7e0813d0c4ba6cd9841418667 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:23:10 +0100 Subject: [PATCH 1/9] feat: change GLHNoteSuggestion to use new suggestion api --- .../GLHMetamodelGenerator.class.st | 12 ++++-- .../GitlabModelImporter.class.st | 37 +++++++++++----- .../GLHNoteSuggestion.class.st | 42 +++++++++++++++++++ .../GitModelImporter.class.st | 11 +++++ 4 files changed, 87 insertions(+), 15 deletions(-) diff --git a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st index 479ecc3..44cb880 100644 --- a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st +++ b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st @@ -569,24 +569,28 @@ GLHMetamodelGenerator >> noteProperties [ { #category : #notes } GLHMetamodelGenerator >> noteRelations [ + (note property: #suggestions) -* (noteSuggestion property: #note). (note property: #mergeRequest) *- (mergeRequest property: #note). - (note property: #position) - (notePosition property: #note) + (note property: #position) <>- (notePosition property: #note) ] { #category : #notes } GLHMetamodelGenerator >> noteSuggestionProperties [ - + + noteSuggestion property: #id type: #Number . noteSuggestion property: #from_line type: #Number. noteSuggestion property: #to_line type: #Number. noteSuggestion property: #from_content type: #String. - noteSuggestion property: #to_content type: #String. + noteSuggestion property: #to_content type: #String . + noteSuggestion property: #applied type: #Boolean. + noteSuggestion property: #appliable type: #Boolean ] { #category : #notes } GLHMetamodelGenerator >> noteSuggestionRelations [ - (noteSuggestion property: #note) *- (note property: #suggestions) + "(noteSuggestion property: #note) *- (note property: #suggestions)" ] { #category : #pipelines } diff --git a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st index cf78cb7..0aeb278 100644 --- a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st @@ -359,17 +359,18 @@ GitlabModelImporter >> configureReaderForNote: reader [ super configureReaderForNote: reader. reader for: GLHNote do: [ :mapping | - mapping - mapProperty: #author - getter: [ ] - setter: [ :note :rawUser | - note cacheAt: #userID put: (rawUser at: #id) ]. - + mapProperty: #author + getter: [ ] + setter: [ :note :rawUser | + note cacheAt: #userID put: (rawUser at: #id) ]. + (mapping mapInstVar: #created_at) valueSchema: DateAndTime. (mapping mapInstVar: #updated_at) valueSchema: DateAndTime. - (mapping mapInstVar: #position) valueSchema: GLHNotePosition ] + (mapping mapInstVar: #position) valueSchema: GLHNotePosition. + (mapping mapInstVar: #suggestions) valueSchema: + #ArrayOfNoteSuggestion ] ] { #category : #'private - configure reader' } @@ -425,6 +426,15 @@ GitlabModelImporter >> configureReaderForNotePosition: reader [ notePosition end_line: endLine ] ] ] ] +{ #category : #'private - configure reader' } +GitlabModelImporter >> configureReaderForNoteSuggestion: reader [ + + reader mapInstVarsFor: GLHNoteSuggestion. + + reader for: #ArrayOfNoteSuggestion customDo: [ :customMapping | + customMapping listOfElementSchema: GLHNoteSuggestion ] +] + { #category : #'private - configure reader' } GitlabModelImporter >> configureReaderForPipeline: reader [ @@ -1478,6 +1488,14 @@ GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [ new note isNotNil and: [ existing note id = new note id ] ]. position note: item ]. + + items do: [ :item | + item suggestions do: [ :suggestion | + | newSuggestion | + newSuggestion := self glhModel + add: suggestion + unless: self blockOnIdEquality. + newSuggestion note: item ] ]. items ]) flattened. notes := mergeRequest note @@ -1489,9 +1507,7 @@ GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [ note cacheAt: #userID ifPresent: [ :id | note author: (self importUser: id) ]. - note name: note id asString. - - note suggestions: (self importSuggestionsFromNote: note) ]. + note name: note id asString ]. ^ notes ] @@ -2066,7 +2082,6 @@ GitlabModelImporter >> parseNotesResult: results [ | reader | "Créer un lecteur JSON" - reader := generalReader on: results readStream. "Corriger la conversion des dates" diff --git a/src/GitLabHealth-Model/GLHNoteSuggestion.class.st b/src/GitLabHealth-Model/GLHNoteSuggestion.class.st index 5f6edc5..01481de 100644 --- a/src/GitLabHealth-Model/GLHNoteSuggestion.class.st +++ b/src/GitLabHealth-Model/GLHNoteSuggestion.class.st @@ -46,6 +46,34 @@ GLHNoteSuggestion class >> annotation [ ^ self ] +{ #category : #'as yet unclassified' } +GLHNoteSuggestion >> appliable [ + + + + ^ appliable +] + +{ #category : #'as yet unclassified' } +GLHNoteSuggestion >> appliable: anObject [ + + appliable := anObject +] + +{ #category : #'as yet unclassified' } +GLHNoteSuggestion >> applied [ + + + + ^ applied +] + +{ #category : #'as yet unclassified' } +GLHNoteSuggestion >> applied: anObject [ + + applied := anObject +] + { #category : #accessing } GLHNoteSuggestion >> from_content [ @@ -74,6 +102,20 @@ GLHNoteSuggestion >> from_line: anObject [ from_line := anObject ] +{ #category : #'as yet unclassified' } +GLHNoteSuggestion >> id [ + + + + ^ id +] + +{ #category : #'as yet unclassified' } +GLHNoteSuggestion >> id: anObject [ + + id := anObject +] + { #category : #accessing } GLHNoteSuggestion >> note [ "Relation named: #note type: #GLHNote opposite: #suggestions" diff --git a/src/GitProjectHealth-Model-Importer/GitModelImporter.class.st b/src/GitProjectHealth-Model-Importer/GitModelImporter.class.st index e0e2bfa..a11a03f 100644 --- a/src/GitProjectHealth-Model-Importer/GitModelImporter.class.st +++ b/src/GitProjectHealth-Model-Importer/GitModelImporter.class.st @@ -332,6 +332,17 @@ GitModelImporter >> configureReaderForNotePosition: reader [ customMapping listOfElementSchema: GLHNotePosition ] ] +{ #category : #'private - configure reader' } +GitModelImporter >> configureReaderForNoteSuggestion: reader [ + + reader mapInstVarsFor: GLHNoteSuggestion. + + reader + for: #ArrayOfNoteSuggestion + customDo: [ :customMapping | + customMapping listOfElementSchema: GLHNoteSuggestion ] +] + { #category : #'private - configure reader' } GitModelImporter >> configureReaderForPipeline: reader [ From 2f15763f81fe0991bb95aca98eb0fd552440e5d0 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:46:19 +0100 Subject: [PATCH 2/9] feat: fix error in importNoteOfMergeRequest --- src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st | 1 + src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st index 44cb880..7537250 100644 --- a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st +++ b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st @@ -569,6 +569,7 @@ GLHMetamodelGenerator >> noteProperties [ { #category : #notes } GLHMetamodelGenerator >> noteRelations [ + (note property: #suggestions) -* (noteSuggestion property: #note). (note property: #mergeRequest) *- (mergeRequest property: #note). diff --git a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st index 0aeb278..55a447a 100644 --- a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st @@ -1489,7 +1489,7 @@ GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [ existing note id = new note id ] ]. position note: item ]. - items do: [ :item | + (items select: [ :item | item suggestions isNotNil ]) do: [ :item | item suggestions do: [ :suggestion | | newSuggestion | newSuggestion := self glhModel From b99f24ace5982f973bf55ee519f6715dbf38dadf Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:33:57 +0100 Subject: [PATCH 3/9] fix: suggestions have their "note" parameter has nil --- .../GLHMetamodelGenerator.class.st | 5 +-- .../GitlabModelImporter.class.st | 43 +++++++++++++------ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st index 7537250..81d0290 100644 --- a/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st +++ b/src/GitLabHealth-Model-Generator/GLHMetamodelGenerator.class.st @@ -570,8 +570,6 @@ GLHMetamodelGenerator >> noteProperties [ { #category : #notes } GLHMetamodelGenerator >> noteRelations [ - (note property: #suggestions) -* (noteSuggestion property: #note). - (note property: #mergeRequest) *- (mergeRequest property: #note). (note property: #position) <>- (notePosition property: #note) ] @@ -590,8 +588,9 @@ GLHMetamodelGenerator >> noteSuggestionProperties [ { #category : #notes } GLHMetamodelGenerator >> noteSuggestionRelations [ + (noteSuggestion property: #note) *- (note property: #suggestions) - "(noteSuggestion property: #note) *- (note property: #suggestions)" + ] { #category : #pipelines } diff --git a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st index 55a447a..fdd6ad4 100644 --- a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st @@ -369,8 +369,14 @@ GitlabModelImporter >> configureReaderForNote: reader [ (mapping mapInstVar: #updated_at) valueSchema: DateAndTime. (mapping mapInstVar: #position) valueSchema: GLHNotePosition. - (mapping mapInstVar: #suggestions) valueSchema: - #ArrayOfNoteSuggestion ] + + mapping + mapProperty: #suggestions + getter: [ ] + setter: [ :note :rawSuggestions | + | stringSuggestions | + stringSuggestions := NeoJSONWriter toString: rawSuggestions. + note cacheAt: #stringSuggestions put: stringSuggestions ] ] ] { #category : #'private - configure reader' } @@ -428,11 +434,9 @@ GitlabModelImporter >> configureReaderForNotePosition: reader [ { #category : #'private - configure reader' } GitlabModelImporter >> configureReaderForNoteSuggestion: reader [ + super configureReaderForNoteSuggestion: reader. - reader mapInstVarsFor: GLHNoteSuggestion. - reader for: #ArrayOfNoteSuggestion customDo: [ :customMapping | - customMapping listOfElementSchema: GLHNoteSuggestion ] ] { #category : #'private - configure reader' } @@ -1488,14 +1492,6 @@ GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [ new note isNotNil and: [ existing note id = new note id ] ]. position note: item ]. - - (items select: [ :item | item suggestions isNotNil ]) do: [ :item | - item suggestions do: [ :suggestion | - | newSuggestion | - newSuggestion := self glhModel - add: suggestion - unless: self blockOnIdEquality. - newSuggestion note: item ] ]. items ]) flattened. notes := mergeRequest note @@ -1507,7 +1503,10 @@ GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [ note cacheAt: #userID ifPresent: [ :id | note author: (self importUser: id) ]. - note name: note id asString ]. + note name: note id asString. + + note cacheAt: #stringSuggestions ifPresent: [ :stringSuggestions | + note suggestions: (self parseNotesSuggestionResult: stringSuggestions) ] ]. ^ notes ] @@ -2093,6 +2092,22 @@ GitlabModelImporter >> parseNotesResult: results [ ^ reader nextAs: #ArrayOfNote ] +{ #category : #'private - parsing' } +GitlabModelImporter >> parseNotesSuggestionResult: results [ + + | reader | + "Créer un lecteur JSON" + reader := generalReader on: results readStream. + + "Corriger la conversion des dates" + "reader for: DateAndTime customDo: [ :mapping | + mapping decoder: [ :string | + DateAndTime readFrom: string readStream ] ]." + + + ^ reader nextAs: #ArrayOfNoteSuggestion +] + { #category : #'private - parsing' } GitlabModelImporter >> parsePipelineResult: result [ From 93649db8379fc016b9479237532915bddb83fc26 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:39:23 +0100 Subject: [PATCH 4/9] style: remove unused comment --- .../GitlabModelImporter.class.st | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st index fdd6ad4..36bb06d 100644 --- a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st @@ -2099,13 +2099,7 @@ GitlabModelImporter >> parseNotesSuggestionResult: results [ "Créer un lecteur JSON" reader := generalReader on: results readStream. - "Corriger la conversion des dates" - "reader for: DateAndTime customDo: [ :mapping | - mapping decoder: [ :string | - DateAndTime readFrom: string readStream ] ]." - - - ^ reader nextAs: #ArrayOfNoteSuggestion + ^ reader nextAs: #ArrayOfNoteSuggestion ] { #category : #'private - parsing' } From 631e8b15cb386167b3d1be6349cf201693cc32d1 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:14:04 +0100 Subject: [PATCH 5/9] chore: remove unused method --- .../GitlabModelImporter.class.st | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st index 36bb06d..c7a9974 100644 --- a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st @@ -1712,66 +1712,6 @@ GitlabModelImporter >> importSZZFromCommit: aCommit [ ^ szzCommits ] -{ #category : #'import - notes' } -GitlabModelImporter >> importSuggestionsFromNote: glhNote [ - - | suggestions suggestion fromLine toLine suggestionsInfo | - glhNote position ifNil: [ ^ { } ]. - suggestions := MooseGroup new. - - - suggestionsInfo := self importSuggestionsInfoFromString: glhNote body. - - suggestions := suggestionsInfo collect: [ :suggestionInfo | - suggestion := GLHNoteSuggestion new. - fromLine := glhNote position end_line - - (suggestionInfo at: #minus). - toLine := glhNote position end_line - + (suggestionInfo at: #plus). - suggestion from_line: fromLine. - suggestion to_line: toLine. - suggestion to_content: (suggestionInfo at: #content). - suggestion ]. - - ^ suggestions -] - -{ #category : #'import - notes' } -GitlabModelImporter >> importSuggestionsInfoFromString: string [ - - | suggestionsInfo regex result regex2 suggestionInfo | - suggestionsInfo := OrderedCollection new. - regex := '```suggestion' asRegex. - result := regex matchesIn: string. - - result isEmpty ifTrue: [ ^ suggestionsInfo ]. - - result size > 1 ifTrue: [ - | start end firstPart secondPart | - start := string findString: '```suggestion'. - end := (string findString: '```' startingAt: start + 2) + 2. - - firstPart := string copyFrom: 1 to: end. - secondPart := string copyFrom: end to: string size. - - suggestionsInfo addAll: - (self importSuggestionsInfoFromString: firstPart). - suggestionsInfo addAll: - (self importSuggestionsInfoFromString: secondPart). - ^ suggestionsInfo ]. - - regex2 := '```suggestion\:-(\d+)\+(\d+)(.*)```' asRegex. - regex2 search: string. - - suggestionInfo := { - (#minus -> (regex2 subexpression: 2) asNumber). - (#plus -> (regex2 subexpression: 3) asNumber). - (#content -> (regex2 subexpression: 4)) } - asDictionary. - - ^ { suggestionInfo } -] - { #category : #'import - tags' } GitlabModelImporter >> importTagsForProject: aProject [ |results tags | From 4cd298a3b19f237ed923d8e13b87deda72da90e0 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:15:01 +0100 Subject: [PATCH 6/9] feat: add extension to improve display of GLHNotePosition, GLHNoteSuggestion and GLHNote --- src/GitLabHealth-Model-Extension/GLHNote.extension.st | 10 ++++++++++ .../GLHNotePosition.extension.st | 7 +++++++ .../GLHNoteSuggestion.extension.st | 7 +++++++ .../GitlabModelImporter.class.st | 3 ++- 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/GitLabHealth-Model-Extension/GLHNote.extension.st create mode 100644 src/GitLabHealth-Model-Extension/GLHNotePosition.extension.st create mode 100644 src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st diff --git a/src/GitLabHealth-Model-Extension/GLHNote.extension.st b/src/GitLabHealth-Model-Extension/GLHNote.extension.st new file mode 100644 index 0000000..85916bd --- /dev/null +++ b/src/GitLabHealth-Model-Extension/GLHNote.extension.st @@ -0,0 +1,10 @@ +Extension { #name : #GLHNote } + +{ #category : #'*GitLabHealth-Model-Extension' } +GLHNote >> name [ + + + + + ^'[' , id asString , '] ' , body +] diff --git a/src/GitLabHealth-Model-Extension/GLHNotePosition.extension.st b/src/GitLabHealth-Model-Extension/GLHNotePosition.extension.st new file mode 100644 index 0000000..1ff4545 --- /dev/null +++ b/src/GitLabHealth-Model-Extension/GLHNotePosition.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #GLHNotePosition } + +{ #category : #'*GitLabHealth-Model-Extension' } +GLHNotePosition >> mooseNameOn: aStream [ + + aStream nextPutAll: file_path +] diff --git a/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st b/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st new file mode 100644 index 0000000..8942156 --- /dev/null +++ b/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #GLHNoteSuggestion } + +{ #category : #'*GitLabHealth-Model-Extension' } +GLHNoteSuggestion >> mooseNameOn: aStream [ + + aStream nextPutAll: '[from:', from_line asString, ' to:', to_line asString, '] ', to_content. +] diff --git a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st index c7a9974..08c5923 100644 --- a/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st +++ b/src/GitLabHealth-Model-Importer/GitlabModelImporter.class.st @@ -1506,7 +1506,8 @@ GitlabModelImporter >> importNotesOfMergeRequest: mergeRequest [ note name: note id asString. note cacheAt: #stringSuggestions ifPresent: [ :stringSuggestions | - note suggestions: (self parseNotesSuggestionResult: stringSuggestions) ] ]. + note suggestions: + (self parseNotesSuggestionResult: stringSuggestions) ] ]. ^ notes ] From 66eb30706a83de3fc11f5240d3028e2b4b885701 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:21:41 +0100 Subject: [PATCH 7/9] test: remove tests of importSugestions --- .../GitlabModelImporterTest.class.st | 150 ------------------ 1 file changed, 150 deletions(-) diff --git a/src/GitLabHealth-Model-Importer-Tests/GitlabModelImporterTest.class.st b/src/GitLabHealth-Model-Importer-Tests/GitlabModelImporterTest.class.st index 3bd5479..b522929 100644 --- a/src/GitLabHealth-Model-Importer-Tests/GitlabModelImporterTest.class.st +++ b/src/GitLabHealth-Model-Importer-Tests/GitlabModelImporterTest.class.st @@ -386,156 +386,6 @@ GitlabModelImporterTest >> testImportProjects [ self assert: element repository isNil. ] -{ #category : #tests } -GitlabModelImporterTest >> testImportSuggestionsFromNote [ - - | body position glhNote result suggestion | - body := ' - test - ```suggestion:-0+5 - content -```'. - - position := GLHNotePosition new - start_line: 2; - end_line: 2. - glhNote := GLHNote new - body: body; - position: position. - - - result := importer importSuggestionsFromNote: glhNote. - - self assert: result size equals: 1. - - suggestion := result first. - self assert: suggestion from_line equals: 2. - self assert: suggestion to_line equals: 7. - self assert: suggestion to_content trim equals: 'content' -] - -{ #category : #tests } -GitlabModelImporterTest >> testImportSuggestionsFromNoteWithDifferentStartAndEndLine [ - - | body position glhNote result suggestion | - body := ' - test - ```suggestion:-2+5 - content -```'. - - position := GLHNotePosition new - start_line: 2; - end_line: 5. - glhNote := GLHNote new - body: body; - position: position. - - - result := importer importSuggestionsFromNote: glhNote. - - self assert: result size equals: 1. - - suggestion := result first. - self assert: suggestion from_line equals: 3. - self assert: suggestion to_line equals: 10. - self assert: suggestion to_content trim equals: 'content' -] - -{ #category : #tests } -GitlabModelImporterTest >> testImportSuggestionsFromNoteWithMultipleSuggestions [ - - | body position glhNote result suggestion suggestion2 | - body := ' - test - ```suggestion:-2+5 - content -``` - -```suggestion:-0+0 -```'. - - position := GLHNotePosition new - start_line: 2; - end_line: 5. - glhNote := GLHNote new - body: body; - position: position. - - - result := importer importSuggestionsFromNote: glhNote. - - self assert: result size equals: 2. - - suggestion := result first. - self assert: suggestion from_line equals: 3. - self assert: suggestion to_line equals: 10. - self assert: suggestion to_content trim equals: 'content'. - - suggestion2 := result at: 2. - self assert: suggestion2 from_line equals: 5. - self assert: suggestion2 to_line equals: 5. - self assert: suggestion2 to_content trim equals: '' -] - -{ #category : #tests } -GitlabModelImporterTest >> testImportSuggestionsInfoFromString [ - - | string result suggestion | - string := ' - some content - ```suggestion:-0+2 - test -```'. - - result := importer importSuggestionsInfoFromString: string. - - self assert: result size equals: 1. - suggestion := result first. - self assert: (suggestion at: #minus) equals: 0. - self assert: (suggestion at: #plus) equals: 2. - self assert: (suggestion at: #content) trim equals: 'test' -] - -{ #category : #tests } -GitlabModelImporterTest >> testImportSuggestionsInfoFromStringWithMultipleSuggestion [ - - | string result suggestion suggestion2 | - string := '```suggestion:-0+2 - test -``` - -```suggestion:-2+4 - -oui - -```'. - - result := importer importSuggestionsInfoFromString: string. - - self assert: result size equals: 2. - suggestion := result first. - self assert: (suggestion at: #minus) equals: 0. - self assert: (suggestion at: #plus) equals: 2. - self assert: (suggestion at: #content) trim equals: 'test'. - - suggestion2 := result at: 2. - self assert: (suggestion2 at: #minus) equals: 2. - self assert: (suggestion2 at: #plus) equals: 4. - self assert: (suggestion2 at: #content) trim equals: 'oui' -] - -{ #category : #tests } -GitlabModelImporterTest >> testImportSuggestionsInfoFromStringWithNoSuggestions [ - - | string result | - string := 'a normal comment'. - - result := importer importSuggestionsInfoFromString: string. - - self assert: result size equals: 0. -] - { #category : #'tests - tags' } GitlabModelImporterTest >> testImportTagsForProject [ From 199a9673f9c84c157192545275de1b6bc05b9075 Mon Sep 17 00:00:00 2001 From: Kilian B <60846047+knowbased@users.noreply.github.com> Date: Thu, 26 Feb 2026 11:49:07 +0100 Subject: [PATCH 8/9] feat: push new model --- src/GitLabHealth-Model/GLHIssue.class.st | 2 +- src/GitLabHealth-Model/GLHJob.class.st | 2 +- src/GitLabHealth-Model/GLHNote.class.st | 19 +++++++++++++++- .../GLHNotePosition.class.st | 22 ++++++++++++++++++- .../GLHNoteSuggestion.class.st | 18 ++++++++++----- 5 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/GitLabHealth-Model/GLHIssue.class.st b/src/GitLabHealth-Model/GLHIssue.class.st index 80320c0..2d6fc7b 100644 --- a/src/GitLabHealth-Model/GLHIssue.class.st +++ b/src/GitLabHealth-Model/GLHIssue.class.st @@ -27,8 +27,8 @@ an Issues help collaboration within a team to plan, track, and deliver work | `description` | `String` | nil | | | `due_date` | `Object` | nil | | | `id` | `Number` | nil | | -| `name` | `String` | nil | | | `name` | `String` | nil | Basic name of the entity, not full reference.| +| `name` | `String` | nil | | | `state` | `String` | nil | | | `updated_at` | `Object` | nil | | diff --git a/src/GitLabHealth-Model/GLHJob.class.st b/src/GitLabHealth-Model/GLHJob.class.st index bed62ed..b50f9f3 100644 --- a/src/GitLabHealth-Model/GLHJob.class.st +++ b/src/GitLabHealth-Model/GLHJob.class.st @@ -20,8 +20,8 @@ A CI Job | `allow_failure` | `Boolean` | nil | | | `duration` | `Object` | nil | | | `id` | `Number` | nil | | -| `name` | `String` | nil | Basic name of the entity, not full reference.| | `name` | `String` | nil | | +| `name` | `String` | nil | Basic name of the entity, not full reference.| | `ref` | `String` | nil | | | `web_url` | `String` | nil | | diff --git a/src/GitLabHealth-Model/GLHNote.class.st b/src/GitLabHealth-Model/GLHNote.class.st index 89c1a2b..8d3f333 100644 --- a/src/GitLabHealth-Model/GLHNote.class.st +++ b/src/GitLabHealth-Model/GLHNote.class.st @@ -4,13 +4,17 @@ a note (a diff) proposed in a Merge Request; can be accepted, modified or delete ## Relations ====================== +### Children +| Relation | Origin | Opposite | Type | Comment | +|---| +| `position` | `GLHNote` | `note` | `GLHNotePosition` | | + ### Other | Relation | Origin | Opposite | Type | Comment | |---| | `mergeRequest` | `GLHNote` | `note` | `GLHMergeRequest` | | | `position` | `GLHNote` | `note` | `GLHNotePosition` | | | `position` | `GLHNote` | `note` | `GLHNotePosition` | | -| `position` | `GLHNote` | `note` | `GLHNotePosition` | | | `suggestions` | `GLHNote` | `note` | `GLHNoteSuggestion` | | @@ -223,6 +227,12 @@ GLHNote >> mergeRequest: anObject [ mergeRequest := anObject ] +{ #category : #printing } +GLHNote >> mooseNameOn: stream [ + + stream nextPutAll: '[', id asString, ']', body +] + { #category : #accessing } GLHNote >> noteable_id [ @@ -280,6 +290,13 @@ GLHNote >> position: anObject [ position := anObject ] +{ #category : #navigation } +GLHNote >> positionGroup [ + + + ^ MooseSpecializedGroup with: self position +] + { #category : #accessing } GLHNote >> project_id [ diff --git a/src/GitLabHealth-Model/GLHNotePosition.class.st b/src/GitLabHealth-Model/GLHNotePosition.class.st index ee76ee3..9492fde 100644 --- a/src/GitLabHealth-Model/GLHNotePosition.class.st +++ b/src/GitLabHealth-Model/GLHNotePosition.class.st @@ -4,10 +4,14 @@ indicate the position of a note ## Relations ====================== -### Other +### Parents | Relation | Origin | Opposite | Type | Comment | |---| | `note` | `GLHNotePosition` | `position` | `GLHNote` | | + +### Other +| Relation | Origin | Opposite | Type | Comment | +|---| | `note` | `GLHNotePosition` | `position` | `GLHNote` | | | `note` | `GLHNotePosition` | `position` | `GLHNote` | | @@ -94,11 +98,20 @@ GLHNotePosition >> file_path: anObject [ file_path := anObject ] +{ #category : #printing } +GLHNotePosition >> mooseNameOn: stream + +mooseNameOn: aStream [ + + aStream nextPutAll: 'test' +] + { #category : #accessing } GLHNotePosition >> note [ "Relation named: #note type: #GLHNote opposite: #position" + ^ note ] @@ -110,6 +123,13 @@ GLHNotePosition >> note: anObject [ note := anObject ] +{ #category : #navigation } +GLHNotePosition >> noteGroup [ + + + ^ MooseSpecializedGroup with: self note +] + { #category : #accessing } GLHNotePosition >> original_file_path [ diff --git a/src/GitLabHealth-Model/GLHNoteSuggestion.class.st b/src/GitLabHealth-Model/GLHNoteSuggestion.class.st index 01481de..0bbdf66 100644 --- a/src/GitLabHealth-Model/GLHNoteSuggestion.class.st +++ b/src/GitLabHealth-Model/GLHNoteSuggestion.class.st @@ -15,8 +15,11 @@ suggestion of code made in a note | Name | Type | Default value | Comment | |---| +| `appliable` | `Boolean` | nil | | +| `applied` | `Boolean` | nil | | | `from_content` | `String` | nil | | | `from_line` | `Number` | nil | | +| `id` | `Number` | nil | | | `name` | `String` | nil | Basic name of the entity, not full reference.| | `to_content` | `String` | nil | | | `to_line` | `Number` | nil | | @@ -28,10 +31,13 @@ Class { #traits : 'FamixTNamedEntity', #classTraits : 'FamixTNamedEntity classTrait', #instVars : [ + '#id => FMProperty', '#from_line => FMProperty', '#to_line => FMProperty', '#from_content => FMProperty', '#to_content => FMProperty', + '#applied => FMProperty', + '#appliable => FMProperty', '#note => FMOne type: #GLHNote opposite: #suggestions' ], #category : #'GitLabHealth-Model-Entities' @@ -46,7 +52,7 @@ GLHNoteSuggestion class >> annotation [ ^ self ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GLHNoteSuggestion >> appliable [ @@ -54,13 +60,13 @@ GLHNoteSuggestion >> appliable [ ^ appliable ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GLHNoteSuggestion >> appliable: anObject [ appliable := anObject ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GLHNoteSuggestion >> applied [ @@ -68,7 +74,7 @@ GLHNoteSuggestion >> applied [ ^ applied ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GLHNoteSuggestion >> applied: anObject [ applied := anObject @@ -102,7 +108,7 @@ GLHNoteSuggestion >> from_line: anObject [ from_line := anObject ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GLHNoteSuggestion >> id [ @@ -110,7 +116,7 @@ GLHNoteSuggestion >> id [ ^ id ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } GLHNoteSuggestion >> id: anObject [ id := anObject From b9f160390df799bdbbc039e676e22f411f23d529 Mon Sep 17 00:00:00 2001 From: Benoit Verhaeghe Date: Mon, 2 Mar 2026 08:18:24 +0100 Subject: [PATCH 9/9] Update src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st --- .../GLHNoteSuggestion.extension.st | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st b/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st index 8942156..bdef403 100644 --- a/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st +++ b/src/GitLabHealth-Model-Extension/GLHNoteSuggestion.extension.st @@ -3,5 +3,10 @@ Extension { #name : #GLHNoteSuggestion } { #category : #'*GitLabHealth-Model-Extension' } GLHNoteSuggestion >> mooseNameOn: aStream [ - aStream nextPutAll: '[from:', from_line asString, ' to:', to_line asString, '] ', to_content. + aStream nextPutAll: '[from:'; + nextPutAll: from_line asString; + nextPutAll: ' to:'; + nextPutAll: to_line asString; + nextPutAll: '] '; + nextPutAll: to_content. ]