-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish Log Parsing (including Colors)
Co-authored-by: SebastianWagner2 <sebastian.wagner@student.hpi.uni-potsdam.de>
- Loading branch information
1 parent
9150d14
commit 5f3174e
Showing
5 changed files
with
48 additions
and
31 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/class/ansiCodeDictonary.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
constants | ||
ansiCodeDictonary | ||
|
||
^ Dictionary newFrom: { | ||
'[31m' -> (Dictionary newFrom: { 'prefix' -> 'FAIL'. 'color' -> (ATDDTestingEntity colorDictionary at: #error) }). | ||
'[32m' -> (Dictionary newFrom: { 'prefix' -> 'PASS'. 'color' -> (ATDDTestingEntity colorDictionary at: #successful) }) | ||
} |
2 changes: 1 addition & 1 deletion
2
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/instance/isSmalltalkCILog..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
updating | ||
isSmalltalkCILog: aString | ||
|
||
^ aString includesSubstring: 'Run hpi-swa/setup-smalltalkCI' | ||
^ aString includesSubstring: 'Run hpi-swa/setup-smalltalkCI' |
45 changes: 25 additions & 20 deletions
45
packages/AutoTDD-GUI.package/ATDDGitHubActionResults.class/instance/parseAnsiCodeOf..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,29 @@ | ||
updating | ||
parseAnsiCodeOf: aString | ||
|
||
|parsedLine| | ||
| parsedLine prefixColorDictonary match | | ||
|
||
parsedLine := aString. | ||
(parsedLine includesSubstring: '[32') | ||
ifTrue: [parsedLine := parsedLine asText addAttribute: (TextColor color: Color green)] | ||
ifFalse: [ | ||
(parsedLine includesSubstring: '[31') | ||
ifTrue: [parsedLine := parsedLine asText addAttribute: (TextColor color: Color red)] | ||
ifFalse: [ | ||
(parsedLine includesSubstring: '[34') | ||
ifTrue: [parsedLine := parsedLine asText addAttribute: (TextColor color: Color blue)] | ||
] | ||
]. | ||
parsedLine := parsedLine copyReplaceAll: '[0m' with: ''. | ||
parsedLine := parsedLine copyReplaceAll: '[1m' with: ''. | ||
parsedLine := parsedLine copyReplaceAll: '[31m' with: ''. | ||
parsedLine := parsedLine copyReplaceAll: '[32m' with: ''. | ||
parsedLine := parsedLine copyReplaceAll: '[34m' with: ''. | ||
parsedLine := parsedLine copyReplaceAll: '✗' with: '[FAIL]'. "This question mark is a cross" | ||
parsedLine := parsedLine copyReplaceAll: '✓' with: '[PASS]'. "This question mark is a check mark" | ||
^ parsedLine | ||
"Set default values" | ||
parsedLine := aString. | ||
match := (parsedLine allRegexMatches: '#\w* \(\d*ms\)') at: 1 ifAbsent: [ nil ]. | ||
|
||
self class ansiCodeDictonary keysAndValuesDo: [ :aKey :aDictionary | | ||
match ifNotNil: [ | ||
(parsedLine includesSubstring: aKey) ifTrue: [ prefixColorDictonary := aDictionary ] | ||
] | ||
]. | ||
|
||
"Remove all Ansi Codes" | ||
parsedLine := parsedLine copyWithRegex: '\[\d+m' matchesReplacedWith: ''. | ||
parsedLine := match ifNil: [ parsedLine ]. | ||
|
||
prefixColorDictonary ifNotNil: [ | ||
parsedLine := | ||
' [' asText, | ||
((prefixColorDictonary at: 'prefix') asText addAttribute: (TextColor color: (prefixColorDictonary at: 'color'))), | ||
'] ' asText, | ||
parsedLine asText | ||
] | ||
ifNil: [ parsedLine := parsedLine asText ]. | ||
|
||
^ parsedLine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters