class: Builder::LintReport
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 01 Mar 2013 10:42:50 +0100
changeset 117 d7f87303b984
parent 116 26775417f337
child 118 7e93ef8c5417
class: Builder::LintReport added: #cmdlineOptionRuleset #setupRulesFrom: changed: #setUp category of:
reports/Builder__LintReport.st
--- a/reports/Builder__LintReport.st	Thu Feb 21 19:14:15 2013 +0100
+++ b/reports/Builder__LintReport.st	Fri Mar 01 10:42:50 2013 +0100
@@ -45,6 +45,22 @@
     "Created: / 13-01-2012 / 12:43:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!LintReport methodsFor:'command line options'!
+
+cmdlineOptionRuleset
+
+    ^CmdLineOption new
+        short: $s;
+        long: 'ruleset';
+        description: 'Rule set ';
+        action:[:option |
+            self setupRulesFrom: option.
+        ];
+        yourself
+
+    "Created: / 28-02-2013 / 23:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !LintReport methodsFor:'generating'!
 
 generateClass: aClass
@@ -208,10 +224,25 @@
 setUp
 
     super setUp.
-    rules := (RBCompositeLintRule rulesFor: RBBasicLintRule)
-                reject: [ :each | each class name endsWith: 'SpellingRule' ]
+    rules isNil ifTrue:[
+        rules := (RBCompositeLintRule rulesFor: RBBasicLintRule)
+                 reject: [ :each | each class name endsWith: 'SpellingRule' ]
+    ].
 
     "Created: / 04-08-2011 / 14:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 28-02-2013 / 23:18:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+setupRulesFrom: filename
+    | file |    
+    file := filename asFilename.
+    file readingFileDo:[:s|
+        | spec |
+        spec := Parser parseLiteralArray: s.
+        rules := spec decodeAsLiteralArray rules.
+    ]
+
+    "Created: / 28-02-2013 / 23:17:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !LintReport methodsFor:'testing'!
@@ -238,4 +269,5 @@
     ^ '§Id: Builder__LintReport.st 293 2011-11-25 21:42:31Z vranyj1 §'
 ! !
 
+
 LintReport initialize!