From b18f3bb9d2ae8cfc45ff454d124f5ba9c5197a39 Mon Sep 17 00:00:00 2001 From: CyrilFerlicot Date: Mon, 30 Oct 2023 15:28:59 +0100 Subject: [PATCH] Move methods from Manifest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple methods are defined in the Manifest package but are used only for the critics UI. I propose to move them to the UI package. I also used packages instead of categories and updated a call to a deprecated method. --- .../ClassDescription.extension.st | 8 ++++ .../CompiledMethod.extension.st | 14 +++++++ .../RPackage.extension.st | 8 ++++ .../StCritiqueBrowserPresenter.class.st | 38 +++++++++---------- 4 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 src/NewTools-CodeCritiques/ClassDescription.extension.st create mode 100644 src/NewTools-CodeCritiques/CompiledMethod.extension.st create mode 100644 src/NewTools-CodeCritiques/RPackage.extension.st diff --git a/src/NewTools-CodeCritiques/ClassDescription.extension.st b/src/NewTools-CodeCritiques/ClassDescription.extension.st new file mode 100644 index 000000000..a54b20207 --- /dev/null +++ b/src/NewTools-CodeCritiques/ClassDescription.extension.st @@ -0,0 +1,8 @@ +Extension { #name : 'ClassDescription' } + +{ #category : '*NewTools-CodeCritiques' } +ClassDescription >> criticNameOn: aStream [ + "This behavior may be folded later by changing the name of this method or using another one." + + aStream << self name << ' (' << self package name << ')' +] diff --git a/src/NewTools-CodeCritiques/CompiledMethod.extension.st b/src/NewTools-CodeCritiques/CompiledMethod.extension.st new file mode 100644 index 000000000..59b365696 --- /dev/null +++ b/src/NewTools-CodeCritiques/CompiledMethod.extension.st @@ -0,0 +1,14 @@ +Extension { #name : 'CompiledMethod' } + +{ #category : '*NewTools-CodeCritiques' } +CompiledMethod >> criticNameOn: aStream [ + "This behavior may be folded later by changing the name of this method or using another one." + + aStream + << self methodClass name + << '>>#' + << self selector + << ' (' + << self methodClass package name + << ')' +] diff --git a/src/NewTools-CodeCritiques/RPackage.extension.st b/src/NewTools-CodeCritiques/RPackage.extension.st new file mode 100644 index 000000000..cba13aac4 --- /dev/null +++ b/src/NewTools-CodeCritiques/RPackage.extension.st @@ -0,0 +1,8 @@ +Extension { #name : 'RPackage' } + +{ #category : '*NewTools-CodeCritiques' } +RPackage >> criticNameOn: aStream [ + "This behavior may be folded later by changing the name of this method or using another one." + + aStream << self packageName +] diff --git a/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st b/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st index 4d61da85f..4018bd5e5 100644 --- a/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st +++ b/src/NewTools-CodeCritiques/StCritiqueBrowserPresenter.class.st @@ -143,32 +143,28 @@ StCritiqueBrowserPresenter >> allRules [ { #category : 'private' } StCritiqueBrowserPresenter >> applyRules [ + | packageCount nbPackage process rules | rules := self allRules. nbPackage := rbEnvironment packages size. packageCount := 0. self updateTree. - process := [ rbEnvironment packages - do: [ :package | - | windowTitle | - packageCount := packageCount + 1. - windowTitle := String - streamContents: [ :s | - s << 'run rules on ' << package packageName << ' (' - << packageCount asString << '/' << nbPackage asString << ')' ]. - self setTitle: windowTitle. - checker - runRules: rules - onPackage: package - withoutTestCase: removeTestCase ]. - checker rule: rules. - self setTitle: self defaultTitle. - cache packages: rbEnvironment. - cache initCache. - self rules: (self allRules select: [ :r | self hasBrokenRules: r]). - self rulesModel refresh. - self rebuildLayout. - self updateTree. ] newProcess. + process := [ + rbEnvironment packages do: [ :package | + | windowTitle | + packageCount := packageCount + 1. + windowTitle := String streamContents: [ :s | + s << 'run rules on ' << package name << ' (' << packageCount asString << '/' << nbPackage asString << ')' ]. + self setTitle: windowTitle. + checker runRules: rules onPackage: package withoutTestCase: removeTestCase ]. + checker rule: rules. + self setTitle: self defaultTitle. + cache packages: rbEnvironment. + cache initCache. + self rules: (self allRules select: [ :r | self hasBrokenRules: r ]). + self rulesModel refresh. + self rebuildLayout. + self updateTree ] newProcess. process name: 'SmallLint'. process resume ]