adlint-postfilter 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +24 -0
- data/COPYING +674 -0
- data/ChangeLog +9 -0
- data/INSTALL +61 -0
- data/MANIFEST +20 -0
- data/NEWS +35 -0
- data/README +192 -0
- data/Rakefile +86 -0
- data/bin/adlint_flt +154 -0
- data/etc/conf.d/adlint_postfilter.yml +21 -0
- data/lib/adlint/postfilter/annotate.rb +143 -0
- data/lib/adlint/postfilter/command.rb +184 -0
- data/lib/adlint/postfilter/config.rb +266 -0
- data/lib/adlint/postfilter/content.rb +128 -0
- data/lib/adlint/postfilter/driver.rb +76 -0
- data/lib/adlint/postfilter/filter.rb +52 -0
- data/lib/adlint/postfilter/path.rb +68 -0
- data/lib/adlint/postfilter/suppress.rb +202 -0
- data/lib/adlint/postfilter/version.rb +73 -0
- data/lib/adlint/postfilter.rb +43 -0
- metadata +87 -0
@@ -0,0 +1,128 @@
|
|
1
|
+
# Filtering contents.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
require "csv"
|
34
|
+
require "pathname"
|
35
|
+
|
36
|
+
module AdLint #:nodoc:
|
37
|
+
module Postfilter #:nodoc:
|
38
|
+
|
39
|
+
class FilteringContent < Array
|
40
|
+
def overwrite!
|
41
|
+
subclass_responsibility
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class MessageFileContent < FilteringContent
|
46
|
+
def initialize(fpath)
|
47
|
+
@fpath = fpath
|
48
|
+
lines = File.read(fpath).lines.each_with_object([]) { |line, ary|
|
49
|
+
if line[0] == "V"
|
50
|
+
ary.push(OrdinaryLine.new(line.chomp))
|
51
|
+
else
|
52
|
+
ary.push(CsvMessageLine.new(line.chomp))
|
53
|
+
end
|
54
|
+
}
|
55
|
+
super(lines)
|
56
|
+
end
|
57
|
+
|
58
|
+
def overwrite!
|
59
|
+
File.open(@fpath, "w") { |io| io.puts self.compact }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class StderrContent < FilteringContent
|
64
|
+
def initialize(str)
|
65
|
+
lines = str.lines.each_with_object([]) { |line, ary|
|
66
|
+
if line =~ /:(?:warning|context):/
|
67
|
+
ary.push(PlainMessageLine.new(line.chomp))
|
68
|
+
else
|
69
|
+
ary.push(OrdinaryLine.new(line.chomp))
|
70
|
+
end
|
71
|
+
}
|
72
|
+
super(lines)
|
73
|
+
end
|
74
|
+
|
75
|
+
def overwrite!
|
76
|
+
$stderr.puts self.compact
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
class Line < String
|
81
|
+
def filterable?
|
82
|
+
subclass_responsibility
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class OrdinaryLine < Line
|
87
|
+
def filterable?
|
88
|
+
false
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
class MessageLine < Line
|
93
|
+
def initialize(str, fpath_str, line_no_str, message_id_str)
|
94
|
+
super(str)
|
95
|
+
|
96
|
+
@fpath = Pathname.new(fpath_str).realpath
|
97
|
+
@line_no = line_no_str ? line_no_str.to_i : nil
|
98
|
+
@message_id = message_id_str.to_sym
|
99
|
+
end
|
100
|
+
|
101
|
+
attr_reader :fpath
|
102
|
+
attr_reader :line_no
|
103
|
+
attr_reader :message_id
|
104
|
+
|
105
|
+
def filterable?
|
106
|
+
true
|
107
|
+
end
|
108
|
+
|
109
|
+
def match_with?(suppression)
|
110
|
+
suppression._match_with?(self)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
class CsvMessageLine < MessageLine
|
115
|
+
def initialize(str)
|
116
|
+
fields = CSV.parse(str).first
|
117
|
+
super(str, fields.fetch(1), fields.fetch(2), fields.fetch(4))
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
class PlainMessageLine < MessageLine
|
122
|
+
def initialize(str)
|
123
|
+
super(str, *str.scan(/\A(.*):(?:(\d*):\d*|):.*:(.*):/).first)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Filtering drivers.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
require "fileutils"
|
34
|
+
|
35
|
+
require "adlint/postfilter/command"
|
36
|
+
|
37
|
+
module AdLint #:nodoc:
|
38
|
+
|
39
|
+
module Postfilter
|
40
|
+
def install_config_template(config_fpath)
|
41
|
+
FileUtils.cp(File.expand_path("conf.d/adlint_postfilter.yml", $etcdir),
|
42
|
+
config_fpath)
|
43
|
+
end
|
44
|
+
module_function :install_config_template
|
45
|
+
|
46
|
+
def transform_makefile(makefile_fpath)
|
47
|
+
orig_fpath = makefile_fpath.add_ext(".orig")
|
48
|
+
FileUtils.mv(makefile_fpath, orig_fpath)
|
49
|
+
|
50
|
+
File.open(makefile_fpath, "w") do |dst_io|
|
51
|
+
dst_io.puts File.open(orig_fpath, "r") { |src_io|
|
52
|
+
src_io.each_line.map do |line|
|
53
|
+
case line
|
54
|
+
when /^(ADLINT =) (.*adlint)$/,
|
55
|
+
/^(ADLINT_SMA =) (.*adlint_sma)$/,
|
56
|
+
/^(ADLINT_CHK =) (.*adlint_chk)$/
|
57
|
+
"#{$1} adlint_flt -A #{$2}"
|
58
|
+
when /^(ADLINT_CMA =) (.*adlint_cma)$/
|
59
|
+
"#{$1} adlint_flt -V $(VPATH) -A #{$2}"
|
60
|
+
else
|
61
|
+
line.chomp
|
62
|
+
end
|
63
|
+
end
|
64
|
+
}
|
65
|
+
end
|
66
|
+
end
|
67
|
+
module_function :transform_makefile
|
68
|
+
|
69
|
+
def run(config_fpath, command_line, src_vpath)
|
70
|
+
command = AnalysisCommand.for(command_line, config_fpath, src_vpath)
|
71
|
+
command.execute.exitstatus
|
72
|
+
end
|
73
|
+
module_function :run
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Output filter.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
require "adlint/postfilter/content"
|
34
|
+
|
35
|
+
module AdLint #:nodoc:
|
36
|
+
module Postfilter #:nodoc:
|
37
|
+
|
38
|
+
class MessageFilter
|
39
|
+
def initialize(config)
|
40
|
+
@config = config
|
41
|
+
@target_content = MessageFileContent.new(@config.msg_fpath)
|
42
|
+
end
|
43
|
+
|
44
|
+
def execute(stderr_content)
|
45
|
+
@config.suppression_list.apply_to(@target_content)
|
46
|
+
@target_content.overwrite!
|
47
|
+
@config.suppression_list.apply_to(stderr_content)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Pathname creation utilities.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
require "pathname"
|
34
|
+
|
35
|
+
module AdLint #:nodoc:
|
36
|
+
module Postfilter #:nodoc:
|
37
|
+
|
38
|
+
module PathUtil
|
39
|
+
def i_fpath_of(src_fpath, strip_num, output_dpath = nil)
|
40
|
+
if output_dpath
|
41
|
+
output_dpath.join(src_fpath.strip(strip_num)).sub_ext(".i")
|
42
|
+
else
|
43
|
+
src_fpath.strip(strip_num).sub_ext(".i")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
module_function :i_fpath_of
|
47
|
+
|
48
|
+
def sma_msg_fpath_of(src_fpath, strip_num, output_dpath = nil)
|
49
|
+
if output_dpath
|
50
|
+
output_dpath.join(src_fpath.strip(strip_num)).add_ext(".msg.csv")
|
51
|
+
else
|
52
|
+
src_fpath.strip(strip_num).add_ext(".msg.csv")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
module_function :sma_msg_fpath_of
|
56
|
+
|
57
|
+
def cma_msg_fpath_of(project_name, output_dpath = nil)
|
58
|
+
if output_dpath
|
59
|
+
output_dpath.join(Pathname.new(project_name)).add_ext(".msg.csv")
|
60
|
+
else
|
61
|
+
Pathname.new(project_name).add_ext(".msg.csv")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
module_function :cma_msg_fpath_of
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,202 @@
|
|
1
|
+
# Message suppression.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
module AdLint #:nodoc:
|
34
|
+
module Postfilter #:nodoc:
|
35
|
+
|
36
|
+
class MessageSuppression
|
37
|
+
def _match_with?(message_line)
|
38
|
+
subclass_responsibility
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class AdLintInitialHeaderSuppression < MessageSuppression
|
43
|
+
def initialize(cinit_fpath, pinit_fpath)
|
44
|
+
@cinit_fpath = cinit_fpath
|
45
|
+
@pinit_fpath = pinit_fpath
|
46
|
+
end
|
47
|
+
|
48
|
+
def _match_with?(message_line)
|
49
|
+
message_line.fpath == @cinit_fpath || message_line.fpath == @pinit_fpath
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class PlatformHeaderSuppression < MessageSuppression
|
54
|
+
def initialize(project_root_dpath)
|
55
|
+
@project_root_dpath = project_root_dpath.realpath
|
56
|
+
end
|
57
|
+
|
58
|
+
def _match_with?(message_line)
|
59
|
+
!message_line.fpath.to_s.start_with?(@project_root_dpath.to_s)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class MessageWiseSuppression < MessageSuppression
|
64
|
+
def initialize(message_id)
|
65
|
+
@message_id = message_id
|
66
|
+
end
|
67
|
+
|
68
|
+
attr_reader :message_id
|
69
|
+
|
70
|
+
def _match_with?(message_line)
|
71
|
+
message_line.message_id == @message_id
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class ProjectWideSuppression < MessageWiseSuppression; end
|
76
|
+
|
77
|
+
module Deactivatable
|
78
|
+
attr_writer :active
|
79
|
+
|
80
|
+
def active?
|
81
|
+
@active
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class FileWiseSuppression < MessageWiseSuppression
|
86
|
+
include Deactivatable
|
87
|
+
|
88
|
+
def initialize(message_id, fpath, active)
|
89
|
+
super(message_id)
|
90
|
+
@fpath = fpath
|
91
|
+
self.active = active
|
92
|
+
end
|
93
|
+
|
94
|
+
attr_reader :fpath
|
95
|
+
|
96
|
+
def _match_with?(message_line)
|
97
|
+
if self.active?
|
98
|
+
super && message_line.fpath == @fpath
|
99
|
+
else
|
100
|
+
false
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class LineWiseSuppression < MessageWiseSuppression
|
106
|
+
include Deactivatable
|
107
|
+
|
108
|
+
def initialize(message_id, fpath, line_no, active)
|
109
|
+
super(message_id)
|
110
|
+
@fpath, @line_no = fpath, line_no
|
111
|
+
self.active = active
|
112
|
+
end
|
113
|
+
|
114
|
+
attr_reader :fpath
|
115
|
+
attr_reader :line_no
|
116
|
+
|
117
|
+
def _match_with?(message_line)
|
118
|
+
if self.active?
|
119
|
+
super &&
|
120
|
+
message_line.fpath == @fpath && message_line.line_no == @line_no
|
121
|
+
else
|
122
|
+
false
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
class MessageSuppressionList
|
128
|
+
def initialize(initial_header_suppression, platform_header_suppression,
|
129
|
+
project_wide_suppressions,
|
130
|
+
tunit_wide_suppressions, line_wise_suppressions)
|
131
|
+
@initial_header_suppression = initial_header_suppression
|
132
|
+
@platform_header_suppression = platform_header_suppression
|
133
|
+
@p_index = create_p_index(project_wide_suppressions)
|
134
|
+
@t_index = create_t_index(tunit_wide_suppressions)
|
135
|
+
@l_index = create_l_index(line_wise_suppressions)
|
136
|
+
end
|
137
|
+
|
138
|
+
def apply_to(content)
|
139
|
+
content.each_with_index do |line, index|
|
140
|
+
if line.filterable?
|
141
|
+
supps = suppressions_for(line.message_id, line.fpath, line.line_no)
|
142
|
+
if supps.any? { |supp| line.match_with?(supp) }
|
143
|
+
content[index] = nil
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
private
|
150
|
+
def suppressions_for(message_id, fpath, line_no)
|
151
|
+
p_hash = select_project_wide_suppressions(message_id)
|
152
|
+
t_hash = select_tunit_wide_suppressions(message_id, fpath)
|
153
|
+
l_hash = select_line_wise_suppressions(message_id, fpath, line_no)
|
154
|
+
[@initial_header_suppression, @platform_header_suppression] +
|
155
|
+
p_hash.merge(t_hash).merge(l_hash).values
|
156
|
+
end
|
157
|
+
|
158
|
+
def select_project_wide_suppressions(message_id)
|
159
|
+
(supp = @p_index[message_id]) ? {message_id => supp} : {}
|
160
|
+
end
|
161
|
+
|
162
|
+
def select_tunit_wide_suppressions(message_id, fpath)
|
163
|
+
(supp = @t_index[message_id][fpath]) ? {message_id => supp} : {}
|
164
|
+
end
|
165
|
+
|
166
|
+
def select_line_wise_suppressions(message_id, fpath, line_no)
|
167
|
+
@l_index[message_id][fpath].each_with_object({}) do |supp, result|
|
168
|
+
if supp.line_no == line_no
|
169
|
+
result[supp.message_id] = supp
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def create_p_index(suppressions)
|
175
|
+
suppressions.each_with_object({}) do |supp, index|
|
176
|
+
index[supp.message_id] = supp
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def create_t_index(suppressions)
|
181
|
+
index = Hash.new { |mesg_id_hash, mesg_id| mesg_id_hash[mesg_id] = {} }
|
182
|
+
suppressions.each do |supp|
|
183
|
+
index[supp.message_id][supp.fpath] = supp
|
184
|
+
end
|
185
|
+
index
|
186
|
+
end
|
187
|
+
|
188
|
+
def create_l_index(suppressions)
|
189
|
+
index = Hash.new { |mesg_id_hash, mesg_id|
|
190
|
+
mesg_id_hash[mesg_id] = Hash.new { |fpath_hash, fpath|
|
191
|
+
fpath_hash[fpath] = []
|
192
|
+
}
|
193
|
+
}
|
194
|
+
suppressions.each do |supp|
|
195
|
+
index[supp.message_id][supp.fpath].push(supp)
|
196
|
+
end
|
197
|
+
index
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Version information.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
module AdLint #:nodoc:
|
34
|
+
module Postfilter #:nodoc:
|
35
|
+
|
36
|
+
MAJOR_VERSION = 0
|
37
|
+
MINOR_VERSION = 9
|
38
|
+
PATCH_VERSION = 1
|
39
|
+
RELEASE_DATE = "2012-04-17"
|
40
|
+
|
41
|
+
SHORT_VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}.#{PATCH_VERSION}"
|
42
|
+
|
43
|
+
VERSION = "#{SHORT_VERSION} (#{RELEASE_DATE})"
|
44
|
+
|
45
|
+
COPYRIGHT = <<EOS
|
46
|
+
___ ____ __ ___ _________
|
47
|
+
/ | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
48
|
+
/ /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
49
|
+
/ __ |/ /_/ / /___/ / /| / / /
|
50
|
+
/_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
51
|
+
|
52
|
+
adlint-postfilter is free software: you can redistribute it and/or modify it
|
53
|
+
under the terms of the GNU General Public License as published by the Free
|
54
|
+
Software Foundation, either version 3 of the License, or (at your option) any
|
55
|
+
later version.
|
56
|
+
|
57
|
+
adlint-postfilter is distributed in the hope that it will be useful, but
|
58
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
59
|
+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
60
|
+
details.
|
61
|
+
|
62
|
+
You should have received a copy of the GNU General Public License along with
|
63
|
+
adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
64
|
+
|
65
|
+
EOS
|
66
|
+
|
67
|
+
AUTHOR = <<EOS
|
68
|
+
Written by Yutaka Yanoh and OGIS-RI Co.,Ltd.
|
69
|
+
|
70
|
+
EOS
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# adlint-postfilter package loader.
|
2
|
+
#
|
3
|
+
# Author:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
4
|
+
# Copyright:: Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
5
|
+
# License:: GPLv3+: GNU General Public License version 3 or later
|
6
|
+
#
|
7
|
+
# Owner:: Yutaka Yanoh <mailto:yanoh@users.sourceforge.net>
|
8
|
+
|
9
|
+
#--
|
10
|
+
# ___ ____ __ ___ _________
|
11
|
+
# / | / _ |/ / / / | / /__ __/ Source Code Static Analyzer
|
12
|
+
# / /| | / / / / / / / |/ / / / AdLint - Advanced Lint
|
13
|
+
# / __ |/ /_/ / /___/ / /| / / /
|
14
|
+
# /_/ |_|_____/_____/_/_/ |_/ /_/ Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
|
15
|
+
#
|
16
|
+
# This file is part of adlint-postfilter.
|
17
|
+
#
|
18
|
+
# adlint-postfilter is free software: you can redistribute it and/or modify it
|
19
|
+
# under the terms of the GNU General Public License as published by the Free
|
20
|
+
# Software Foundation, either version 3 of the License, or (at your option) any
|
21
|
+
# later version.
|
22
|
+
#
|
23
|
+
# adlint-postfilter is distributed in the hope that it will be useful, but
|
24
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
25
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
26
|
+
# more details.
|
27
|
+
#
|
28
|
+
# You should have received a copy of the GNU General Public License along with
|
29
|
+
# adlint-postfilter. If not, see <http://www.gnu.org/licenses/>.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
require "adlint"
|
34
|
+
|
35
|
+
require "adlint/postfilter/annotate"
|
36
|
+
require "adlint/postfilter/command"
|
37
|
+
require "adlint/postfilter/config"
|
38
|
+
require "adlint/postfilter/content"
|
39
|
+
require "adlint/postfilter/driver"
|
40
|
+
require "adlint/postfilter/filter"
|
41
|
+
require "adlint/postfilter/path"
|
42
|
+
require "adlint/postfilter/suppress"
|
43
|
+
require "adlint/postfilter/version"
|