adlint 1.18.6 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +287 -188
- data/MANIFEST +278 -92
- data/NEWS +16 -4
- data/bin/adlintize +124 -3
- data/etc/conf.d/fallback/traits.erb +54 -1
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +54 -1
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +54 -1
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +54 -1
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +54 -1
- data/etc/mesg.d/c_builtin/en_US/messages.yml +2998 -0
- data/etc/mesg.d/c_builtin/ja_JP/messages.yml +2998 -0
- data/etc/mesg.d/core/en_US/messages.yml +134 -0
- data/etc/mesg.d/core/ja_JP/messages.yml +134 -0
- data/features/{message_detection → code_check}/E0013.feature +2 -2
- data/features/{message_detection → code_check}/W0001.feature +4 -4
- data/features/{message_detection → code_check}/W0002.feature +6 -6
- data/features/{message_detection → code_check}/W0003.feature +8 -8
- data/features/{message_detection → code_check}/W0007.feature +16 -16
- data/features/{message_detection → code_check}/W0010.feature +8 -8
- data/features/{message_detection → code_check}/W0013.feature +16 -16
- data/features/code_check/W0016.feature +200 -0
- data/features/code_check/W0017.feature +270 -0
- data/features/code_check/W0025.feature +66 -0
- data/features/code_check/W0026.feature +143 -0
- data/features/{message_detection → code_check}/W0093.feature +6 -6
- data/features/{message_detection → code_check}/W0104.feature +14 -14
- data/features/{message_detection → code_check}/W0109.feature +6 -6
- data/features/code_check/W0119.feature +151 -0
- data/features/code_check/W0120.feature +137 -0
- data/features/code_check/W0121.feature +147 -0
- data/features/code_check/W0122.feature +142 -0
- data/features/code_check/W0123.feature +147 -0
- data/features/code_check/W0124.feature +142 -0
- data/features/code_check/W0125.feature +147 -0
- data/features/code_check/W0126.feature +142 -0
- data/features/code_check/W0127.feature +147 -0
- data/features/code_check/W0128.feature +147 -0
- data/features/code_check/W0129.feature +147 -0
- data/features/code_check/W0130.feature +159 -0
- data/features/code_check/W0131.feature +154 -0
- data/features/code_check/W0132.feature +137 -0
- data/features/code_check/W0133.feature +151 -0
- data/features/code_check/W0134.feature +151 -0
- data/features/code_check/W0135.feature +147 -0
- data/features/code_check/W0136.feature +151 -0
- data/features/code_check/W0137.feature +147 -0
- data/features/code_check/W0138.feature +151 -0
- data/features/code_check/W0139.feature +147 -0
- data/features/code_check/W0140.feature +159 -0
- data/features/code_check/W0141.feature +155 -0
- data/features/code_check/W0142.feature +152 -0
- data/features/code_check/W0143.feature +147 -0
- data/features/code_check/W0144.feature +146 -0
- data/features/code_check/W0145.feature +147 -0
- data/features/code_check/W0146.feature +146 -0
- data/features/code_check/W0147.feature +146 -0
- data/features/code_check/W0148.feature +147 -0
- data/features/code_check/W0149.feature +146 -0
- data/features/code_check/W0150.feature +146 -0
- data/features/code_check/W0151.feature +146 -0
- data/features/code_check/W0152.feature +155 -0
- data/features/code_check/W0153.feature +155 -0
- data/features/code_check/W0154.feature +154 -0
- data/features/code_check/W0155.feature +154 -0
- data/features/code_check/W0156.feature +167 -0
- data/features/code_check/W0157.feature +152 -0
- data/features/code_check/W0158.feature +147 -0
- data/features/code_check/W0159.feature +147 -0
- data/features/code_check/W0160.feature +147 -0
- data/features/code_check/W0161.feature +151 -0
- data/features/code_check/W0162.feature +146 -0
- data/features/code_check/W0163.feature +146 -0
- data/features/code_check/W0164.feature +146 -0
- data/features/code_check/W0165.feature +151 -0
- data/features/code_check/W0166.feature +146 -0
- data/features/code_check/W0167.feature +146 -0
- data/features/code_check/W0168.feature +146 -0
- data/features/code_check/W0169.feature +151 -0
- data/features/code_check/W0170.feature +146 -0
- data/features/code_check/W0171.feature +146 -0
- data/features/code_check/W0172.feature +146 -0
- data/features/code_check/W0173.feature +159 -0
- data/features/code_check/W0174.feature +159 -0
- data/features/code_check/W0175.feature +158 -0
- data/features/code_check/W0176.feature +158 -0
- data/features/code_check/W0177.feature +159 -0
- data/features/code_check/W0178.feature +155 -0
- data/features/code_check/W0179.feature +154 -0
- data/features/code_check/W0180.feature +154 -0
- data/features/code_check/W0181.feature +167 -0
- data/features/code_check/W0182.feature +147 -0
- data/features/code_check/W0183.feature +147 -0
- data/features/code_check/W0184.feature +148 -0
- data/features/code_check/W0185.feature +142 -0
- data/features/code_check/W0186.feature +142 -0
- data/features/code_check/W0187.feature +142 -0
- data/features/code_check/W0188.feature +142 -0
- data/features/code_check/W0189.feature +142 -0
- data/features/code_check/W0190.feature +142 -0
- data/features/code_check/W0191.feature +142 -0
- data/features/code_check/W0192.feature +142 -0
- data/features/code_check/W0193.feature +143 -0
- data/features/code_check/W0194.feature +142 -0
- data/features/code_check/W0195.feature +142 -0
- data/features/code_check/W0196.feature +142 -0
- data/features/code_check/W0197.feature +142 -0
- data/features/code_check/W0198.feature +142 -0
- data/features/code_check/W0199.feature +143 -0
- data/features/code_check/W0200.feature +142 -0
- data/features/code_check/W0201.feature +142 -0
- data/features/code_check/W0202.feature +142 -0
- data/features/code_check/W0203.feature +142 -0
- data/features/code_check/W0204.feature +142 -0
- data/features/code_check/W0205.feature +143 -0
- data/features/code_check/W0206.feature +150 -0
- data/features/code_check/W0207.feature +150 -0
- data/features/code_check/W0208.feature +150 -0
- data/features/code_check/W0209.feature +151 -0
- data/features/code_check/W0210.feature +151 -0
- data/features/code_check/W0211.feature +151 -0
- data/features/code_check/W0212.feature +147 -0
- data/features/code_check/W0213.feature +142 -0
- data/features/code_check/W0214.feature +147 -0
- data/features/code_check/W0215.feature +142 -0
- data/features/code_check/W0216.feature +142 -0
- data/features/code_check/W0217.feature +142 -0
- data/features/code_check/W0218.feature +142 -0
- data/features/code_check/W0219.feature +142 -0
- data/features/code_check/W0220.feature +142 -0
- data/features/code_check/W0221.feature +147 -0
- data/features/code_check/W0222.feature +142 -0
- data/features/code_check/W0223.feature +147 -0
- data/features/code_check/W0224.feature +142 -0
- data/features/code_check/W0225.feature +142 -0
- data/features/code_check/W0226.feature +142 -0
- data/features/code_check/W0227.feature +142 -0
- data/features/code_check/W0228.feature +142 -0
- data/features/code_check/W0229.feature +142 -0
- data/features/code_check/W0230.feature +147 -0
- data/features/code_check/W0231.feature +142 -0
- data/features/code_check/W0232.feature +148 -0
- data/features/code_check/W0233.feature +142 -0
- data/features/code_check/W0234.feature +143 -0
- data/features/code_check/W0235.feature +142 -0
- data/features/code_check/W0236.feature +143 -0
- data/features/code_check/W0237.feature +142 -0
- data/features/code_check/W0238.feature +143 -0
- data/features/code_check/W0239.feature +154 -0
- data/features/code_check/W0240.feature +155 -0
- data/features/code_check/W0241.feature +154 -0
- data/features/code_check/W0242.feature +155 -0
- data/features/code_check/W0243.feature +154 -0
- data/features/code_check/W0244.feature +155 -0
- data/features/code_check/W0245.feature +147 -0
- data/features/code_check/W0246.feature +147 -0
- data/features/code_check/W0247.feature +147 -0
- data/features/code_check/W0248.feature +142 -0
- data/features/code_check/W0249.feature +142 -0
- data/features/code_check/W0250.feature +146 -0
- data/features/code_check/W0251.feature +159 -0
- data/features/code_check/W0252.feature +155 -0
- data/features/code_check/W0253.feature +154 -0
- data/features/code_check/W0254.feature +154 -0
- data/features/code_check/W0477.feature +77 -0
- data/features/code_check/W0478.feature +103 -0
- data/features/code_check/W0479.feature +65 -0
- data/features/code_check/W0480.feature +119 -0
- data/features/code_check/W0481.feature +28 -0
- data/features/code_check/W0482.feature +64 -0
- data/features/code_check/W0483.feature +62 -0
- data/features/code_check/W0573.feature +91 -0
- data/features/{message_detection → code_check}/W0583.feature +2 -2
- data/features/{message_detection → code_check}/W0606.feature +2 -2
- data/features/{message_detection → code_check}/W0641.feature +16 -16
- data/features/{message_detection → code_check}/W0643.feature +12 -12
- data/features/{message_detection → code_check}/W0644.feature +50 -50
- data/features/{message_detection → code_check}/W0645.feature +16 -16
- data/features/{message_detection → code_check}/W0646.feature +16 -16
- data/features/{message_detection → code_check}/W0649.feature +28 -28
- data/features/{message_detection → code_check}/W0650.feature +24 -24
- data/features/code_check/W0685.feature +120 -0
- data/features/code_check/W0686.feature +92 -0
- data/features/{message_detection → code_check}/W0687.feature +4 -4
- data/features/{message_detection → code_check}/W0688.feature +12 -12
- data/features/{message_detection → code_check}/W0689.feature +8 -8
- data/features/{message_detection → code_check}/W0690.feature +6 -6
- data/features/{message_detection → code_check}/W0691.feature +14 -14
- data/features/{message_detection → code_check}/W0692.feature +4 -4
- data/features/{message_detection → code_check}/W0694.feature +10 -10
- data/features/code_check/W0695.feature +78 -0
- data/features/{message_detection → code_check}/W0697.feature +18 -18
- data/features/{message_detection → code_check}/W0698.feature +2 -2
- data/features/{message_detection → code_check}/W0699.feature +2 -2
- data/features/{message_detection → code_check}/W0700.feature +6 -6
- data/features/{message_detection → code_check}/W0703.feature +6 -6
- data/features/{message_detection → code_check}/W0705.feature +24 -24
- data/features/{message_detection → code_check}/W0707.feature +20 -20
- data/features/{message_detection → code_check}/W0711.feature +10 -10
- data/features/{message_detection → code_check}/W0712.feature +10 -10
- data/features/{message_detection → code_check}/W0713.feature +10 -10
- data/features/{message_detection → code_check}/W0714.feature +10 -10
- data/features/{message_detection → code_check}/W0715.feature +11 -11
- data/features/{message_detection → code_check}/W0716.feature +6 -6
- data/features/{message_detection → code_check}/W0717.feature +6 -6
- data/features/{message_detection → code_check}/W0718.feature +6 -6
- data/features/{message_detection → code_check}/W0719.feature +16 -16
- data/features/{message_detection → code_check}/W0723.feature +6 -6
- data/features/code_check/W0726.feature +95 -0
- data/features/{message_detection → code_check}/W0732.feature +6 -6
- data/features/{message_detection → code_check}/W0733.feature +6 -6
- data/features/{message_detection → code_check}/W0734.feature +16 -16
- data/features/{message_detection → code_check}/W0735.feature +16 -16
- data/features/{message_detection → code_check}/W0745.feature +10 -10
- data/features/code_check/W0747.feature +146 -0
- data/features/code_check/W0748.feature +148 -0
- data/features/code_check/W0749.feature +146 -0
- data/features/code_check/W0750.feature +146 -0
- data/features/code_check/W0751.feature +148 -0
- data/features/code_check/W0752.feature +143 -0
- data/features/code_check/W0753.feature +146 -0
- data/features/code_check/W0754.feature +146 -0
- data/features/code_check/W0755.feature +142 -0
- data/features/code_check/W0756.feature +148 -0
- data/features/code_check/W0757.feature +143 -0
- data/features/code_check/W0758.feature +143 -0
- data/features/code_check/W0759.feature +154 -0
- data/features/code_check/W0760.feature +154 -0
- data/features/code_check/W0761.feature +154 -0
- data/features/code_check/W0762.feature +154 -0
- data/features/code_check/W0763.feature +156 -0
- data/features/code_check/W0764.feature +151 -0
- data/features/code_check/W0765.feature +151 -0
- data/features/code_check/W0766.feature +151 -0
- data/features/code_check/W0767.feature +142 -0
- data/features/code_check/W0768.feature +142 -0
- data/features/code_check/W0769.feature +142 -0
- data/features/{message_detection → code_check}/W0780.feature +12 -12
- data/features/code_check/W0781.feature +145 -0
- data/features/{message_detection → code_check}/W0783.feature +8 -8
- data/features/{message_detection → code_check}/W0792.feature +16 -16
- data/features/{message_detection → code_check}/W0793.feature +16 -16
- data/features/{message_detection → code_check}/W0794.feature +10 -10
- data/features/code_check/W0801.feature +84 -0
- data/features/{message_detection → code_check}/W0805.feature +14 -14
- data/features/code_check/W0806.feature +24 -0
- data/features/code_check/W0807.feature +35 -0
- data/features/code_check/W0808.feature +34 -0
- data/features/code_check/W0809.feature +114 -0
- data/features/{message_detection → code_check}/W0811.feature +10 -10
- data/features/{message_detection → code_check}/W0830.feature +12 -12
- data/features/{message_detection → code_check}/W0833.feature +30 -30
- data/features/{message_detection → code_check}/W0834.feature +26 -26
- data/features/{message_detection → code_check}/W1026.feature +8 -8
- data/features/code_check/W1030.feature +84 -0
- data/features/{message_detection → code_check}/W1031.feature +36 -36
- data/features/{message_detection → code_check}/W1039.feature +24 -24
- data/features/{message_detection → code_check}/W1040.feature +8 -8
- data/features/{message_detection → code_check}/W1041.feature +2 -2
- data/features/{message_detection → code_check}/W1046.feature +6 -6
- data/features/{message_detection → code_check}/W1047.feature +12 -12
- data/features/{message_detection → code_check}/W1052.feature +6 -6
- data/features/{message_detection → code_check}/W1066.feature +6 -6
- data/features/{message_detection → code_check}/W1067.feature +6 -6
- data/features/{message_detection → code_check}/W1068.feature +6 -6
- data/features/{message_detection → code_check}/W1069.feature +10 -10
- data/features/{message_detection → code_check}/W1070.feature +15 -15
- data/features/{message_detection → code_check}/W1071.feature +8 -8
- data/features/{message_detection → code_check}/W1072.feature +2 -2
- data/features/{message_detection → code_check}/W1073.feature +14 -14
- data/features/{message_detection → code_check}/W1074.feature +10 -10
- data/features/{message_detection → code_check}/W1075.feature +10 -10
- data/features/{message_detection → code_check}/W1076.feature +8 -8
- data/features/{message_detection → code_check}/W1077.feature +18 -18
- data/features/{message_detection → code_check}/W9001.feature +2 -2
- data/features/{message_detection → code_check}/W9003.feature +12 -12
- data/features/step_definitions/{message_detection_steps.rb → code_check_steps.rb} +1 -1
- data/features/support/env.rb +19 -3
- data/lib/adlint.rb +1 -0
- data/lib/adlint/analyzer.rb +17 -1
- data/lib/adlint/c.rb +0 -4
- data/lib/adlint/c/phase.rb +55 -745
- data/lib/adlint/code.rb +0 -24
- data/lib/adlint/cpp.rb +0 -3
- data/lib/adlint/cpp/phase.rb +50 -112
- data/lib/adlint/driver.rb +2 -2
- data/lib/adlint/error.rb +4 -4
- data/lib/adlint/exam.rb +143 -0
- data/lib/adlint/exam/c_builtin.rb +813 -0
- data/lib/adlint/{c/message.rb → exam/c_builtin/c_check.rb} +2130 -798
- data/lib/adlint/{c/message_shima.rb → exam/c_builtin/c_check_shima.rb} +99 -28
- data/lib/adlint/{c/code.rb → exam/c_builtin/c_code.rb} +31 -5
- data/lib/adlint/{c/metric.rb → exam/c_builtin/c_metric.rb} +43 -11
- data/lib/adlint/{cpp/message.rb → exam/c_builtin/cpp_check.rb} +177 -73
- data/lib/adlint/{cpp/message_shima.rb → exam/c_builtin/cpp_check_shima.rb} +28 -8
- data/lib/adlint/{cpp/code.rb → exam/c_builtin/cpp_code.rb} +14 -3
- data/lib/adlint/{ld/message.rb → exam/c_builtin/ld_check.rb} +33 -12
- data/lib/adlint/{ld/metric.rb → exam/c_builtin/ld_metric.rb} +8 -3
- data/lib/adlint/lang.rb +2 -2
- data/lib/adlint/ld.rb +0 -2
- data/lib/adlint/ld/phase.rb +101 -101
- data/lib/adlint/message.rb +155 -98
- data/lib/adlint/metric.rb +0 -27
- data/lib/adlint/phase.rb +28 -3
- data/lib/adlint/report.rb +22 -12
- data/lib/adlint/traits.rb +97 -5
- data/lib/adlint/util.rb +100 -11
- data/lib/adlint/version.rb +5 -5
- 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 +1817 -1648
- data/share/doc/users_guide_en.texi +202 -22
- data/share/doc/users_guide_ja.html +1836 -1663
- data/share/doc/users_guide_ja.texi +203 -20
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +55 -2
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +47 -2
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +47 -2
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +47 -2
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +47 -2
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +47 -2
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +47 -2
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +47 -2
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +47 -2
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +47 -2
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +47 -2
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +47 -2
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +47 -2
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +47 -2
- data/spec/conf.d/default_traits.yml +56 -3
- metadata +280 -94
- data/etc/mesg.d/en_US/messages.yml +0 -797
- data/etc/mesg.d/ja_JP/messages.yml +0 -797
data/lib/adlint/message.rb
CHANGED
@@ -55,10 +55,10 @@ module AdLint #:nodoc:
|
|
55
55
|
# _id_:: Symbol -- Message ID symbol.
|
56
56
|
# _location_:: Location -- Location where the message detected.
|
57
57
|
# _parts_:: Array< Object > -- Message formatting parts.
|
58
|
-
def initialize(id, location, *parts)
|
59
|
-
@id, @location = id, location
|
58
|
+
def initialize(package, id, location, *parts)
|
59
|
+
@package, @id, @location = package, id, location
|
60
60
|
@parts = parts
|
61
|
-
validate_id(@id, @location)
|
61
|
+
validate_id(@package, @id, @location)
|
62
62
|
end
|
63
63
|
|
64
64
|
attr_reader :id
|
@@ -91,17 +91,31 @@ module AdLint #:nodoc:
|
|
91
91
|
# === RETURN VALUE
|
92
92
|
# Array< Object > -- Array of message elements.
|
93
93
|
def to_a
|
94
|
-
if templ = MessageCatalog.instance
|
94
|
+
if templ = MessageCatalog.instance.lookup(@package, @id)
|
95
95
|
begin
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
96
|
+
if Traits.instance.of_message.message_with_class
|
97
|
+
[
|
98
|
+
type.to_s,
|
99
|
+
@location.fpath, @location.line_no, @location.column_no,
|
100
|
+
templ.package,
|
101
|
+
@id,
|
102
|
+
templ.typical_class.category,
|
103
|
+
templ.typical_class.severity,
|
104
|
+
templ.format(@parts)
|
105
|
+
]
|
106
|
+
else
|
107
|
+
[
|
108
|
+
type.to_s,
|
109
|
+
@location.fpath, @location.line_no, @location.column_no,
|
110
|
+
@id,
|
111
|
+
templ.format(@parts)
|
112
|
+
]
|
113
|
+
end
|
100
114
|
rescue
|
101
|
-
raise InvalidMessageFormatError.new(@id, @location)
|
115
|
+
raise InvalidMessageFormatError.new(@package, @id, @location)
|
102
116
|
end
|
103
117
|
else
|
104
|
-
raise InvalidMessageIdError.new(@id, @location)
|
118
|
+
raise InvalidMessageIdError.new(@package, @id, @location)
|
105
119
|
end
|
106
120
|
end
|
107
121
|
|
@@ -111,9 +125,21 @@ module AdLint #:nodoc:
|
|
111
125
|
# === RETURN VALUE
|
112
126
|
# String -- String representation of this message.
|
113
127
|
def to_s
|
114
|
-
|
115
|
-
|
116
|
-
|
128
|
+
if templ = MessageCatalog.instance.lookup(@package, @id)
|
129
|
+
begin
|
130
|
+
"#{@location.to_s.to_default_external}:" +
|
131
|
+
"#{type_str.to_default_external}:" +
|
132
|
+
"#{templ.package}:" +
|
133
|
+
"#{@id.to_s.to_default_external}:" +
|
134
|
+
"#{templ.typical_class.category}:" +
|
135
|
+
"#{templ.typical_class.severity}:" +
|
136
|
+
"#{templ.format(@parts)}"
|
137
|
+
rescue
|
138
|
+
raise InvalidMessageFormatError.new(@package, @id, @location)
|
139
|
+
end
|
140
|
+
else
|
141
|
+
raise InvalidMessageIdError.new(@package, @id, @location)
|
142
|
+
end
|
117
143
|
end
|
118
144
|
|
119
145
|
def to_csv
|
@@ -142,9 +168,9 @@ module AdLint #:nodoc:
|
|
142
168
|
#
|
143
169
|
# === RETURN VALUE
|
144
170
|
# None.
|
145
|
-
def validate_id(id, location)
|
146
|
-
MessageCatalog.instance
|
147
|
-
raise InvalidMessageIdError.new(id, location)
|
171
|
+
def validate_id(package, id, location)
|
172
|
+
MessageCatalog.instance.lookup(package, id) or
|
173
|
+
raise InvalidMessageIdError.new(package, id, location)
|
148
174
|
nil
|
149
175
|
end
|
150
176
|
end
|
@@ -152,6 +178,10 @@ module AdLint #:nodoc:
|
|
152
178
|
# == DESCRIPTION
|
153
179
|
# Syntactical error message.
|
154
180
|
class ErrorMessage < Message
|
181
|
+
def initialize(id, location, *parts)
|
182
|
+
super("core", id, location, *parts)
|
183
|
+
end
|
184
|
+
|
155
185
|
# === DESCRIPTION
|
156
186
|
# Reads the type of this message.
|
157
187
|
#
|
@@ -180,7 +210,7 @@ module AdLint #:nodoc:
|
|
180
210
|
# === PARAMETER
|
181
211
|
# _exception_:: Exception -- Cause exception.
|
182
212
|
def initialize(exception)
|
183
|
-
super(exception.id,
|
213
|
+
super("core", exception.id,
|
184
214
|
exception.location ? exception.location : Location.new,
|
185
215
|
*exception.parts)
|
186
216
|
@exception = exception
|
@@ -249,68 +279,82 @@ module AdLint #:nodoc:
|
|
249
279
|
end
|
250
280
|
end
|
251
281
|
|
282
|
+
class MessageClass
|
283
|
+
def initialize(class_str)
|
284
|
+
@category, @severity = class_str.split(":")
|
285
|
+
end
|
286
|
+
|
287
|
+
def category
|
288
|
+
@category.to_s.to_default_external
|
289
|
+
end
|
290
|
+
|
291
|
+
def severity
|
292
|
+
@severity.to_s.to_default_external
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
252
296
|
# == DESCRIPTION
|
253
297
|
# Message catalog entry.
|
254
|
-
class MessageTemplate
|
298
|
+
class MessageTemplate
|
299
|
+
def initialize(package, classes, format)
|
300
|
+
@package = package
|
301
|
+
@classes = classes.map { |class_str| MessageClass.new(class_str) }
|
302
|
+
@format = format
|
303
|
+
@typical_class = @classes.sort { |mesg_class| mesg_class.severity }.first
|
304
|
+
end
|
255
305
|
|
256
|
-
|
257
|
-
|
258
|
-
class MessageCatalog < Hash
|
259
|
-
include Singleton
|
306
|
+
attr_reader :classes
|
307
|
+
attr_reader :typical_class
|
260
308
|
|
261
|
-
|
262
|
-
|
309
|
+
def package
|
310
|
+
@package.to_s.to_default_external
|
311
|
+
end
|
312
|
+
|
313
|
+
def format(parts)
|
314
|
+
@format.to_s.to_default_external %
|
315
|
+
parts.map { |obj| obj.to_s.to_default_external }
|
316
|
+
end
|
317
|
+
end
|
263
318
|
|
264
|
-
|
265
|
-
|
319
|
+
class MessageDefinitionFile
|
320
|
+
MESSAGES_FNAME = Pathname.new("messages.yml")
|
321
|
+
private_constant :MESSAGES_FNAME
|
266
322
|
|
267
|
-
def
|
268
|
-
|
269
|
-
mesg_dpath = DEFAULT_DNAME.expand_path($etcdir)
|
270
|
-
lang_dpath = Pathname.new(Traits.instance.of_message.language)
|
271
|
-
fpath = mesg_dpath.join(lang_dpath).join(DEFAULT_FNAME)
|
272
|
-
end
|
273
|
-
File.open(fpath, "r:utf-8") { |io| read_from(io) }
|
323
|
+
def initialize(package_name)
|
324
|
+
@package_name = package_name
|
274
325
|
end
|
275
326
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
version = doc["version"]
|
293
|
-
validate_version(version)
|
294
|
-
if message_definition = doc["message_definition"]
|
295
|
-
message_definition.each do |id, text|
|
296
|
-
if changed = Traits.instance.of_message.change_list[id.intern]
|
297
|
-
self[id.intern] = MessageTemplate.new(changed)
|
298
|
-
else
|
299
|
-
self[id.intern] = MessageTemplate.new(text)
|
300
|
-
end
|
327
|
+
attr_reader :package_name
|
328
|
+
|
329
|
+
def read_into(message_catalog)
|
330
|
+
File.open(fpath, "r:utf-8") do |io|
|
331
|
+
case array_or_stream = YAML.load_stream(io)
|
332
|
+
when Array
|
333
|
+
# NOTE: YAML.load_stream returns Array in Ruby 1.9.3-preview1.
|
334
|
+
doc = array_or_stream.first
|
335
|
+
when YAML::Stream
|
336
|
+
doc = array_or_stream.documents.first
|
337
|
+
end
|
338
|
+
validate_version(doc["version"])
|
339
|
+
if message_definition = doc["message_definition"]
|
340
|
+
message_catalog.merge!(package_name, message_definition)
|
341
|
+
else
|
342
|
+
raise "invalid form of the message definition file."
|
301
343
|
end
|
302
|
-
else
|
303
|
-
raise "invalid form of the message definition file."
|
304
344
|
end
|
305
345
|
self
|
306
346
|
end
|
307
347
|
|
308
348
|
private
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
349
|
+
def base_dpath
|
350
|
+
subclass_responsibility
|
351
|
+
end
|
352
|
+
|
353
|
+
def fpath
|
354
|
+
lang_dpath = Pathname.new(Traits.instance.of_message.language)
|
355
|
+
base_dpath.join(lang_dpath).join(MESSAGES_FNAME)
|
356
|
+
end
|
357
|
+
|
314
358
|
def validate_version(version)
|
315
359
|
# NOTE: Version field of the message catalog does not mean the schema
|
316
360
|
# version of the catalog file, but a revision number of the catalog
|
@@ -321,51 +365,64 @@ module AdLint #:nodoc:
|
|
321
365
|
end
|
322
366
|
end
|
323
367
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
# === DESCRIPTION
|
328
|
-
# Constructs a message detecting object.
|
329
|
-
#
|
330
|
-
# === PARAMETER
|
331
|
-
# _context_:: PhaseContext -- Analysis context.
|
332
|
-
def initialize(context)
|
333
|
-
@context = context
|
368
|
+
class CoreMessageDefinitionFile < MessageDefinitionFile
|
369
|
+
def initialize
|
370
|
+
super("core")
|
334
371
|
end
|
335
372
|
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
373
|
+
private
|
374
|
+
def base_dpath
|
375
|
+
Pathname.new("mesg.d/core").expand_path($etcdir)
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
class ExamMessageDefinitionFile < MessageDefinitionFile
|
380
|
+
def initialize(exam_package)
|
381
|
+
super(exam_package.name)
|
382
|
+
@exam_package = exam_package
|
341
383
|
end
|
342
384
|
|
343
385
|
private
|
344
|
-
|
345
|
-
|
346
|
-
#
|
347
|
-
# Subclasses must implement this method.
|
348
|
-
def do_prepare(context)
|
349
|
-
subclass_responsibility
|
386
|
+
def base_dpath
|
387
|
+
@exam_package.catalog.message_definition_dpath
|
350
388
|
end
|
389
|
+
end
|
351
390
|
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
391
|
+
# == DESCRIPTION
|
392
|
+
# Message catalog.
|
393
|
+
class MessageCatalog
|
394
|
+
include Singleton
|
395
|
+
|
396
|
+
def initialize
|
397
|
+
@hash = Hash.new
|
358
398
|
end
|
359
399
|
|
360
|
-
def
|
361
|
-
@
|
400
|
+
def lookup(package_name, mesg_id)
|
401
|
+
@hash[[package_name, mesg_id]]
|
402
|
+
end
|
403
|
+
|
404
|
+
def merge!(package_name, message_definition)
|
405
|
+
message_definition.each do |id, content|
|
406
|
+
message_traits = Traits.instance.of_message
|
407
|
+
if changed = message_traits.change_list[[package_name, id.intern]]
|
408
|
+
content = changed
|
409
|
+
end
|
410
|
+
@hash[[package_name, id.intern]] = MessageTemplate.new(
|
411
|
+
package_name, content["classes"], content["format"])
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
def load
|
416
|
+
message_definition_files.each { |mdef_file| mdef_file.read_into(self) }
|
362
417
|
end
|
363
|
-
end
|
364
418
|
|
365
|
-
class PassiveMessageDetection < MessageDetection
|
366
419
|
private
|
367
|
-
def
|
368
|
-
|
420
|
+
def message_definition_files
|
421
|
+
[CoreMessageDefinitionFile.new] +
|
422
|
+
Traits.instance.exam_packages.map { |exam_package|
|
423
|
+
ExamMessageDefinitionFile.new(exam_package)
|
424
|
+
}
|
425
|
+
end
|
369
426
|
end
|
370
427
|
|
371
428
|
end
|
data/lib/adlint/metric.rb
CHANGED
@@ -29,8 +29,6 @@
|
|
29
29
|
#
|
30
30
|
#++
|
31
31
|
|
32
|
-
require "adlint/token"
|
33
|
-
require "adlint/code"
|
34
32
|
require "adlint/util"
|
35
33
|
|
36
34
|
module AdLint #:nodoc:
|
@@ -267,31 +265,6 @@ module AdLint #:nodoc:
|
|
267
265
|
end
|
268
266
|
end
|
269
267
|
|
270
|
-
# == Base of metric measurement classes.
|
271
|
-
class MetricMeasurement
|
272
|
-
def initialize(context)
|
273
|
-
@context = context
|
274
|
-
end
|
275
|
-
|
276
|
-
def execute
|
277
|
-
do_prepare(@context)
|
278
|
-
do_execute(@context)
|
279
|
-
end
|
280
|
-
|
281
|
-
private
|
282
|
-
def do_prepare(context)
|
283
|
-
subclass_responsibility
|
284
|
-
end
|
285
|
-
|
286
|
-
def do_execute(context)
|
287
|
-
subclass_responsibility
|
288
|
-
end
|
289
|
-
|
290
|
-
def report
|
291
|
-
@context.report
|
292
|
-
end
|
293
|
-
end
|
294
|
-
|
295
268
|
class MetricRecord < CsvRecord
|
296
269
|
def self.of(csv_row)
|
297
270
|
case csv_row[0]
|
data/lib/adlint/phase.rb
CHANGED
@@ -45,14 +45,19 @@ module AdLint #:nodoc:
|
|
45
45
|
#
|
46
46
|
# === PARAMETER
|
47
47
|
# _context_:: PhaseContext -- Analysis context.
|
48
|
-
def initialize(context)
|
48
|
+
def initialize(context, package_name, phase_name)
|
49
49
|
@context = context
|
50
|
+
@package_name = package_name
|
51
|
+
@phase_name = phase_name
|
50
52
|
end
|
51
53
|
|
52
54
|
# === DESCRIPTION
|
53
55
|
# Executes the analysis.
|
54
56
|
def execute
|
55
|
-
|
57
|
+
monitored_region(@phase_name) do |monitor|
|
58
|
+
do_execute(@context, monitor)
|
59
|
+
register_examinations
|
60
|
+
end
|
56
61
|
rescue Error => ex
|
57
62
|
@context.report.add_message(Message.from_exception(ex))
|
58
63
|
raise
|
@@ -63,9 +68,29 @@ module AdLint #:nodoc:
|
|
63
68
|
# Executes the analysis.
|
64
69
|
#
|
65
70
|
# Subclasses must implement this method.
|
66
|
-
def do_execute(context)
|
71
|
+
def do_execute(context, monitor)
|
67
72
|
subclass_responsibility
|
68
73
|
end
|
74
|
+
|
75
|
+
def register_examinations
|
76
|
+
context_key = context_key_of("examinations")
|
77
|
+
@context[context_key] ||= []
|
78
|
+
Traits.instance.exam_packages.each do |exam_package|
|
79
|
+
exam_package.catalog.examination_classes.each do |exam_class|
|
80
|
+
if exam_class.registrant_phase_class == self.class
|
81
|
+
@context[context_key].push(exam_class.new(@context))
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def examinations
|
88
|
+
@context[context_key_of("examinations")] || []
|
89
|
+
end
|
90
|
+
|
91
|
+
def context_key_of(str)
|
92
|
+
"#{@package_name}_#{str}".intern
|
93
|
+
end
|
69
94
|
end
|
70
95
|
|
71
96
|
class PhaseContext < Hash
|
data/lib/adlint/report.rb
CHANGED
@@ -29,10 +29,11 @@
|
|
29
29
|
#
|
30
30
|
#++
|
31
31
|
|
32
|
-
require "adlint/
|
32
|
+
require "adlint/exam"
|
33
33
|
require "adlint/message"
|
34
34
|
require "adlint/code"
|
35
35
|
require "adlint/metric"
|
36
|
+
require "adlint/util"
|
36
37
|
|
37
38
|
module AdLint #:nodoc:
|
38
39
|
|
@@ -163,11 +164,16 @@ module AdLint #:nodoc:
|
|
163
164
|
#
|
164
165
|
# === RETURN VALUE
|
165
166
|
# None.
|
166
|
-
def add_warning_message(id, location, *parts)
|
167
|
-
add_message(WarningMessage.new(id, location, *parts))
|
167
|
+
def add_warning_message(package, id, location, *parts)
|
168
|
+
add_message(WarningMessage.new(package, id, location, *parts))
|
168
169
|
end
|
169
|
-
|
170
|
-
|
170
|
+
module_function :add_warning_message
|
171
|
+
|
172
|
+
def W(id, location, *parts)
|
173
|
+
add_warning_message(PackageResolver.package_name_of(self.class),
|
174
|
+
id, location, *parts)
|
175
|
+
end
|
176
|
+
module_function :W
|
171
177
|
|
172
178
|
# === DESCRIPTION
|
173
179
|
# Adds a context message to the report.
|
@@ -182,11 +188,16 @@ module AdLint #:nodoc:
|
|
182
188
|
#
|
183
189
|
# === RETURN VALUE
|
184
190
|
# None.
|
185
|
-
def add_context_message(id, location, *parts)
|
186
|
-
add_message(ContextMessage.new(id, location, *parts))
|
191
|
+
def add_context_message(package, id, location, *parts)
|
192
|
+
add_message(ContextMessage.new(package, id, location, *parts))
|
193
|
+
end
|
194
|
+
module_function :add_context_message
|
195
|
+
|
196
|
+
def C(id, location, *parts)
|
197
|
+
add_context_message(PackageResolver.package_name_of(self.class),
|
198
|
+
id, location, *parts)
|
187
199
|
end
|
188
|
-
|
189
|
-
module_function :add_context_message, :C
|
200
|
+
module_function :C
|
190
201
|
|
191
202
|
# === DESCRIPTION
|
192
203
|
# Adds a message to the report.
|
@@ -610,8 +621,7 @@ module AdLint #:nodoc:
|
|
610
621
|
module_function :add_code_metric
|
611
622
|
end
|
612
623
|
|
613
|
-
|
614
|
-
|
615
|
-
MetricMeasurement.class_eval { include ReportUtil }
|
624
|
+
Examination.class_eval { include ReportUtil }
|
625
|
+
CodeCheck.class_eval { extend MessageUniqueness }
|
616
626
|
|
617
627
|
end
|