Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Execute linter rules all at once to save time #250

Merged
merged 2 commits into from
May 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
helpers
collectTestObjects
| classes |
classes := SystemNavigation default allClasses.
classes := classes select: [ :each | each class category beginsWith: 'Algernon' ].
^ classes collect: [ :each | each as: SLTestObject ].
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
helpers
evaluateClassTests: aCollection
| positiveResults |
positiveResults := aCollection select: [ :classTest |
(classTest methods select: [ :methodTest |
(self evaluateMethodTest: methodTest) size > 0]) size > 0].

(positiveResults size > 0) ifTrue: [
self signalFailure: 'ALGLint found problems in ' , positiveResults size asString , ' class(es). (See Transcript or log above)'].
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
helpers
evaluateMethodTest: aSLMethodTest
| results |
results := aSLMethodTest results.
^ results select: [ :result |
result value ifTrue: [
Transcript cr.
Transcript show: '=== ALGLint Failure ==='.
Transcript cr.
Transcript show: '''' , aSLMethodTest name , ''' failed on ''' , result testData name , '''.'.
Transcript cr.
Transcript show: 'Description: ' , result testData description.
Transcript cr.].
result value]

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
helpers
lintingRules
^ {
"Bugs"
#smallLintBooleanPrecedence.
#smallLintMethodModifierFinal.
#smallLintMethodModifierSuper.
#smallLintMethodModifierOverride.
#smallLintUsesTrue.
#smallLintOverridesSpecialMessage.
#smallLintSubclassResponsibilityNotDefined.
#smallLintMethodModifierSuper.
#smallLintUndeclaredReference.
#smallLintSendsUnknownMessageToGlobal.
#smallLintVariableNotDefined.

"Possible Bugs"
#smallLintAddRemoveDependents.
#smallLintAbstractClass.
#smallLintClassInstVarNotInitialized.
#smallLintEmptyExceptionHandler.
#smallLintDefinesEqualNotHash.
#smallLintFloatEqualityComparison.
#smallLintLiteralArrayContainsComma.
#smallLintLiteralArrayContainsSuspiciousTrueFalseOrNil.
#smallLintCollectionCopyEmpty.
#smallLintReturnsIfTrue.
#smallLintReturnInEnsure.
#smallLintTempsReadBeforeWritten.
#smallLintThreeElementPoint.
#smallLintUncommonMessageSend.
#smallLintUnconditionalRecursion.
#smallLintUnpackagedCode.
#smallLintEqualNotUsed.
#smallLintFileBlocks.
#smallLintUsesAdd.

"Code-Style"
#smallLintDefinesEqualNotHash.
#smallLintEqualNotUsed.
#smallLintEqualsTrue.
#smallLintExtraBlock.
#smallLintJustSendsSuper.
#smallLintMethodModifierOverride.
#smallLintReturnsIfTrue.
#smallLintWhileTrue.

"Intention revealing"
#smallLintClassVariableCapitalization.
#smallLintContains.
#smallLintDetectContains.
#smallLintLiteralArrayCharacters.
#smallLintMissingSubclassResponsibility.
#smallLintSearchingLiteral.
#smallLintSizeCheck.
#smallLintTemporaryVariableCapitalization.
#smallLintCollectSelectNotUsed.

"Spelling"
#smallLintClassCategoriesSpelling.
#smallLintClassVariableNamesSpelling.

"Unnecessary code"
#smallLintAssignmentWithoutEffect.
#smallLintEndTrueFalse.
#smallLintJustSendsSuper.
#smallLintEqualsTrue.
#smallLintExtraBlock.
#smallLintUnreferencedVariables.

"Miscellaneous"
#smallLintAsOrderedCollectionNotNeeded.
#smallLintAssignmentInBlock.
#classNameInSelector:.
#smallLintExcessiveInheritance.
#smallLintIfTrueBlocks.
#smallLintStringConcatenation.
#smallLintUnclassifiedMethods.
#smallLintUnoptimizedAndOr.
#smallLintUnoptimizedToDo.
#smallLintYourselfNotUsed.
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
helpers
testLinting
"Test all Algernon methods for all rules defined in #lintingRules"
| testRunner testObjects |
testRunner := (SLTestRunner new) environment: (SLDefaultEnvironment new).
testObjects := self collectTestObjects.

testRunner runOnTests: self lintingRules andTestObjects: testObjects.
self evaluateClassTests: testObjects.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading