adlint 2.6.12 → 2.6.14
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +77 -0
- data/NEWS +17 -4
- data/bin/adlint +24 -30
- data/bin/adlint_chk +22 -28
- data/bin/adlint_cma +20 -26
- data/bin/adlint_sma +22 -28
- data/bin/adlintize +60 -58
- data/etc/mesg.d/c_builtin/en_US/messages.yml +168 -168
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +168 -168
- data/etc/mesg.d/core/en_US/messages.yml +1 -1
- data/etc/mesg.d/core/ja_JP/messages.yml +1 -1
- data/features/code_check/W0119.feature +0 -5
- data/features/code_check/W0120.feature +1 -0
- data/features/code_check/W0121.feature +0 -5
- data/features/code_check/W0123.feature +0 -5
- data/features/code_check/W0125.feature +0 -5
- data/features/code_check/W0127.feature +0 -5
- data/features/code_check/W0128.feature +0 -5
- data/features/code_check/W0129.feature +0 -5
- data/features/code_check/W0130.feature +0 -5
- data/features/code_check/W0132.feature +1 -0
- data/features/code_check/W0133.feature +0 -5
- data/features/code_check/W0134.feature +0 -5
- data/features/code_check/W0135.feature +0 -5
- data/features/code_check/W0136.feature +0 -5
- data/features/code_check/W0137.feature +0 -5
- data/features/code_check/W0138.feature +0 -5
- data/features/code_check/W0139.feature +0 -5
- data/features/code_check/W0140.feature +0 -5
- data/features/code_check/W0141.feature +0 -5
- data/features/code_check/W0142.feature +0 -5
- data/features/code_check/W0157.feature +0 -5
- data/features/code_check/W0161.feature +0 -5
- data/features/code_check/W0165.feature +0 -5
- data/features/code_check/W0169.feature +0 -5
- data/features/code_check/W0177.feature +0 -5
- data/features/code_check/W0182.feature +0 -5
- data/features/code_check/W0183.feature +0 -5
- data/features/code_check/W0184.feature +0 -5
- data/features/code_check/W0212.feature +0 -5
- data/features/code_check/W0214.feature +0 -5
- data/features/code_check/W0221.feature +0 -5
- data/features/code_check/W0223.feature +0 -5
- data/features/code_check/W0230.feature +0 -5
- data/features/code_check/W0232.feature +0 -5
- data/features/code_check/W0245.feature +0 -5
- data/features/code_check/W0246.feature +0 -5
- data/features/code_check/W0247.feature +0 -5
- data/features/code_check/W0251.feature +0 -5
- data/features/code_check/W0650.feature +0 -4
- data/features/code_check/W0703.feature +5 -1
- data/features/code_check/W0719.feature +0 -10
- data/features/code_check/W0748.feature +0 -5
- data/features/code_check/W0751.feature +0 -5
- data/features/code_check/W0756.feature +0 -5
- data/features/code_check/W0763.feature +0 -5
- data/features/code_check/W0787.feature +7 -0
- data/features/code_check/W0794.feature +0 -1
- data/features/code_check/W1052.feature +0 -2
- data/features/support/env.rb +2 -7
- data/lib/adlint/c/syntax.rb +10 -16
- data/lib/adlint/cpp/macro.rb +96 -0
- data/lib/adlint/exam/c_builtin/c_check.rb +954 -817
- data/lib/adlint/exam/c_builtin/c_check_shima.rb +17 -19
- data/lib/adlint/exam/c_builtin/ld_check.rb +86 -44
- data/lib/adlint/message.rb +1 -1
- data/lib/adlint/util.rb +8 -8
- data/lib/adlint/version.rb +2 -2
- data/lib/adlint.rb +8 -0
- data/share/doc/developers_guide_ja.html +3 -3
- data/share/doc/developers_guide_ja.texi +1 -1
- data/share/doc/users_guide_en.html +5055 -5053
- data/share/doc/users_guide_en.texi +3817 -3818
- data/share/doc/users_guide_ja.html +3787 -3786
- data/share/doc/users_guide_ja.texi +3784 -3783
- data/spec/spec_helper.rb +3 -11
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -1,3 +1,80 @@
|
|
1
|
+
Mon Dec 17 15:14:46 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
|
+
|
3
|
+
* release.ga : 2.6.14
|
4
|
+
- Revise specification of code checks about implicit conversion from
|
5
|
+
or to `char' type to clarify warning's intention.
|
6
|
+
- Improve the library interface to easily integrate AdLint with other
|
7
|
+
products.
|
8
|
+
- Support lint and AdLint specific predefined macros;
|
9
|
+
`__LINT__', `lint', `__lint', `__lint__', `__ADLINT__', `adlint',
|
10
|
+
`__adlint' and `__adlint__'.
|
11
|
+
- Revise code checks' output specification of W0051, W0052, W0491,
|
12
|
+
W0492, W0703, W0704, W0770, W0771, W0787, W0788, W0789, W0790 and
|
13
|
+
W1037 to add context messages telling where is the problematic pair
|
14
|
+
identifiers.
|
15
|
+
|
16
|
+
Fri Dec 14 15:22:10 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
17
|
+
|
18
|
+
* release.rc : 2.6.13
|
19
|
+
- Revise specification of code checks about implicit conversion from
|
20
|
+
or to `char' type to clarify warning's intention.
|
21
|
+
- Improve the library interface to easily integrate AdLint with other
|
22
|
+
products.
|
23
|
+
- Support lint and AdLint specific predefined macros;
|
24
|
+
`__LINT__', `lint', `__lint', `__lint__', `__ADLINT__', `adlint',
|
25
|
+
`__adlint' and `__adlint__'.
|
26
|
+
- Revise code checks' output specification of W0051, W0052, W0491,
|
27
|
+
W0492, W0703, W0704, W0770, W0771, W0787, W0788, W0789, W0790 and
|
28
|
+
W1037 to add context messages telling where is the problematic pair
|
29
|
+
identifiers.
|
30
|
+
|
31
|
+
Thu Dec 13 15:33:33 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
32
|
+
|
33
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Revise code checks' output
|
34
|
+
specification of W0051, W0052, W0491, W0492, W0703, W0704, W0771,
|
35
|
+
W0787, W0788, W0789 and W0790 to add context messages telling where
|
36
|
+
is the problematic pair identifiers.
|
37
|
+
|
38
|
+
* lib/adlint/exam/c_builtin/ld_check.rb : Revise code checks' output
|
39
|
+
specification of W0770, W0791 and W1037 to add context message
|
40
|
+
telling where is the problematic pair identifiers.
|
41
|
+
|
42
|
+
* share/doc/users_guide_ja.texi : Update descriptions about revised
|
43
|
+
W0051, W0052, W0491, W0492, W0703, W0704, W0770, W0771, W0787, W0788,
|
44
|
+
W0789, W0790, W0791 and W1037 messages.
|
45
|
+
* share/doc/users_guide_en.texi : Ditto.
|
46
|
+
|
47
|
+
Tue Dec 11 17:55:27 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
48
|
+
|
49
|
+
* lib/adlint/cpp/macro.rb : Support lint and AdLint specific predefined
|
50
|
+
macros;
|
51
|
+
`__LINT__', `lint', `__lint', `__lint__', `__ADLINT__', `adlint',
|
52
|
+
`__adlint' and `__adlint__'.
|
53
|
+
|
54
|
+
Tue Dec 11 17:18:35 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
55
|
+
|
56
|
+
* lib/adlint.rb : Improve the library interface to easily integrate
|
57
|
+
AdLint with other products.
|
58
|
+
* lib/adlint/message.rb : Ditto.
|
59
|
+
* bin/adlintize : Ditto.
|
60
|
+
* bin/adlint : Ditto.
|
61
|
+
* bin/adlint_sma : Ditto.
|
62
|
+
* bin/adlint_cma : Ditto.
|
63
|
+
* bin/adlint_chk : Ditto.
|
64
|
+
* spec/spec_helper.rb : Ditto.
|
65
|
+
* features/support/env.rb : Ditto.
|
66
|
+
|
67
|
+
Thu Dec 6 16:21:42 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
68
|
+
|
69
|
+
* lib/adlint/exam/c_builtin/c_check.rb : Revise specification of code
|
70
|
+
checks about implicit conversion from or to `char' type to clarify
|
71
|
+
warning's intention.
|
72
|
+
* lib/adlint/exam/c_builtin/c_check_shima.rb : Ditto.
|
73
|
+
|
74
|
+
* etc/mesg.d/c_builtin/ja_JP/messages.yml : Clarify warning message
|
75
|
+
texts of the implicit conversion.
|
76
|
+
* etc/mesg.d/c_builtin/en_US/messages.yml : Ditto.
|
77
|
+
|
1
78
|
Thu Nov 29 15:49:50 2012 Yutaka Yanoh <yanoh@users.sourceforge.net>
|
2
79
|
|
3
80
|
* release.ga : 2.6.12
|
data/NEWS
CHANGED
@@ -21,17 +21,30 @@
|
|
21
21
|
|
22
22
|
++
|
23
23
|
|
24
|
-
=== \AdLint 2.6.
|
24
|
+
=== \AdLint 2.6.14 is released (2012-12-17)
|
25
25
|
|
26
|
-
==== Changes since the 2.6.
|
26
|
+
==== Changes since the 2.6.12 release
|
27
27
|
|
28
|
-
*
|
29
|
-
|
28
|
+
* Revise specification of code checks about implicit conversion from or to
|
29
|
+
`char' type to clarify warning's intention
|
30
|
+
* Improve the library interface to easily integrate AdLint with other products
|
31
|
+
* Support lint and AdLint specific predefined macros; `__LINT__', `lint',
|
32
|
+
`__lint', `__lint__', `__ADLINT__', `adlint', `__adlint' and `__adlint__'
|
33
|
+
* Revise code checks' output specification of W0051, W0052, W0491, W0492,
|
34
|
+
W0703, W0704, W0770, W0771, W0787, W0788, W0789, W0790 and W1037 to add
|
35
|
+
context messages telling where is the problematic pair identifiers
|
30
36
|
|
31
37
|
See the file
|
32
38
|
{ChangeLog}[http://adlint.sourceforge.net/pmwiki/upload.d/Main/ChangeLog]
|
33
39
|
for more details.
|
34
40
|
|
41
|
+
=== \AdLint 2.6.12 is released (2012-11-29)
|
42
|
+
|
43
|
+
==== Changes since the 2.6.10 release
|
44
|
+
|
45
|
+
* Fix abend problem of huge integer-constant evaluation
|
46
|
+
* Correct to run on Ruby 2.0.0dev (r37962) without warnings
|
47
|
+
|
35
48
|
=== \AdLint 2.6.10 is released (2012-11-08)
|
36
49
|
|
37
50
|
==== Changes since the 2.6.2 release
|
data/bin/adlint
CHANGED
@@ -31,23 +31,15 @@
|
|
31
31
|
#
|
32
32
|
#++
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
$bindir = Pathname.new(__FILE__).realpath.dirname
|
37
|
-
$prefix = Pathname.new("..").expand_path($bindir)
|
38
|
-
$libdir = Pathname.new("lib").expand_path($prefix)
|
39
|
-
$etcdir = Pathname.new("etc").expand_path($prefix)
|
34
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
|
35
|
+
require "adlint"
|
40
36
|
|
41
37
|
$stdout.set_encoding(Encoding.default_external)
|
42
38
|
$stderr.set_encoding(Encoding.default_external)
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
require "adlint"
|
47
|
-
|
48
|
-
$version = "AdLint all in one analyzer #{AdLint::VERSION}"
|
40
|
+
version = "AdLint all in one analyzer #{AdLint::VERSION}"
|
49
41
|
|
50
|
-
|
42
|
+
usage = <<EOS
|
51
43
|
Usage: adlint [options] [source-file...]
|
52
44
|
Options:
|
53
45
|
-t FILE, --traits FILE Use FILE as traits file (mandatory)
|
@@ -65,22 +57,24 @@ EOS
|
|
65
57
|
|
66
58
|
require "getoptlong"
|
67
59
|
|
68
|
-
parser = GetoptLong.new(
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
60
|
+
parser = GetoptLong.new(
|
61
|
+
["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
|
62
|
+
["--list-file", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
63
|
+
["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
64
|
+
["--strip", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
65
|
+
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
66
|
+
["--version", GetoptLong::NO_ARGUMENT],
|
67
|
+
["--copyright", GetoptLong::NO_ARGUMENT],
|
68
|
+
["--prefix", GetoptLong::NO_ARGUMENT],
|
69
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
70
|
+
)
|
77
71
|
|
78
72
|
begin
|
79
73
|
traits_fpath = nil
|
80
|
-
list_fpath
|
74
|
+
list_fpath = nil
|
81
75
|
output_dpath = nil
|
82
|
-
strip_num
|
83
|
-
verbose
|
76
|
+
strip_num = 0
|
77
|
+
verbose = false
|
84
78
|
|
85
79
|
parser.each do |option, value|
|
86
80
|
case option
|
@@ -95,21 +89,21 @@ begin
|
|
95
89
|
when "--verbose"
|
96
90
|
verbose = true
|
97
91
|
when "--version"
|
98
|
-
puts
|
92
|
+
puts version, AdLint::AUTHOR
|
99
93
|
exit 0
|
100
94
|
when "--copyright"
|
101
95
|
puts AdLint::COPYRIGHT
|
102
96
|
exit 0
|
103
97
|
when "--prefix"
|
104
|
-
puts
|
98
|
+
puts AdLint::Config[:prefix]
|
105
99
|
exit 0
|
106
100
|
when "--help"
|
107
|
-
puts
|
101
|
+
puts usage
|
108
102
|
exit 0
|
109
103
|
end
|
110
104
|
end
|
111
105
|
rescue
|
112
|
-
$stderr.puts
|
106
|
+
$stderr.puts usage
|
113
107
|
exit 1
|
114
108
|
end
|
115
109
|
|
@@ -121,13 +115,13 @@ end
|
|
121
115
|
|
122
116
|
if fpaths.empty?
|
123
117
|
$stderr.puts "#{File.basename(__FILE__)}: no input files"
|
124
|
-
$stderr.puts
|
118
|
+
$stderr.puts usage
|
125
119
|
exit 1
|
126
120
|
end
|
127
121
|
|
128
122
|
unless traits_fpath
|
129
123
|
$stderr.puts "#{File.basename(__FILE__)}: no traits file"
|
130
|
-
$stderr.puts
|
124
|
+
$stderr.puts usage
|
131
125
|
exit 1
|
132
126
|
end
|
133
127
|
|
data/bin/adlint_chk
CHANGED
@@ -31,23 +31,15 @@
|
|
31
31
|
#
|
32
32
|
#++
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
$bindir = Pathname.new(__FILE__).realpath.dirname
|
37
|
-
$prefix = Pathname.new("..").expand_path($bindir)
|
38
|
-
$libdir = Pathname.new("lib").expand_path($prefix)
|
39
|
-
$etcdir = Pathname.new("etc").expand_path($prefix)
|
34
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
|
35
|
+
require "adlint"
|
40
36
|
|
41
37
|
$stdout.set_encoding(Encoding.default_external)
|
42
38
|
$stderr.set_encoding(Encoding.default_external)
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
require "adlint"
|
47
|
-
|
48
|
-
$version = "AdLint configuration validator #{AdLint::VERSION}"
|
40
|
+
version = "AdLint configuration validator #{AdLint::VERSION}"
|
49
41
|
|
50
|
-
|
42
|
+
usage = <<EOS
|
51
43
|
Usage: adlint_chk [options] source-file...
|
52
44
|
Options:
|
53
45
|
-t FILE, --traits FILE Use FILE as traits file (mandatory)
|
@@ -64,20 +56,22 @@ EOS
|
|
64
56
|
|
65
57
|
require "getoptlong"
|
66
58
|
|
67
|
-
parser = GetoptLong.new(
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
59
|
+
parser = GetoptLong.new(
|
60
|
+
["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
|
61
|
+
["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
62
|
+
["--strip", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
63
|
+
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
64
|
+
["--version", GetoptLong::NO_ARGUMENT],
|
65
|
+
["--copyright", GetoptLong::NO_ARGUMENT],
|
66
|
+
["--prefix", GetoptLong::NO_ARGUMENT],
|
67
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
68
|
+
)
|
75
69
|
|
76
70
|
begin
|
77
71
|
traits_fpath = nil
|
78
72
|
output_dpath = nil
|
79
|
-
strip_num
|
80
|
-
verbose
|
73
|
+
strip_num = 0
|
74
|
+
verbose = false
|
81
75
|
|
82
76
|
parser.each_option do |option, value|
|
83
77
|
case option
|
@@ -90,21 +84,21 @@ begin
|
|
90
84
|
when "--verbose"
|
91
85
|
verbose = true
|
92
86
|
when "--version"
|
93
|
-
puts
|
87
|
+
puts version, AdLint::AUTHOR
|
94
88
|
exit 0
|
95
89
|
when "--copyright"
|
96
90
|
puts AdLint::COPYRIGHT
|
97
91
|
exit 0
|
98
92
|
when "--prefix"
|
99
|
-
puts
|
93
|
+
puts AdLint::Config[:prefix]
|
100
94
|
exit 0
|
101
95
|
when "--help"
|
102
|
-
puts
|
96
|
+
puts usage
|
103
97
|
exit 0
|
104
98
|
end
|
105
99
|
end
|
106
100
|
rescue
|
107
|
-
$stderr.puts
|
101
|
+
$stderr.puts usage
|
108
102
|
exit 1
|
109
103
|
end
|
110
104
|
|
@@ -112,13 +106,13 @@ fpaths = ARGV.map { |str| Pathname.new(str) }
|
|
112
106
|
|
113
107
|
if fpaths.empty?
|
114
108
|
$stderr.puts "#{File.basename(__FILE__)}: no input files"
|
115
|
-
$stderr.puts
|
109
|
+
$stderr.puts usage
|
116
110
|
exit 1
|
117
111
|
end
|
118
112
|
|
119
113
|
unless traits_fpath
|
120
114
|
$stderr.puts "#{File.basename(__FILE__)}: no traits file"
|
121
|
-
$stderr.puts
|
115
|
+
$stderr.puts usage
|
122
116
|
exit 1
|
123
117
|
end
|
124
118
|
|
data/bin/adlint_cma
CHANGED
@@ -31,23 +31,15 @@
|
|
31
31
|
#
|
32
32
|
#++
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
$bindir = Pathname.new(__FILE__).realpath.dirname
|
37
|
-
$prefix = Pathname.new("..").expand_path($bindir)
|
38
|
-
$libdir = Pathname.new("lib").expand_path($prefix)
|
39
|
-
$etcdir = Pathname.new("etc").expand_path($prefix)
|
34
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
|
35
|
+
require "adlint"
|
40
36
|
|
41
37
|
$stdout.set_encoding(Encoding.default_external)
|
42
38
|
$stderr.set_encoding(Encoding.default_external)
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
require "adlint"
|
47
|
-
|
48
|
-
$version = "AdLint cross module analyzer #{AdLint::VERSION}"
|
40
|
+
version = "AdLint cross module analyzer #{AdLint::VERSION}"
|
49
41
|
|
50
|
-
|
42
|
+
usage = <<EOS
|
51
43
|
Usage: adlint_cma [options] sma-metric-file...
|
52
44
|
Options:
|
53
45
|
-t FILE, --traits FILE Use FILE as traits file (mandatory)
|
@@ -61,18 +53,20 @@ EOS
|
|
61
53
|
|
62
54
|
require "getoptlong"
|
63
55
|
|
64
|
-
parser = GetoptLong.new(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
56
|
+
parser = GetoptLong.new(
|
57
|
+
["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
|
58
|
+
["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
59
|
+
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
60
|
+
["--version", GetoptLong::NO_ARGUMENT],
|
61
|
+
["--copyright", GetoptLong::NO_ARGUMENT],
|
62
|
+
["--prefix", GetoptLong::NO_ARGUMENT],
|
63
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
64
|
+
)
|
71
65
|
|
72
66
|
begin
|
73
67
|
traits_fpath = nil
|
74
68
|
output_dpath = nil
|
75
|
-
verbose
|
69
|
+
verbose = false
|
76
70
|
|
77
71
|
parser.each_option do |option, value|
|
78
72
|
case option
|
@@ -83,21 +77,21 @@ begin
|
|
83
77
|
when "--verbose"
|
84
78
|
verbose = true
|
85
79
|
when "--version"
|
86
|
-
puts
|
80
|
+
puts version, AdLint::AUTHOR
|
87
81
|
exit 0
|
88
82
|
when "--copyright"
|
89
83
|
puts AdLint::COPYRIGHT
|
90
84
|
exit 0
|
91
85
|
when "--prefix"
|
92
|
-
puts
|
86
|
+
puts AdLint::Config[:prefix]
|
93
87
|
exit 0
|
94
88
|
when "--help"
|
95
|
-
puts
|
89
|
+
puts usage
|
96
90
|
exit 0
|
97
91
|
end
|
98
92
|
end
|
99
93
|
rescue
|
100
|
-
$stderr.puts
|
94
|
+
$stderr.puts usage
|
101
95
|
exit 1
|
102
96
|
end
|
103
97
|
|
@@ -105,13 +99,13 @@ fpaths = ARGV.map { |str| Pathname.new(str) }
|
|
105
99
|
|
106
100
|
if fpaths.empty?
|
107
101
|
$stderr.puts "#{File.basename(__FILE__)}: no input files"
|
108
|
-
$stderr.puts
|
102
|
+
$stderr.puts usage
|
109
103
|
exit 1
|
110
104
|
end
|
111
105
|
|
112
106
|
unless traits_fpath
|
113
107
|
$stderr.puts "#{File.basename(__FILE__)}: no traits file"
|
114
|
-
$stderr.puts
|
108
|
+
$stderr.puts usage
|
115
109
|
exit 1
|
116
110
|
end
|
117
111
|
|
data/bin/adlint_sma
CHANGED
@@ -31,23 +31,15 @@
|
|
31
31
|
#
|
32
32
|
#++
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
$bindir = Pathname.new(__FILE__).realpath.dirname
|
37
|
-
$prefix = Pathname.new("..").expand_path($bindir)
|
38
|
-
$libdir = Pathname.new("lib").expand_path($prefix)
|
39
|
-
$etcdir = Pathname.new("etc").expand_path($prefix)
|
34
|
+
$LOAD_PATH.unshift(File.expand_path("../lib", File.dirname(__FILE__)))
|
35
|
+
require "adlint"
|
40
36
|
|
41
37
|
$stdout.set_encoding(Encoding.default_external)
|
42
38
|
$stderr.set_encoding(Encoding.default_external)
|
43
39
|
|
44
|
-
|
45
|
-
|
46
|
-
require "adlint"
|
47
|
-
|
48
|
-
$version = "AdLint single module analyzer #{AdLint::VERSION}"
|
40
|
+
version = "AdLint single module analyzer #{AdLint::VERSION}"
|
49
41
|
|
50
|
-
|
42
|
+
usage = <<EOS
|
51
43
|
Usage: adlint_sma [options] source-file...
|
52
44
|
Options:
|
53
45
|
-t FILE, --traits FILE Use FILE as traits file (mandatory)
|
@@ -64,20 +56,22 @@ EOS
|
|
64
56
|
|
65
57
|
require "getoptlong"
|
66
58
|
|
67
|
-
parser = GetoptLong.new(
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
59
|
+
parser = GetoptLong.new(
|
60
|
+
["--traits", "-t", GetoptLong::REQUIRED_ARGUMENT],
|
61
|
+
["--output-dir", "-o", GetoptLong::REQUIRED_ARGUMENT],
|
62
|
+
["--strip", "-p", GetoptLong::REQUIRED_ARGUMENT],
|
63
|
+
["--verbose", "-v", GetoptLong::NO_ARGUMENT],
|
64
|
+
["--version", GetoptLong::NO_ARGUMENT],
|
65
|
+
["--copyright", GetoptLong::NO_ARGUMENT],
|
66
|
+
["--prefix", GetoptLong::NO_ARGUMENT],
|
67
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT]
|
68
|
+
)
|
75
69
|
|
76
70
|
begin
|
77
71
|
traits_fpath = nil
|
78
72
|
output_dpath = nil
|
79
|
-
strip_num
|
80
|
-
verbose
|
73
|
+
strip_num = 0
|
74
|
+
verbose = false
|
81
75
|
|
82
76
|
parser.each_option do |option, value|
|
83
77
|
case option
|
@@ -90,21 +84,21 @@ begin
|
|
90
84
|
when "--verbose"
|
91
85
|
verbose = true
|
92
86
|
when "--version"
|
93
|
-
puts
|
87
|
+
puts version, AdLint::AUTHOR
|
94
88
|
exit 0
|
95
89
|
when "--copyright"
|
96
90
|
puts AdLint::COPYRIGHT
|
97
91
|
exit 0
|
98
92
|
when "--prefix"
|
99
|
-
puts
|
93
|
+
puts AdLint::Config[:prefix]
|
100
94
|
exit 0
|
101
95
|
when "--help"
|
102
|
-
puts
|
96
|
+
puts usage
|
103
97
|
exit 0
|
104
98
|
end
|
105
99
|
end
|
106
100
|
rescue
|
107
|
-
$stderr.puts
|
101
|
+
$stderr.puts usage
|
108
102
|
exit 1
|
109
103
|
end
|
110
104
|
|
@@ -112,13 +106,13 @@ fpaths = ARGV.map { |str| Pathname.new(str) }
|
|
112
106
|
|
113
107
|
if fpaths.empty?
|
114
108
|
$stderr.puts "#{File.basename(__FILE__)}: no input files"
|
115
|
-
$stderr.puts
|
109
|
+
$stderr.puts usage
|
116
110
|
exit 1
|
117
111
|
end
|
118
112
|
|
119
113
|
unless traits_fpath
|
120
114
|
$stderr.puts "#{File.basename(__FILE__)}: no traits file"
|
121
|
-
$stderr.puts
|
115
|
+
$stderr.puts usage
|
122
116
|
exit 1
|
123
117
|
end
|
124
118
|
|