diff --git a/repository/Grafoscopio/FileUtils.class.st b/repository/Grafoscopio/FileUtils.class.st new file mode 100644 index 0000000..411aa0d --- /dev/null +++ b/repository/Grafoscopio/FileUtils.class.st @@ -0,0 +1,28 @@ +" +I provide some convenience functionality to work with files. +" +Class { + #name : #FileUtils, + #superclass : #Object, + #category : #'Grafoscopio-Model' +} + +{ #category : #utilities } +FileUtils class >> createFilesNamed: fileNames endingWith: fileExtension intoFolder: aFolder [ + + | createdFiles fullFileName existingFiles typedFileName | + createdFiles := OrderedCollection new. + existingFiles := OrderedCollection new. + fileNames do: [ :eachFile | + typedFileName := eachFile, fileExtension. + fullFileName := aFolder / typedFileName. + fullFileName exists + ifFalse: [ + fullFileName ensureCreateFile. + createdFiles add: fullFileName basename ] + ifTrue: [existingFiles add: fullFileName basename ]]. + ^ (Dictionary new + at: 'created files' put: createdFiles; + at: 'existing files' put: existingFiles; + yourself) +] diff --git a/repository/Grafoscopio/GrafoscopioNode.class.st b/repository/Grafoscopio/GrafoscopioNode.class.st index 8d7d3be..b56d998 100644 --- a/repository/Grafoscopio/GrafoscopioNode.class.st +++ b/repository/Grafoscopio/GrafoscopioNode.class.st @@ -41,7 +41,7 @@ GrafoscopioNode class >> cleanTreeRootReferences [ clipboard preorderTraversal allButFirstDo: [ :n | ref := n. n level - 1 timesRepeat: [ ref := ref parent ]. - ref parent: nil + ref ifNotNil: [ ref parent: nil ] ] ] diff --git a/repository/Grafoscopio/ManifestGrafoscopio.class.st b/repository/Grafoscopio/ManifestGrafoscopio.class.st index 3dd416b..f578248 100644 --- a/repository/Grafoscopio/ManifestGrafoscopio.class.st +++ b/repository/Grafoscopio/ManifestGrafoscopio.class.st @@ -26,3 +26,8 @@ ManifestGrafoscopio class >> ruleRBLongMethodsRuleV1FalsePositive [ ManifestGrafoscopio class >> ruleRBSentNotImplementedRuleV1FalsePositive [ ^ #(#(#(#RGMetaclassDefinition #(#'GrafoscopioGUI class' #GrafoscopioGUI)) #'2015-12-23T10:38:16.706667-05:00') #(#(#RGClassDefinition #(#GrafoscopioGUI)) #'2016-01-06T18:53:45.844051-05:00') #(#(#RGMethodDefinition #(#GrafoscopioNotebook #newWindowMainMenu #false)) #'2016-12-17T18:51:40.617924-05:00') ) ] + +{ #category : #'code-critics' } +ManifestGrafoscopio class >> ruleRBStringConcatenationRuleV1FalsePositive [ + ^ #(#(#(#RGMethodDefinition #(#'FileUtils class' #createFilesNamed:endingWith:intoFolder: #true)) #'2017-01-01T21:48:26.712639-05:00') ) +]