reports/Builder__LintReport.st
author Claus Gittinger <cg@exept.de>
Thu, 28 Mar 2019 13:54:38 +0100
changeset 542 aa25a71be62a
parent 267 9f55d8893118
permissions -rw-r--r--
#DOCUMENTATION by cg class: stx_goodies_builder_quickSelfTest class definition class: stx_goodies_builder_quickSelfTest class added:18 methods
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/builder/reports' }"
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Builder }"
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
Report subclass:#LintReport
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:'environment rules'
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'Builder-Reports'
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
!LintReport methodsFor:'accessing - defaults'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
defaultFileSuffix
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
    ^ 'Lint'
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
    "Modified: / 08-10-2011 / 10:49:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
defaultFormat
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
    "raise an error: must be redefined in concrete subclass(es)"
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
    ^ LintReportFormat::PMD new
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
    "Modified: / 25-11-2011 / 22:06:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
79
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    28
!
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    29
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    30
defaultName
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    31
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    32
    environment isNil ifTrue:[^super defaultName].
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    33
    ^environment label
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    34
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    35
    "Modified: / 25-11-2011 / 22:06:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
    36
    "Created: / 13-01-2012 / 12:43:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
117
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    39
!LintReport methodsFor:'command line options'!
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    40
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    41
cmdlineOptionRuleset
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    42
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    43
    ^CmdLineOption new
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    44
        short: $s;
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    45
        long: 'ruleset';
233
8ea8b3692704 Better command line help for standalone report runner.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 203
diff changeset
    46
        description: 'defines set of rules to check against.';
117
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    47
        action:[:option |
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    48
            self setupRulesFrom: option.
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    49
        ];
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    50
        yourself
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    51
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    52
    "Created: / 28-02-2013 / 23:13:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
233
8ea8b3692704 Better command line help for standalone report runner.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 203
diff changeset
    53
    "Modified: / 27-05-2014 / 16:54:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
117
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    54
! !
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
    55
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
!LintReport methodsFor:'generating'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    58
generateClass:class inPackage:package 
267
9f55d8893118 Fixes for Lint report - generate absolute filenames pointing to existing files
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 254
diff changeset
    59
    | sourceInfo |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    61
    sourceInfo := ReportSourceInfo forClass:class inPackage:package.
267
9f55d8893118 Fixes for Lint report - generate absolute filenames pointing to existing files
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 254
diff changeset
    62
    format writeFile:(sourceInfo pathNameAbsolute: true)
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    63
        with:[
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    64
            self generateClass:class source:sourceInfo inPackage: package.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    65
            self generateClass:class class source:sourceInfo inPackage: package.
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
        ].
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    68
    "Created: / 15-12-2014 / 10:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
267
9f55d8893118 Fixes for Lint report - generate absolute filenames pointing to existing files
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 254
diff changeset
    69
    "Modified: / 16-12-2014 / 10:38:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
    72
generateClass: aClass selector: aSelector source: sourceInfo
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
    73
        | matching |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
        matching := rules select: [ :each | 
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
                (self isSelectorEnvironment: each result)
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
                        and: [ each result includesSelector: aSelector in: aClass ] ].
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
    77
        self generateViolations: matching class: aClass selector: aSelector source: sourceInfo
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    "Created: / 07-10-2011 / 11:04:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
    80
    "Modified: / 01-03-2013 / 18:10:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    83
generateClass: aClass selector: aSelector source: sourceInfo inPackage: package
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
    84
        | matching |
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    85
        matching := rules select: [ :each | 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    86
                (self isSelectorEnvironment: each result)
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    87
                        and: [ each result includesSelector: aSelector in: aClass ] ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    88
        self generateViolations: matching class: aClass selector: aSelector source: sourceInfo
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    89
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    90
    "Created: / 15-12-2014 / 11:04:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    91
!
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    92
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    93
generateClass: aClass source: sourceInfo inPackage: package 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    94
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    95
    | matching |
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    96
    (environment definesClass: aClass) ifTrue: [
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    97
        matching := rules select: [ :rule | (self isClassEnvironment: rule result) and: [ rule result includesClass: aClass ] ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    98
        self generateViolations: matching class: aClass source: sourceInfo
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
    99
    ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   100
    (environment selectorsForClass: aClass) asSortedCollection do: [ :selector | 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   101
        self generateClass: aClass selector: selector source: sourceInfo inPackage: package
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   102
    ]
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   103
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   104
    "Created: / 15-12-2014 / 11:05:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   105
!
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   106
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   107
generateClassesInPackage:package 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   108
    (ProjectDefinition searchForClassesWithProject:package) do:[:cls | 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   109
        self generateClass:cls inPackage:package
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   110
    ].
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   112
    "Created: / 15-12-2014 / 10:52:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   113
!
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   114
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   115
generateExtensionsInPackage:package 
267
9f55d8893118 Fixes for Lint report - generate absolute filenames pointing to existing files
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 254
diff changeset
   116
    | sourceInfo |
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   117
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   118
    sourceInfo := ReportSourceInfo forExtensionsInPackage:package.
267
9f55d8893118 Fixes for Lint report - generate absolute filenames pointing to existing files
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 254
diff changeset
   119
    format writeFile:(sourceInfo pathNameAbsolute: true)
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   120
        with:[
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   121
            (ProjectDefinition searchForExtensionsWithProject:package) do:[:method | 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   122
                self 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   123
                    generateClass:method mclass
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   124
                    selector:method selector
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   125
                    source:sourceInfo
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   126
                    inPackage: package.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   127
            ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   128
        ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   129
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   130
    "Created: / 15-12-2014 / 10:50:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
267
9f55d8893118 Fixes for Lint report - generate absolute filenames pointing to existing files
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 254
diff changeset
   131
    "Modified: / 16-12-2014 / 10:38:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   132
!
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   133
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   134
generatePackage: package
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   135
    self generateClassesInPackage:package.  
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   136
    self generateExtensionsInPackage:package.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   137
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   138
    "Created: / 15-12-2014 / 10:42:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
   141
generateViolations: aCollection class: aClass selector: aSelector source: sourceInfo
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
   142
    | method offset  |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   144
    (AbstractSourceCodeManager isVersionMethodSelector: aSelector) ifTrue:[ ^ self ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   145
    (AbstractSourceCodeManager isExtensionsVersionMethodSelector: aSelector) ifTrue:[ ^ self ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   146
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   147
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
   148
    method := aClass compiledMethodAt: aSelector.
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
   149
    offset := sourceInfo offsetOfMethod: method.
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
    aCollection do: [ :rule |
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   151
        | tree |
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   152
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   153
        tree := RBParser parseMethod: method source.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   154
        rule result selectionIntervalsForSource: method source tree: tree in: method mclass do:[:intervalOrNil | 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   155
            | interval start stop |
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   156
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   157
            interval := interval isNil ifTrue: [ 1 to: method source size ].
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   158
            start := sourceInfo lineAndColumnOfOffset: offset + interval first - 1.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   159
            stop  := sourceInfo lineAndColumnOfOffset: offset + interval last - 1.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   160
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   161
            format writeViolation: rule
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   162
                       class: aClass selector: aSelector
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   163
                   startLine: start x column: start y
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   164
                    stopLine: stop x  column: stop  y.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   165
        ]
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   166
    ]
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   167
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   168
    "Created: / 01-03-2013 / 18:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   169
    "Modified: / 15-12-2014 / 11:32:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   170
!
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   171
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   172
generateViolations: aCollection class: aClass source: sourceInfo
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   173
    | method offset start stop |
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   174
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   175
    start := sourceInfo lineAndColumnOfOffset: 1.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   176
    stop  := sourceInfo lineAndColumnOfOffset: SmallInteger maxVal.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   177
    aCollection do: [ :rule |
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   178
        | interval  |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
        format writeViolation: rule
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   181
                   class: aClass selector: nil
118
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
   182
               startLine: start x column: start y
7e93ef8c5417 Builder::LintReport refactoring - not yet finished!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 117
diff changeset
   183
                stopLine: stop x  column: stop  y.
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
    ]
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   186
    "Created: / 15-12-2014 / 11:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
!LintReport methodsFor:'initialization'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
setupForClasses: classes
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
    environment := BrowserEnvironment new forClasses: classes.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
    environment label: name
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
    "Created: / 04-08-2011 / 14:40:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   199
setupForPackages: pkgs
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   200
    pkgs isEmpty ifTrue:[^self].
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   201
    environment := PackageEnvironment 
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
                    onEnvironment: BrowserEnvironment new
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   203
                    packageNames: pkgs.
79
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
   204
    name isNil ifTrue:[
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   205
        pkgs size > 1 ifTrue:[
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   206
            name :=  pkgs size printString , ' packages'.
79
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
   207
        ] ifFalse:[
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   208
            name :=  pkgs anElement
79
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
   209
        ]
889d3747a0a8 Fix in default report file name for LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 71
diff changeset
   210
    ].
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
    environment label: name.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   213
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   214
    "
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   215
        LintReport runPackage:'stx:goodies/monticello'.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   216
        LintReport runPackage:'stx:libjava'
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   217
    "
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   218
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   219
    "Created: / 04-08-2011 / 14:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   220
    "Modified: / 15-12-2014 / 10:52:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   221
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   222
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   223
!LintReport methodsFor:'private'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   224
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   225
lineAndColumn: aString at: anInteger
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   226
	| line last stream |
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   227
	line := 1.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   228
	last := 0.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   229
	stream := aString readStream.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   230
	[ (stream nextLine isNil or: [ anInteger <= stream position ])
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   231
		ifTrue: [ ^ line @ (anInteger - last) ].
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   232
	last := stream position.
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   233
	line := line + 1 ]
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   234
		repeat
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   235
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   236
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   237
sourceFilenameForClass:class package: package 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   238
    | fn  cls |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   239
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   240
    cls := class theNonMetaclass.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   241
    fn := package copy
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   242
            replaceAll:$: with:$_;
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   243
            replaceAll:$/ with:$_;
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   244
            yourself.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   245
    fn := fn , '_' , (cls asString copyReplaceAll:$: with:$_) , '.' 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   246
            , cls programmingLanguage sourceFileSuffix.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   247
    ^ self encodeFilename:fn.
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   249
    "
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   250
        Builder::LintReportFormat::CheckStyle basicNew
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   251
            sourceFilenameFor: Class
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   252
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   253
        Builder::LintReportFormat::CheckStyle basicNew
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   254
            sourceFilenameFor: Builder::LintReportFormat"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   255
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   256
    "Created: / 15-12-2014 / 10:46:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   257
!
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   258
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   259
sourceFilenameForExtensionsInPackage: package 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   260
    | fn |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   261
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   262
    fn := package copy
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   263
            replaceAll:$: with:$_;
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   264
            replaceAll:$/ with:$_;
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   265
            yourself.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   266
    fn := fn , '_' , 'extensions.st'.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   267
    ^ self encodeFilename:fn.
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   268
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   269
    "
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   270
        Builder::LintReportFormat::CheckStyle basicNew
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   271
            sourceFilenameFor: Class
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   272
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   273
        Builder::LintReportFormat::CheckStyle basicNew
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   274
            sourceFilenameFor: Builder::LintReportFormat"
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   275
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   276
    "Created: / 15-12-2014 / 10:50:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   277
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   278
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   279
!LintReport methodsFor:'running'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   280
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   281
runReport
82
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   282
    | wasTryLocalSources |
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   283
82
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   284
    [
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   285
        wasTryLocalSources := Class tryLocalSourceFirst.
84
77e12dbe97d3 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 82
diff changeset
   286
        Class tryLocalSourceFirst: true.
82
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   287
        SmalllintChecker 
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   288
            runRule: (RBCompositeLintRule rules: rules)
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   289
            onEnvironment: environment.
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   290
        environment packageNames do:[:packageName | 
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   291
            self generatePackage: packageName  
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   292
        ].
82
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   293
    ] ensure:[
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   294
        Class tryLocalSourceFirst: wasTryLocalSources 
e676efa2a286 changed: #runReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 79
diff changeset
   295
    ]
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   296
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   297
    "Modified: / 15-12-2014 / 11:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   298
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   299
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
setUp
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   302
    super setUp.
117
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   303
    rules isNil ifTrue:[
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   304
        rules := RBBuiltinRuleSet rulesetBuiltinDefault flatten   
117
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   305
    ].
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   306
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   307
    "Created: / 04-08-2011 / 14:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
254
9272fef1d474 Fixes for Lint report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 233
diff changeset
   308
    "Modified: / 15-12-2014 / 11:35:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
117
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   309
!
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   310
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   311
setupRulesFrom: filename
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   312
    | file |    
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   313
    file := filename asFilename.
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   314
    file readingFileDo:[:s|
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   315
        | spec |
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   316
        spec := Parser parseLiteralArray: s.
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   317
        rules := spec decodeAsLiteralArray rules.
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   318
    ]
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   319
d7f87303b984 class: Builder::LintReport
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 84
diff changeset
   320
    "Created: / 28-02-2013 / 23:17:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   321
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   322
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   323
!LintReport methodsFor:'testing'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   324
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   325
isClassEnvironment: anEnvironment
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   326
	^ #(CategoryEnvironment ClassEnvironment VariableEnvironment) includes: anEnvironment class name
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   327
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   328
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   329
isSelectorEnvironment: anEnvironment
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   330
	^ #(SelectorEnvironment ParseTreeEnvironment VariableEnvironment) includes: anEnvironment class name
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   331
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   332
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   333
!LintReport class methodsFor:'documentation'!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   334
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   335
version
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   336
    ^ '$Header$'
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   337
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   338
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   339
version_CVS
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   340
    ^ '$Header$'
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   341
!
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   342
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   343
version_SVN
162
1dbab63ebbd5 Initial version of code coverage report.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 141
diff changeset
   344
    ^ '$Id$'
71
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   345
! !
1ed7c6cb2f68 initial checkin
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   346