adlint 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +27 -0
- data/COPYING +674 -0
- data/ChangeLog +820 -0
- data/INSTALL +78 -0
- data/MANIFEST +464 -0
- data/NEWS +38 -0
- data/README +74 -0
- data/Rakefile +167 -0
- data/TODO +29 -0
- data/bin/adlint +141 -0
- data/bin/adlint_chk +129 -0
- data/bin/adlint_cma +122 -0
- data/bin/adlint_sma +129 -0
- data/bin/adlintize +286 -0
- data/etc/conf.d/fallback/cinit.erb +11 -0
- data/etc/conf.d/fallback/traits.erb +216 -0
- data/etc/conf.d/i686-cygwin/cinit-gcc_4.3.4.erb +149 -0
- data/etc/conf.d/i686-cygwin/traits-gcc_4.3.4.erb +227 -0
- data/etc/conf.d/i686-devkit/cinit-gcc_4.5.2.erb +224 -0
- data/etc/conf.d/i686-devkit/traits-gcc_4.5.2.erb +226 -0
- data/etc/conf.d/i686-linux/cinit-gcc_4.5.1.erb +219 -0
- data/etc/conf.d/i686-linux/traits-gcc_4.5.1.erb +224 -0
- data/etc/conf.d/i686-mingw/cinit-gcc_4.6.1.erb +234 -0
- data/etc/conf.d/i686-mingw/traits-gcc_4.6.1.erb +226 -0
- data/etc/conf.d/noarch/GNUmakefile.erb +119 -0
- data/etc/conf.d/noarch/adlint_all_bat.erb +9 -0
- data/etc/conf.d/noarch/adlint_all_sh.erb +10 -0
- data/etc/conf.d/noarch/pinit.erb +11 -0
- data/etc/mesg.d/en_US/messages.yml +784 -0
- data/etc/mesg.d/ja_JP/messages.yml +784 -0
- data/lib/adlint/analyzer.rb +294 -0
- data/lib/adlint/c/branch.rb +251 -0
- data/lib/adlint/c/builtin.rb +92 -0
- data/lib/adlint/c/code.rb +490 -0
- data/lib/adlint/c/const.rb +465 -0
- data/lib/adlint/c/conv.rb +212 -0
- data/lib/adlint/c/ctrlexpr.rb +949 -0
- data/lib/adlint/c/domain.rb +7499 -0
- data/lib/adlint/c/environ.rb +133 -0
- data/lib/adlint/c/expr.rb +1725 -0
- data/lib/adlint/c/format.rb +3209 -0
- data/lib/adlint/c/interp.rb +1740 -0
- data/lib/adlint/c/lexer.rb +241 -0
- data/lib/adlint/c/mediator.rb +313 -0
- data/lib/adlint/c/message.rb +13597 -0
- data/lib/adlint/c/metric.rb +765 -0
- data/lib/adlint/c/object.rb +1018 -0
- data/lib/adlint/c/parser.rb +3800 -0
- data/lib/adlint/c/parser.y +2054 -0
- data/lib/adlint/c/phase.rb +712 -0
- data/lib/adlint/c/resolver.rb +270 -0
- data/lib/adlint/c/scanner.rb +248 -0
- data/lib/adlint/c/scope.rb +74 -0
- data/lib/adlint/c/syntax.rb +4279 -0
- data/lib/adlint/c/type.rb +7506 -0
- data/lib/adlint/c/util.rb +91 -0
- data/lib/adlint/c/value.rb +2310 -0
- data/lib/adlint/c.rb +56 -0
- data/lib/adlint/code.rb +500 -0
- data/lib/adlint/cpp/code.rb +189 -0
- data/lib/adlint/cpp/constexpr.rb +721 -0
- data/lib/adlint/cpp/constexpr.y +389 -0
- data/lib/adlint/cpp/eval.rb +1012 -0
- data/lib/adlint/cpp/lexer.rb +860 -0
- data/lib/adlint/cpp/macro.rb +637 -0
- data/lib/adlint/cpp/message.rb +992 -0
- data/lib/adlint/cpp/phase.rb +176 -0
- data/lib/adlint/cpp/scanner.rb +93 -0
- data/lib/adlint/cpp/source.rb +169 -0
- data/lib/adlint/cpp/subst.rb +300 -0
- data/lib/adlint/cpp/syntax.rb +1412 -0
- data/lib/adlint/cpp/util.rb +97 -0
- data/lib/adlint/cpp.rb +43 -0
- data/lib/adlint/driver.rb +147 -0
- data/lib/adlint/error.rb +179 -0
- data/lib/adlint/lang.rb +97 -0
- data/lib/adlint/ld/message.rb +259 -0
- data/lib/adlint/ld/metric.rb +57 -0
- data/lib/adlint/ld/object.rb +542 -0
- data/lib/adlint/ld/phase.rb +193 -0
- data/lib/adlint/ld/typedef.rb +109 -0
- data/lib/adlint/ld/util.rb +88 -0
- data/lib/adlint/ld.rb +37 -0
- data/lib/adlint/lexer.rb +293 -0
- data/lib/adlint/message.rb +368 -0
- data/lib/adlint/metric.rb +805 -0
- data/lib/adlint/monitor.rb +144 -0
- data/lib/adlint/phase.rb +90 -0
- data/lib/adlint/prelude.rb +314 -0
- data/lib/adlint/report.rb +617 -0
- data/lib/adlint/source.rb +155 -0
- data/lib/adlint/symbol.rb +127 -0
- data/lib/adlint/token.rb +215 -0
- data/lib/adlint/traits.rb +643 -0
- data/lib/adlint/util.rb +524 -0
- data/lib/adlint/version.rb +71 -0
- data/lib/adlint.rb +66 -0
- data/share/HEADER +45 -0
- data/share/demo/Makefile +110 -0
- data/share/demo/ambig_operator/ambig_operator.c +289 -0
- data/share/demo/arg_points_unset/arg_points_unset.c +37 -0
- data/share/demo/array_range/array_range.c +62 -0
- data/share/demo/bad_bitfields/bad_bitfields.c +74 -0
- data/share/demo/bad_brace/bad_brace.c +19 -0
- data/share/demo/bad_charset/abcde$.h +0 -0
- data/share/demo/bad_charset/bad_charset.c +22 -0
- data/share/demo/bad_comment/bad_comment.c +3 -0
- data/share/demo/bad_const/bad_const.c +19 -0
- data/share/demo/bad_conv/bad_conv.c +48 -0
- data/share/demo/bad_indent/bad_indent.c +50 -0
- data/share/demo/bad_init/bad_init.c +49 -0
- data/share/demo/bad_macro/bad_macro.c +97 -0
- data/share/demo/bitwise_expr/bitwise_expr.c +19 -0
- data/share/demo/call_by_value/call_by_value.c +26 -0
- data/share/demo/cross_ref/cross_ref.c +21 -0
- data/share/demo/dangling_else/dangling_else.c +20 -0
- data/share/demo/dead_code/dead_code.c +237 -0
- data/share/demo/deep_nest/deep_nest.c +57 -0
- data/share/demo/dense_switch/dense_switch.c +62 -0
- data/share/demo/direct_recur/direct_recur.c +15 -0
- data/share/demo/div_by_zero/div_by_zero.c +35 -0
- data/share/demo/dos_source/dos_source.c +7 -0
- data/share/demo/funptr_cast/funptr_cast.c +26 -0
- data/share/demo/goto_stmt/goto_stmt.c +19 -0
- data/share/demo/id_hiding/id_hiding.c +19 -0
- data/share/demo/ill_defined/ill_defined.c +13 -0
- data/share/demo/implicit_conv/implicit_conv.c +60 -0
- data/share/demo/implicit_int/implicit_int.c +14 -0
- data/share/demo/incomplete_type/incomplete_type.c +49 -0
- data/share/demo/indirect_recur/indirect_recur_1.c +14 -0
- data/share/demo/indirect_recur/indirect_recur_1.h +7 -0
- data/share/demo/indirect_recur/indirect_recur_2.c +12 -0
- data/share/demo/indirect_recur/indirect_recur_2.h +6 -0
- data/share/demo/indirect_recur/indirect_recur_3.c +6 -0
- data/share/demo/indirect_recur/indirect_recur_3.h +6 -0
- data/share/demo/indirect_recur/indirect_recur_4.c +25 -0
- data/share/demo/intro_demo/intro_demo.c +76 -0
- data/share/demo/intro_demo/intro_demo.h +12 -0
- data/share/demo/intro_demo/useless_header.h +5 -0
- data/share/demo/invalid_call/invalid_call.c +32 -0
- data/share/demo/kandr_fundef/kandr_fundef.c +10 -0
- data/share/demo/line_comment/line_comment.c +12 -0
- data/share/demo/local_decl/local_decl.c +9 -0
- data/share/demo/logical_trick/logical_trick.c +36 -0
- data/share/demo/long_sym/long_sym.c +5 -0
- data/share/demo/loop_var/loop_var.c +92 -0
- data/share/demo/malloc_or_die/malloc_or_die.c +43 -0
- data/share/demo/may_be_null/may_be_null.c +52 -0
- data/share/demo/may_be_null_arith/may_be_null_arith.c +15 -0
- data/share/demo/may_be_unset/may_be_unset.c +34 -0
- data/share/demo/mmapped_io/mmapped_io.c +23 -0
- data/share/demo/multi_break/multi_break.c +33 -0
- data/share/demo/multi_decl/multi_decl_1.c +17 -0
- data/share/demo/multi_decl/multi_decl_1.h +6 -0
- data/share/demo/multi_decl/multi_decl_2.c +13 -0
- data/share/demo/multi_decl/multi_decl_2.h +6 -0
- data/share/demo/multi_decl/multi_decl_3.c +22 -0
- data/share/demo/multi_def/multi_def_1.c +36 -0
- data/share/demo/multi_def/multi_def_1.h +6 -0
- data/share/demo/multi_def/multi_def_2.c +22 -0
- data/share/demo/multi_def/multi_def_2.h +6 -0
- data/share/demo/multi_def/multi_def_3.c +6 -0
- data/share/demo/multi_typedef/multi_typedef.c +11 -0
- data/share/demo/multi_typedef/multi_typedef_1.h +1 -0
- data/share/demo/multi_typedef/multi_typedef_2.h +1 -0
- data/share/demo/must_be_false/must_be_false.c +53 -0
- data/share/demo/must_be_null/must_be_null.c +13 -0
- data/share/demo/must_be_null_arith/must_be_null_arith.c +14 -0
- data/share/demo/must_be_true/must_be_true.c +21 -0
- data/share/demo/no_eof_nl/no_eof_nl.c +4 -0
- data/share/demo/no_void_arg/no_void_arg.c +14 -0
- data/share/demo/null_stmt/null_stmt.c +19 -0
- data/share/demo/octal_const/octal_const.c +20 -0
- data/share/demo/output_by_param/output_by_param.c +17 -0
- data/share/demo/overflow/overflow.c +74 -0
- data/share/demo/press_release/press_release.c +40 -0
- data/share/demo/retn_lvar_addr/retn_lvar_addr.c +47 -0
- data/share/demo/shift_expr/shift_expr.c +14 -0
- data/share/demo/should_be_typedef/should_be_typedef.c +51 -0
- data/share/demo/static_paths/static_paths.c +153 -0
- data/share/demo/static_vars/static_vars.c +39 -0
- data/share/demo/tag_hiding/tag_hiding.c +18 -0
- data/share/demo/tricky_incdec/tricky_incdec.c +12 -0
- data/share/demo/undefined_macro/undefined_macro.c +17 -0
- data/share/demo/uninit_vars/uninit_vars.c +28 -0
- data/share/demo/union_type/union_type.c +23 -0
- data/share/demo/unmatch_decl/unmatch_decl_1.c +12 -0
- data/share/demo/unmatch_decl/unmatch_decl_1.h +8 -0
- data/share/demo/unmatch_decl/unmatch_decl_2.c +10 -0
- data/share/demo/unmatch_decl/unmatch_decl_2.h +8 -0
- data/share/demo/unmatch_decl/unmatch_decl_3.c +7 -0
- data/share/demo/unmatch_paren_macro/unmatch_paren_macro.c +15 -0
- data/share/demo/unreachable/unreachable.c +34 -0
- data/share/demo/useless_exp_funs/useless_exp_funs_1.c +14 -0
- data/share/demo/useless_exp_funs/useless_exp_funs_1.h +1 -0
- data/share/demo/useless_exp_funs/useless_exp_funs_2.c +6 -0
- data/share/demo/useless_exp_vars/useless_export_1.c +8 -0
- data/share/demo/useless_exp_vars/useless_export_1.h +1 -0
- data/share/demo/useless_exp_vars/useless_export_2.c +7 -0
- data/share/demo/useless_expr/useless_expr.c +17 -0
- data/share/demo/useless_funs/useless_funs_1.c +21 -0
- data/share/demo/useless_funs/useless_funs_1.h +8 -0
- data/share/demo/useless_funs/useless_funs_2.c +6 -0
- data/share/demo/useless_header/useless_header.c +9 -0
- data/share/demo/useless_header/useless_header_1.h +12 -0
- data/share/demo/useless_header/useless_header_2.h +6 -0
- data/share/demo/useless_header/useless_header_3.h +9 -0
- data/share/demo/useless_header/useless_header_4.h +3 -0
- data/share/demo/useless_vars/useless_vars.c +17 -0
- data/share/demo/va_funcall/va_funcall.c +25 -0
- data/share/demo/various_fundef/various_fundef.c +36 -0
- data/share/demo/wchar_wstring/wchar_wstring.c +7 -0
- data/share/demo/wrap_around/wrap_around.c +38 -0
- data/share/doc/Makefile +16 -0
- data/share/doc/adlint_on_adqua.png +0 -0
- data/share/doc/adlint_on_eclipse_en.png +0 -0
- data/share/doc/adlint_on_eclipse_ja.png +0 -0
- data/share/doc/adlint_on_vim_en.png +0 -0
- data/share/doc/adlint_on_vim_ja.png +0 -0
- data/share/doc/developers_guide_ja.html +171 -0
- data/share/doc/developers_guide_ja.texi +87 -0
- data/share/doc/gen_mesg_sections.rb +39 -0
- data/share/doc/samples/GNUmakefile +162 -0
- data/share/doc/samples/adlint_traits.yml +238 -0
- data/share/doc/texinfo.css +22 -0
- data/share/doc/users_guide_en.html +39975 -0
- data/share/doc/users_guide_en.texi +32640 -0
- data/share/doc/users_guide_ja.html +40505 -0
- data/share/doc/users_guide_ja.texi +33189 -0
- data/share/logo/adlint-110.png +0 -0
- data/share/logo/adlint-524.png +0 -0
- data/share/logo/adlint.svg +4637 -0
- data/share/sample/README +6 -0
- data/share/sample/bison-2.5/adlint/GNUmakefile +170 -0
- data/share/sample/bison-2.5/adlint/adlint_traits.yml +225 -0
- data/share/sample/bison-2.5/adlint/lib/GNUmakefile +198 -0
- data/share/sample/bison-2.5/adlint/lib/adlint_cinit.h +228 -0
- data/share/sample/bison-2.5/adlint/lib/adlint_pinit.h +21 -0
- data/share/sample/bison-2.5/adlint/lib/adlint_traits.yml +238 -0
- data/share/sample/bison-2.5/adlint/src/GNUmakefile +166 -0
- data/share/sample/bison-2.5/adlint/src/adlint_cinit.h +228 -0
- data/share/sample/bison-2.5/adlint/src/adlint_pinit.h +21 -0
- data/share/sample/bison-2.5/adlint/src/adlint_traits.yml +239 -0
- data/share/sample/ctags-5.8/adlint/GNUmakefile +169 -0
- data/share/sample/ctags-5.8/adlint/adlint_cinit.h +219 -0
- data/share/sample/ctags-5.8/adlint/adlint_pinit.h +13 -0
- data/share/sample/ctags-5.8/adlint/adlint_traits.yml +225 -0
- data/share/sample/flex-2.5.35/adlint/GNUmakefile +140 -0
- data/share/sample/flex-2.5.35/adlint/adlint_cinit.h +219 -0
- data/share/sample/flex-2.5.35/adlint/adlint_pinit.h +14 -0
- data/share/sample/flex-2.5.35/adlint/adlint_traits.yml +225 -0
- data/share/sample/ruby-1.9.3-p0/adlint/GNUmakefile +314 -0
- data/share/sample/ruby-1.9.3-p0/adlint/adlint_traits.yml +225 -0
- data/share/sample/ruby-1.9.3-p0/adlint/core/GNUmakefile +204 -0
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_pinit.h +28 -0
- data/share/sample/ruby-1.9.3-p0/adlint/core/adlint_traits.yml +240 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc/GNUmakefile +163 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc/adlint_traits.yml +240 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/GNUmakefile +149 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/enc-trans/adlint_traits.yml +240 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-bigdecimal/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-continuation/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-coverage/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-curses/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/GNUmakefile +134 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-date/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dbm/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-bubblebabble/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/GNUmakefile +132 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-md5/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/GNUmakefile +132 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-rmd160/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/GNUmakefile +132 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha1/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/GNUmakefile +132 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-digest-sha2/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/GNUmakefile +134 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/GNUmakefile +140 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-dl-callback/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-etc/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fcntl/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiber/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/GNUmakefile +134 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-fiddle/adlint_traits.yml +242 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-gdbm/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-iconv/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-console/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-nonblock/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-io-wait/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-generator/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-json-parser/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-complex/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-mathn-rational/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-nkf/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/GNUmakefile +162 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-openssl/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pathname/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/GNUmakefile +135 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-psych/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-pty/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-racc-cparse/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-readline/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-ripper/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/GNUmakefile +132 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-sdbm/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/GNUmakefile +144 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-socket/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-stringio/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-strscan/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/GNUmakefile +140 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syck/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-syslog/adlint_traits.yml +241 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/GNUmakefile +131 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_cinit.h +228 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_pinit.h +24 -0
- data/share/sample/ruby-1.9.3-p0/adlint/ext-zlib/adlint_traits.yml +241 -0
- data/share/sample/screen-4.0.3/adlint/GNUmakefile +162 -0
- data/share/sample/screen-4.0.3/adlint/adlint_cinit.h +228 -0
- data/share/sample/screen-4.0.3/adlint/adlint_pinit.h +21 -0
- data/share/sample/screen-4.0.3/adlint/adlint_traits.yml +238 -0
- data/share/sample/vim-7.3/adlint/vim/GNUmakefile +185 -0
- data/share/sample/vim-7.3/adlint/vim/adlint_cinit.h +228 -0
- data/share/sample/vim-7.3/adlint/vim/adlint_pinit.h +25 -0
- data/share/sample/vim-7.3/adlint/vim/adlint_traits.yml +250 -0
- data/share/sample/vim-7.3/adlint/xxd/GNUmakefile +131 -0
- data/share/sample/vim-7.3/adlint/xxd/adlint_cinit.h +228 -0
- data/share/sample/vim-7.3/adlint/xxd/adlint_pinit.h +24 -0
- data/share/sample/vim-7.3/adlint/xxd/adlint_traits.yml +237 -0
- data/share/sample/zsh-4.3.15/adlint/GNUmakefile +146 -0
- data/share/sample/zsh-4.3.15/adlint/adlint_traits.yml +225 -0
- data/share/sample/zsh-4.3.15/adlint/builtins/GNUmakefile +132 -0
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_cinit.h +228 -0
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_pinit.h +24 -0
- data/share/sample/zsh-4.3.15/adlint/builtins/adlint_traits.yml +240 -0
- data/share/sample/zsh-4.3.15/adlint/core/GNUmakefile +153 -0
- data/share/sample/zsh-4.3.15/adlint/core/adlint_cinit.h +228 -0
- data/share/sample/zsh-4.3.15/adlint/core/adlint_pinit.h +23 -0
- data/share/sample/zsh-4.3.15/adlint/core/adlint_traits.yml +239 -0
- data/share/sample/zsh-4.3.15/adlint/modules/GNUmakefile +147 -0
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_cinit.h +228 -0
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_pinit.h +24 -0
- data/share/sample/zsh-4.3.15/adlint/modules/adlint_traits.yml +240 -0
- data/share/sample/zsh-4.3.15/adlint/zle/GNUmakefile +144 -0
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_cinit.h +228 -0
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_pinit.h +24 -0
- data/share/sample/zsh-4.3.15/adlint/zle/adlint_traits.yml +239 -0
- data/spec/MUST_WRITE_SPECS_WITH_RSPEC +0 -0
- metadata +532 -0
@@ -0,0 +1,805 @@
|
|
1
|
+
# Code quality metrics.
|
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.
|
17
|
+
#
|
18
|
+
# AdLint is free software: you can redistribute it and/or modify it under the
|
19
|
+
# terms of the GNU General Public License as published by the Free Software
|
20
|
+
# Foundation, either version 3 of the License, or (at your option) any later
|
21
|
+
# version.
|
22
|
+
#
|
23
|
+
# AdLint is distributed in the hope that it will be useful, but WITHOUT ANY
|
24
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
25
|
+
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
26
|
+
#
|
27
|
+
# You should have received a copy of the GNU General Public License along with
|
28
|
+
# AdLint. If not, see <http://www.gnu.org/licenses/>.
|
29
|
+
#
|
30
|
+
#++
|
31
|
+
|
32
|
+
require "adlint/token"
|
33
|
+
require "adlint/code"
|
34
|
+
require "adlint/util"
|
35
|
+
|
36
|
+
module AdLint #:nodoc:
|
37
|
+
|
38
|
+
class CodeMetric
|
39
|
+
def to_a
|
40
|
+
subclass_responsibility
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_s
|
44
|
+
delim = ",".to_default_external
|
45
|
+
to_a.map { |obj| obj.to_s.to_default_external }.join(delim)
|
46
|
+
end
|
47
|
+
|
48
|
+
def to_csv
|
49
|
+
to_a.map { |obj| obj ? obj.to_s.to_default_external : nil }.to_csv
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class FL_STMT_Metric < CodeMetric
|
54
|
+
def initialize(fpath, statement_count)
|
55
|
+
@fpath = fpath
|
56
|
+
@statement_count = statement_count
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_a
|
60
|
+
["MET", "FL_STMT", @fpath, @statement_count]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class FL_FUNC_Metric < CodeMetric
|
65
|
+
def initialize(fpath, function_count)
|
66
|
+
@fpath = fpath
|
67
|
+
@function_count = function_count
|
68
|
+
end
|
69
|
+
|
70
|
+
def to_a
|
71
|
+
["MET", "FL_FUNC", @fpath, @function_count]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class FN_STMT_Metric < CodeMetric
|
76
|
+
def initialize(function_identifier, location, statement_count)
|
77
|
+
@function_identifier = function_identifier
|
78
|
+
@location = location
|
79
|
+
@statement_count = statement_count
|
80
|
+
end
|
81
|
+
|
82
|
+
def to_a
|
83
|
+
["MET", "FN_STMT",
|
84
|
+
@function_identifier.name, @function_identifier.signature,
|
85
|
+
@location.fpath, @location.line_no, @location.column_no,
|
86
|
+
@statement_count]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
class FN_UNRC_Metric < CodeMetric
|
91
|
+
def initialize(function_identifier, location, unreached_statement_count)
|
92
|
+
@function_identifier = function_identifier
|
93
|
+
@location = location
|
94
|
+
@unreached_statement_count = unreached_statement_count
|
95
|
+
end
|
96
|
+
|
97
|
+
def to_a
|
98
|
+
["MET", "FN_UNRC",
|
99
|
+
@function_identifier.name, @function_identifier.signature,
|
100
|
+
@location.fpath, @location.line_no, @location.column_no,
|
101
|
+
@unreached_statement_count]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class FN_LINE_Metric < CodeMetric
|
106
|
+
def initialize(function_identifier, location, total_lines)
|
107
|
+
@function_identifier = function_identifier
|
108
|
+
@location = location
|
109
|
+
@total_lines = total_lines
|
110
|
+
end
|
111
|
+
|
112
|
+
def to_a
|
113
|
+
["MET", "FN_LINE",
|
114
|
+
@function_identifier.name, @function_identifier.signature,
|
115
|
+
@location.fpath, @location.line_no, @location.column_no,
|
116
|
+
@total_lines]
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
class FN_PARA_Metric < CodeMetric
|
121
|
+
def initialize(function_identifier, location, parameter_count)
|
122
|
+
@function_identifier = function_identifier
|
123
|
+
@location = location
|
124
|
+
@parameter_count = parameter_count
|
125
|
+
end
|
126
|
+
|
127
|
+
def to_a
|
128
|
+
["MET", "FN_PARA",
|
129
|
+
@function_identifier.name, @function_identifier.signature,
|
130
|
+
@location.fpath, @location.line_no, @location.column_no,
|
131
|
+
@parameter_count]
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class FN_UNUV_Metric < CodeMetric
|
136
|
+
def initialize(function_identifier, location, useless_variable_count)
|
137
|
+
@function_identifier = function_identifier
|
138
|
+
@location = location
|
139
|
+
@useless_variable_count = useless_variable_count
|
140
|
+
end
|
141
|
+
|
142
|
+
def to_a
|
143
|
+
["MET", "FN_UNUV",
|
144
|
+
@function_identifier.name, @function_identifier.signature,
|
145
|
+
@location.fpath, @location.line_no, @location.column_no,
|
146
|
+
@useless_variable_count]
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
class FN_CSUB_Metric < CodeMetric
|
151
|
+
def initialize(function_identifier, location, function_call_count)
|
152
|
+
@function_identifier = function_identifier
|
153
|
+
@location = location
|
154
|
+
@function_call_count = function_call_count
|
155
|
+
end
|
156
|
+
|
157
|
+
def to_a
|
158
|
+
["MET", "FN_CSUB",
|
159
|
+
@function_identifier.name, @function_identifier.signature,
|
160
|
+
@location.fpath, @location.line_no, @location.column_no,
|
161
|
+
@function_call_count]
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
class FN_GOTO_Metric < CodeMetric
|
166
|
+
def initialize(function_identifier, location, goto_count)
|
167
|
+
@function_identifier = function_identifier
|
168
|
+
@location = location
|
169
|
+
@goto_count = goto_count
|
170
|
+
end
|
171
|
+
|
172
|
+
def to_a
|
173
|
+
["MET", "FN_GOTO",
|
174
|
+
@function_identifier.name, @function_identifier.signature,
|
175
|
+
@location.fpath, @location.line_no, @location.column_no,
|
176
|
+
@goto_count]
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
class FN_RETN_Metric < CodeMetric
|
181
|
+
def initialize(function_identifier, location, return_count)
|
182
|
+
@function_identifier = function_identifier
|
183
|
+
@location = location
|
184
|
+
@return_count = return_count
|
185
|
+
end
|
186
|
+
|
187
|
+
def to_a
|
188
|
+
["MET", "FN_RETN",
|
189
|
+
@function_identifier.name, @function_identifier.signature,
|
190
|
+
@location.fpath, @location.line_no, @location.column_no,
|
191
|
+
@return_count]
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
class FN_UELS_Metric < CodeMetric
|
196
|
+
def initialize(function_identifier, location, if_statement_count)
|
197
|
+
@function_identifier = function_identifier
|
198
|
+
@location = location
|
199
|
+
@if_statement_count = if_statement_count
|
200
|
+
end
|
201
|
+
|
202
|
+
def to_a
|
203
|
+
["MET", "FN_UELS",
|
204
|
+
@function_identifier.name, @function_identifier.signature,
|
205
|
+
@location.fpath, @location.line_no, @location.column_no,
|
206
|
+
@if_statement_count]
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
class FN_NEST_Metric < CodeMetric
|
211
|
+
def initialize(function_identifier, location, max_nest_level)
|
212
|
+
@function_identifier = function_identifier
|
213
|
+
@location = location
|
214
|
+
@max_nest_level = max_nest_level
|
215
|
+
end
|
216
|
+
|
217
|
+
def to_a
|
218
|
+
["MET", "FN_NEST",
|
219
|
+
@function_identifier.name, @function_identifier.signature,
|
220
|
+
@location.fpath, @location.line_no, @location.column_no,
|
221
|
+
@max_nest_level]
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
class FN_PATH_Metric < CodeMetric
|
226
|
+
def initialize(function_identifier, location, path_count)
|
227
|
+
@function_identifier = function_identifier
|
228
|
+
@location = location
|
229
|
+
@path_count = path_count
|
230
|
+
end
|
231
|
+
|
232
|
+
def to_a
|
233
|
+
["MET", "FN_PATH",
|
234
|
+
@function_identifier.name, @function_identifier.signature,
|
235
|
+
@location.fpath, @location.line_no, @location.column_no,
|
236
|
+
@path_count]
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
class FN_CYCM_Metric < CodeMetric
|
241
|
+
def initialize(function_identifier, location, cyclomatic_complexity)
|
242
|
+
@function_identifier = function_identifier
|
243
|
+
@location = location
|
244
|
+
@cyclomatic_complexity = cyclomatic_complexity
|
245
|
+
end
|
246
|
+
|
247
|
+
def to_a
|
248
|
+
["MET", "FN_CYCM",
|
249
|
+
@function_identifier.name, @function_identifier.signature,
|
250
|
+
@location.fpath, @location.line_no, @location.column_no,
|
251
|
+
@cyclomatic_complexity]
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class FN_CALL_Metric < CodeMetric
|
256
|
+
def initialize(function_identifier, location, caller_count)
|
257
|
+
@function_identifier = function_identifier
|
258
|
+
@location = location
|
259
|
+
@caller_count = caller_count
|
260
|
+
end
|
261
|
+
|
262
|
+
def to_a
|
263
|
+
["MET", "FN_CALL",
|
264
|
+
@function_identifier.name, @function_identifier.signature,
|
265
|
+
@location.fpath, @location.line_no, @location.column_no,
|
266
|
+
@caller_count]
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
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
|
+
class MetricRecord < CsvRecord
|
296
|
+
def self.of(csv_row)
|
297
|
+
case csv_row[0]
|
298
|
+
when "VER"
|
299
|
+
create_version_record(csv_row)
|
300
|
+
when "DCL"
|
301
|
+
create_declaration_record(csv_row)
|
302
|
+
when "DEF"
|
303
|
+
create_definition_record(csv_row)
|
304
|
+
when "INI"
|
305
|
+
create_initialization_record(csv_row)
|
306
|
+
when "ASN"
|
307
|
+
create_assignment_record(csv_row)
|
308
|
+
when "DEP"
|
309
|
+
create_dependency_record(csv_row)
|
310
|
+
when "LIT"
|
311
|
+
create_literal_record(csv_row)
|
312
|
+
when "PRE"
|
313
|
+
create_pp_directive_record(csv_row)
|
314
|
+
when "MET"
|
315
|
+
create_metric_record(csv_row)
|
316
|
+
else
|
317
|
+
raise "invalid metric record."
|
318
|
+
end
|
319
|
+
end
|
320
|
+
|
321
|
+
def type
|
322
|
+
field_at(0)
|
323
|
+
end
|
324
|
+
|
325
|
+
def fpath
|
326
|
+
Pathname.new(field_at(1))
|
327
|
+
end
|
328
|
+
|
329
|
+
def line_no
|
330
|
+
field_at(2)
|
331
|
+
end
|
332
|
+
|
333
|
+
def column_no
|
334
|
+
field_at(3)
|
335
|
+
end
|
336
|
+
|
337
|
+
def location
|
338
|
+
Location.new(fpath, line_no, column_no)
|
339
|
+
end
|
340
|
+
|
341
|
+
def version?; false end
|
342
|
+
|
343
|
+
def typedef_declaration?; false end
|
344
|
+
|
345
|
+
def struct_declaration?; false end
|
346
|
+
|
347
|
+
def union_declaration?; false end
|
348
|
+
|
349
|
+
def enum_declaration?; false end
|
350
|
+
|
351
|
+
def global_variable_declaration?; false end
|
352
|
+
|
353
|
+
def function_declaration?; false end
|
354
|
+
|
355
|
+
def variable_definition?; false end
|
356
|
+
|
357
|
+
def function_definition?; false end
|
358
|
+
|
359
|
+
def macro_definition?; false end
|
360
|
+
|
361
|
+
def label_definition?; false end
|
362
|
+
|
363
|
+
def initialization?; false end
|
364
|
+
|
365
|
+
def assignment?; false end
|
366
|
+
|
367
|
+
def include?; false end
|
368
|
+
|
369
|
+
def function_call?; false end
|
370
|
+
|
371
|
+
def variable_xref?; false end
|
372
|
+
|
373
|
+
def function_xref?; false end
|
374
|
+
|
375
|
+
def literal?; false end
|
376
|
+
|
377
|
+
def pp_directive?; false end
|
378
|
+
|
379
|
+
def self.create_version_record(csv_row)
|
380
|
+
VersionRecord.new(csv_row)
|
381
|
+
end
|
382
|
+
private_class_method :create_version_record
|
383
|
+
|
384
|
+
def self.create_declaration_record(csv_row)
|
385
|
+
case csv_row[4]
|
386
|
+
when "T"
|
387
|
+
case csv_row[5]
|
388
|
+
when "T"
|
389
|
+
TypedefDeclarationRecord.new(csv_row)
|
390
|
+
when "S"
|
391
|
+
StructDeclarationRecord.new(csv_row)
|
392
|
+
when "U"
|
393
|
+
UnionDeclarationRecord.new(csv_row)
|
394
|
+
when "E"
|
395
|
+
EnumDeclarationRecord.new(csv_row)
|
396
|
+
else
|
397
|
+
raise "invalid DCL record."
|
398
|
+
end
|
399
|
+
when "V"
|
400
|
+
GlobalVariableDeclarationRecord.new(csv_row)
|
401
|
+
when "F"
|
402
|
+
FunctionDeclarationRecord.new(csv_row)
|
403
|
+
else
|
404
|
+
raise "invalid DCL record."
|
405
|
+
end
|
406
|
+
end
|
407
|
+
private_class_method :create_declaration_record
|
408
|
+
|
409
|
+
def self.create_definition_record(csv_row)
|
410
|
+
case csv_row[4]
|
411
|
+
when "V"
|
412
|
+
VariableDefinitionRecord.new(csv_row)
|
413
|
+
when "F"
|
414
|
+
FunctionDefinitionRecord.new(csv_row)
|
415
|
+
when "M"
|
416
|
+
MacroDefinitionRecord.new(csv_row)
|
417
|
+
when "L"
|
418
|
+
LabelDefinitionRecord.new(csv_row)
|
419
|
+
else
|
420
|
+
raise "invalid DEF record."
|
421
|
+
end
|
422
|
+
end
|
423
|
+
private_class_method :create_definition_record
|
424
|
+
|
425
|
+
def self.create_initialization_record(csv_row)
|
426
|
+
InitializationRecord.new(csv_row)
|
427
|
+
end
|
428
|
+
private_class_method :create_initialization_record
|
429
|
+
|
430
|
+
def self.create_assignment_record(csv_row)
|
431
|
+
AssignmentRecord.new(csv_row)
|
432
|
+
end
|
433
|
+
private_class_method :create_assignment_record
|
434
|
+
|
435
|
+
def self.create_dependency_record(csv_row)
|
436
|
+
case csv_row[4]
|
437
|
+
when "I"
|
438
|
+
IncludeRecord.new(csv_row)
|
439
|
+
when "C"
|
440
|
+
FunctionCallRecord.new(csv_row)
|
441
|
+
when "X"
|
442
|
+
case csv_row[5]
|
443
|
+
when "V"
|
444
|
+
VariableXRefRecord.new(csv_row)
|
445
|
+
when "F"
|
446
|
+
FunctionXRefRecord.new(csv_row)
|
447
|
+
else
|
448
|
+
raise "invalid DEP record."
|
449
|
+
end
|
450
|
+
else
|
451
|
+
raise "invalid DEP record."
|
452
|
+
end
|
453
|
+
end
|
454
|
+
private_class_method :create_dependency_record
|
455
|
+
|
456
|
+
def self.create_literal_record(csv_row)
|
457
|
+
LiteralRecord.new(csv_row)
|
458
|
+
end
|
459
|
+
private_class_method :create_literal_record
|
460
|
+
|
461
|
+
def self.create_pp_directive_record(csv_row)
|
462
|
+
PPDirectiveRecord.new(csv_row)
|
463
|
+
end
|
464
|
+
private_class_method :create_pp_directive_record
|
465
|
+
|
466
|
+
def self.create_metric_record(csv_row)
|
467
|
+
MetricRecord.new(csv_row)
|
468
|
+
end
|
469
|
+
private_class_method :create_metric_record
|
470
|
+
|
471
|
+
class VersionRecord < MetricRecord
|
472
|
+
def version?
|
473
|
+
true
|
474
|
+
end
|
475
|
+
|
476
|
+
def version_number
|
477
|
+
field_at(1)
|
478
|
+
end
|
479
|
+
|
480
|
+
def exec_timestamp
|
481
|
+
field_at(2)
|
482
|
+
end
|
483
|
+
end
|
484
|
+
private_constant :VersionRecord
|
485
|
+
|
486
|
+
class TypedefDeclarationRecord < MetricRecord
|
487
|
+
def typedef_declaration?
|
488
|
+
true
|
489
|
+
end
|
490
|
+
|
491
|
+
def typedcl_type
|
492
|
+
field_at(5)
|
493
|
+
end
|
494
|
+
|
495
|
+
def type_name
|
496
|
+
field_at(6)
|
497
|
+
end
|
498
|
+
|
499
|
+
def type_rep
|
500
|
+
field_at(7)
|
501
|
+
end
|
502
|
+
end
|
503
|
+
private_constant :TypedefDeclarationRecord
|
504
|
+
|
505
|
+
class StructDeclarationRecord < MetricRecord
|
506
|
+
def struct_declaration?
|
507
|
+
true
|
508
|
+
end
|
509
|
+
|
510
|
+
def typedcl_type
|
511
|
+
field_at(5)
|
512
|
+
end
|
513
|
+
|
514
|
+
def type_name
|
515
|
+
field_at(6)
|
516
|
+
end
|
517
|
+
|
518
|
+
def type_rep
|
519
|
+
field_at(7)
|
520
|
+
end
|
521
|
+
end
|
522
|
+
private_constant :StructDeclarationRecord
|
523
|
+
|
524
|
+
class UnionDeclarationRecord < MetricRecord
|
525
|
+
def union_declaration?
|
526
|
+
true
|
527
|
+
end
|
528
|
+
|
529
|
+
def typedcl_type
|
530
|
+
field_at(5)
|
531
|
+
end
|
532
|
+
|
533
|
+
def type_name
|
534
|
+
field_at(6)
|
535
|
+
end
|
536
|
+
|
537
|
+
def type_rep
|
538
|
+
field_at(7)
|
539
|
+
end
|
540
|
+
end
|
541
|
+
private_constant :UnionDeclarationRecord
|
542
|
+
|
543
|
+
class EnumDeclarationRecord < MetricRecord
|
544
|
+
def enum_declaration?
|
545
|
+
true
|
546
|
+
end
|
547
|
+
|
548
|
+
def typedcl_type
|
549
|
+
field_at(5)
|
550
|
+
end
|
551
|
+
|
552
|
+
def type_name
|
553
|
+
field_at(6)
|
554
|
+
end
|
555
|
+
|
556
|
+
def type_rep
|
557
|
+
field_at(7)
|
558
|
+
end
|
559
|
+
end
|
560
|
+
private_constant :EnumDeclarationRecord
|
561
|
+
|
562
|
+
class GlobalVariableDeclarationRecord < MetricRecord
|
563
|
+
def global_variable_declaration?
|
564
|
+
true
|
565
|
+
end
|
566
|
+
|
567
|
+
def variable_name
|
568
|
+
field_at(5)
|
569
|
+
end
|
570
|
+
|
571
|
+
def type_rep
|
572
|
+
field_at(6)
|
573
|
+
end
|
574
|
+
end
|
575
|
+
private_constant :GlobalVariableDeclarationRecord
|
576
|
+
|
577
|
+
class FunctionDeclarationRecord < MetricRecord
|
578
|
+
def function_declaration?
|
579
|
+
true
|
580
|
+
end
|
581
|
+
|
582
|
+
def function_linkage_type
|
583
|
+
field_at(5)
|
584
|
+
end
|
585
|
+
|
586
|
+
def function_scope_type
|
587
|
+
field_at(6)
|
588
|
+
end
|
589
|
+
|
590
|
+
def function_identifier
|
591
|
+
FunctionIdentifier.new(field_at(7), field_at(8))
|
592
|
+
end
|
593
|
+
end
|
594
|
+
private_constant :FunctionDeclarationRecord
|
595
|
+
|
596
|
+
class VariableDefinitionRecord < MetricRecord
|
597
|
+
def variable_definition?
|
598
|
+
true
|
599
|
+
end
|
600
|
+
|
601
|
+
def var_linkage_type
|
602
|
+
field_at(5)
|
603
|
+
end
|
604
|
+
|
605
|
+
def var_scope_type
|
606
|
+
field_at(6)
|
607
|
+
end
|
608
|
+
|
609
|
+
def storage_class_type
|
610
|
+
field_at(7)
|
611
|
+
end
|
612
|
+
|
613
|
+
def variable_name
|
614
|
+
field_at(8)
|
615
|
+
end
|
616
|
+
|
617
|
+
def type_rep
|
618
|
+
field_at(9)
|
619
|
+
end
|
620
|
+
end
|
621
|
+
private_constant :VariableDefinitionRecord
|
622
|
+
|
623
|
+
class FunctionDefinitionRecord < MetricRecord
|
624
|
+
def function_definition?
|
625
|
+
true
|
626
|
+
end
|
627
|
+
|
628
|
+
def function_linkage_type
|
629
|
+
field_at(5)
|
630
|
+
end
|
631
|
+
|
632
|
+
def function_scope_type
|
633
|
+
field_at(6)
|
634
|
+
end
|
635
|
+
|
636
|
+
def function_identifier
|
637
|
+
FunctionIdentifier.new(field_at(7), field_at(8))
|
638
|
+
end
|
639
|
+
|
640
|
+
def lines
|
641
|
+
field_at(9)
|
642
|
+
end
|
643
|
+
end
|
644
|
+
private_constant :FunctionDefinitionRecord
|
645
|
+
|
646
|
+
class MacroDefinitionRecord < MetricRecord
|
647
|
+
def macro_definition?
|
648
|
+
true
|
649
|
+
end
|
650
|
+
|
651
|
+
def macro_name
|
652
|
+
field_at(5)
|
653
|
+
end
|
654
|
+
|
655
|
+
def macro_type
|
656
|
+
field_at(6)
|
657
|
+
end
|
658
|
+
end
|
659
|
+
private_constant :MacroDefinitionRecord
|
660
|
+
|
661
|
+
class LabelDefinitionRecord < MetricRecord
|
662
|
+
def label_definition?
|
663
|
+
true
|
664
|
+
end
|
665
|
+
|
666
|
+
def label_name
|
667
|
+
field_at(5)
|
668
|
+
end
|
669
|
+
end
|
670
|
+
private_constant :LabelDefinitionRecord
|
671
|
+
|
672
|
+
class InitializationRecord < MetricRecord
|
673
|
+
def initialization?
|
674
|
+
true
|
675
|
+
end
|
676
|
+
|
677
|
+
def variable_name
|
678
|
+
field_at(4)
|
679
|
+
end
|
680
|
+
|
681
|
+
def initializer_rep
|
682
|
+
field_at(5)
|
683
|
+
end
|
684
|
+
end
|
685
|
+
private_constant :InitializationRecord
|
686
|
+
|
687
|
+
class AssignmentRecord < MetricRecord
|
688
|
+
def assignment?
|
689
|
+
true
|
690
|
+
end
|
691
|
+
|
692
|
+
def variable_name
|
693
|
+
field_at(4)
|
694
|
+
end
|
695
|
+
|
696
|
+
def assignment_rep
|
697
|
+
field_at(5)
|
698
|
+
end
|
699
|
+
end
|
700
|
+
private_constant :AssignmentRecord
|
701
|
+
|
702
|
+
class IncludeRecord < MetricRecord
|
703
|
+
def include?
|
704
|
+
true
|
705
|
+
end
|
706
|
+
|
707
|
+
def included_fpath
|
708
|
+
Pathname.new(field_at(5))
|
709
|
+
end
|
710
|
+
end
|
711
|
+
private_constant :IncludeRecord
|
712
|
+
|
713
|
+
class FunctionCallRecord < MetricRecord
|
714
|
+
def function_call?
|
715
|
+
true
|
716
|
+
end
|
717
|
+
|
718
|
+
def caller_function
|
719
|
+
FunctionIdentifier.new(field_at(5), field_at(6))
|
720
|
+
end
|
721
|
+
|
722
|
+
def callee_function
|
723
|
+
FunctionIdentifier.new(field_at(7), field_at(8))
|
724
|
+
end
|
725
|
+
end
|
726
|
+
private_constant :FunctionCallRecord
|
727
|
+
|
728
|
+
class VariableXRefRecord < MetricRecord
|
729
|
+
def variable_xref?
|
730
|
+
true
|
731
|
+
end
|
732
|
+
|
733
|
+
def accessor_function
|
734
|
+
FunctionIdentifier.new(field_at(6), field_at(7))
|
735
|
+
end
|
736
|
+
|
737
|
+
def access_type
|
738
|
+
field_at(8)
|
739
|
+
end
|
740
|
+
|
741
|
+
def accessee_variable
|
742
|
+
field_at(9)
|
743
|
+
end
|
744
|
+
end
|
745
|
+
private_constant :VariableXRefRecord
|
746
|
+
|
747
|
+
class FunctionXRefRecord < MetricRecord
|
748
|
+
def function_xref?
|
749
|
+
true
|
750
|
+
end
|
751
|
+
|
752
|
+
def accessor_function
|
753
|
+
FunctionIdentifier.new(field_at(6), field_at(7))
|
754
|
+
end
|
755
|
+
|
756
|
+
def access_type
|
757
|
+
field_at(8)
|
758
|
+
end
|
759
|
+
|
760
|
+
def accessee_function
|
761
|
+
FunctionIdentifier.new(field_at(9), field_at(10))
|
762
|
+
end
|
763
|
+
end
|
764
|
+
private_constant :FunctionXRefRecord
|
765
|
+
|
766
|
+
class LiteralRecord < MetricRecord
|
767
|
+
def literal?
|
768
|
+
true
|
769
|
+
end
|
770
|
+
|
771
|
+
def literal_type
|
772
|
+
field_at(4)
|
773
|
+
end
|
774
|
+
|
775
|
+
def literal_prefix
|
776
|
+
field_at(5)
|
777
|
+
end
|
778
|
+
|
779
|
+
def literal_suffix
|
780
|
+
field_at(6)
|
781
|
+
end
|
782
|
+
|
783
|
+
def literal_value
|
784
|
+
field_at(7)
|
785
|
+
end
|
786
|
+
end
|
787
|
+
private_constant :LiteralRecord
|
788
|
+
|
789
|
+
class PPDirectiveRecord < MetricRecord
|
790
|
+
def pp_directive?
|
791
|
+
true
|
792
|
+
end
|
793
|
+
|
794
|
+
def pp_directive
|
795
|
+
field_at(4)
|
796
|
+
end
|
797
|
+
|
798
|
+
def pp_tokens
|
799
|
+
field_at(5)
|
800
|
+
end
|
801
|
+
end
|
802
|
+
private_constant :PPDirectiveRecord
|
803
|
+
end
|
804
|
+
|
805
|
+
end
|