module AdLint::ReportUtil
Public Instance Methods
DESCRIPTION¶ ↑
Creates a context message.
Abbreviation below is available.
create_context_message(msg_name, loc, ...) => C(msg_name, loc, ...)
PARAMETER¶ ↑
- msg_name
- loc
- parts
RETURN VALUE¶ ↑
ContextMessage
– New context message.
# File lib/adlint/report.rb, line 205 def create_context_message(msg_name, loc, *parts) ContextMessage.new(message_catalog, msg_name, self.class, loc, *parts) end
# File lib/adlint/report.rb, line 465 def write_FL_FUNC(fpath, fun_cnt) write_code_metric(FL_FUNC_Metric.new(fpath, fun_cnt)) end
# File lib/adlint/report.rb, line 460 def write_FL_STMT(fpath, stmt_cnt) write_code_metric(FL_STMT_Metric.new(fpath, stmt_cnt)) end
# File lib/adlint/report.rb, line 530 def write_FN_CALL(fun_sig, loc, caller_cnt) write_code_metric(FN_CALL_Metric.new(fun_sig, loc, caller_cnt)) end
# File lib/adlint/report.rb, line 495 def write_FN_CSUB(fun_id, loc, funcall_cnt) write_code_metric(FN_CSUB_Metric.new(fun_id, loc, funcall_cnt)) end
# File lib/adlint/report.rb, line 525 def write_FN_CYCM(fun_id, loc, cycl_compl) write_code_metric(FN_CYCM_Metric.new(fun_id, loc, cycl_compl)) end
# File lib/adlint/report.rb, line 500 def write_FN_GOTO(fun_id, loc, goto_cnt) write_code_metric(FN_GOTO_Metric.new(fun_id, loc, goto_cnt)) end
# File lib/adlint/report.rb, line 480 def write_FN_LINE(fun_id, loc, fun_lines) write_code_metric(FN_LINE_Metric.new(fun_id, loc, fun_lines)) end
# File lib/adlint/report.rb, line 515 def write_FN_NEST(fun_id, loc, max_nest) write_code_metric(FN_NEST_Metric.new(fun_id, loc, max_nest)) end
# File lib/adlint/report.rb, line 485 def write_FN_PARA(fun_id, loc, param_cnt) write_code_metric(FN_PARA_Metric.new(fun_id, loc, param_cnt)) end
# File lib/adlint/report.rb, line 520 def write_FN_PATH(fun_id, loc, path_cnt) write_code_metric(FN_PATH_Metric.new(fun_id, loc, path_cnt)) end
# File lib/adlint/report.rb, line 505 def write_FN_RETN(fun_id, loc, ret_cnt) write_code_metric(FN_RETN_Metric.new(fun_id, loc, ret_cnt)) end
# File lib/adlint/report.rb, line 470 def write_FN_STMT(fun_id, loc, stmt_cnt) write_code_metric(FN_STMT_Metric.new(fun_id, loc, stmt_cnt)) end
# File lib/adlint/report.rb, line 510 def write_FN_UELS(fun_id, loc, if_stmt_cnt) write_code_metric(FN_UELS_Metric.new(fun_id, loc, if_stmt_cnt)) end
# File lib/adlint/report.rb, line 475 def write_FN_UNRC(fun_id, loc, unreached_stmt_cnt) write_code_metric(FN_UNRC_Metric.new(fun_id, loc, unreached_stmt_cnt)) end
# File lib/adlint/report.rb, line 490 def write_FN_UNUV(fun_id, loc, useless_var_cnt) write_code_metric(FN_UNUV_Metric.new(fun_id, loc, useless_var_cnt)) end
DESCRIPTION¶ ↑
Writes an assignment information on the report.
Abbreviation below is available.
write_assignment(...) => ASSIGNMENT(...)
PARAMETER¶ ↑
- loc
- var_name
-
String
– Assigned variable name. - assign_rep
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 375 def write_assignment(loc, var_name, assign_rep) write_code_struct(Assignment.new(loc, var_name, assign_rep)) end
DESCRIPTION¶ ↑
Writes an error message on the report.
Abbreviation below is available.
write_error_message(msg_name, loc, ...) => E(msg_name, loc, ...)
PARAMETER¶ ↑
- msg_name
- loc
- parts
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 155 def write_error_message(msg_name, loc, *parts) report.write_message( ErrorMessage.new(message_catalog, msg_name, loc, *parts)) end
DESCRIPTION¶ ↑
Writes a function call information on the report.
Abbreviation below is available.
write_funcall(...) => FUNCALL(...)
PARAMETER¶ ↑
- loc
- caller_fun
-
FunctionId
– Calling function identifier. - callee_fun
-
FunctionId
– Called function identifier.
# File lib/adlint/report.rb, line 407 def write_funcall(loc, caller_fun, callee_fun) write_code_struct(Funcall.new(loc, caller_fun, callee_fun)) end
DESCRIPTION¶ ↑
Writes a function declaration information on the report.
Abbreviation below is available.
write_fundcl(...) => FUNDCL(...)
PARAMETER¶ ↑
- loc
- linkage
-
String
– Function linkage type string. - scope_type
-
String
– Declaration scope type string. - dcl_type
-
String
– Declaration type string. - fun_id
-
FunctionId
– Identifier of the function.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 262 def write_fundcl(loc, linkage, scope_type, dcl_type, fun_id) write_code_struct(FunDcl.new(loc, linkage, scope_type, dcl_type, fun_id)) end
DESCRIPTION¶ ↑
Writes a function definition information on the report.
Abbreviation below is available.
write_fundef(...) => FUNDEF(...)
PARAMETER¶ ↑
- loc
- linkage
-
String
– Function linkage type string. - scope_type
-
String
– Definition scope type string. - fun_id
-
FunctionId
– Identifier of the function. - lines
-
Integer
– Physical lines.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 304 def write_fundef(loc, linkage, scope_type, fun_id, lines) write_code_struct(FunDef.new(loc, linkage, scope_type, fun_id, lines)) end
DESCRIPTION¶ ↑
Writes a global variable decaration information on the report.
Abbreviation below is available.
write_gvardcl(...) => GVARDCL(...)
PARAMETER¶ ↑
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 242 def write_gvardcl(loc, var_name, type_rep) write_code_struct(GVarDcl.new(loc, var_name, type_rep)) end
DESCRIPTION¶ ↑
Writes a header include information on the report.
Abbreviation below is available.
write_include(...) => INCLUDE(...)
PARAMETER¶ ↑
- loc
- fpath
-
Pathname
– Path name of the included file.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 392 def write_include(loc, fpath) write_code_struct(Include.new(loc, fpath)) end
DESCRIPTION¶ ↑
Writes an initialization information on the report.
Abbreviation below is available.
write_initialization(...) => INITIALIZATION(...)
PARAMETER¶ ↑
- loc
- var_name
-
String
– Initialized variable name. - init_rep
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 357 def write_initialization(loc, var_name, init_rep) write_code_struct(Initialization.new(loc, var_name, init_rep)) end
DESCRIPTION¶ ↑
Writes a label definition information on the report.
Abbreviation below is available.
write_labeldef(...) => LABELDEF(...)
PARAMETER¶ ↑
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 339 def write_labeldef(loc, label_name) write_code_struct(LabelDef.new(loc, label_name)) end
# File lib/adlint/report.rb, line 450 def write_literal(loc, lit_type, prefix, suffix, value) write_code_struct(Literal.new(loc, lit_type, prefix, suffix, value)) end
DESCRIPTION¶ ↑
Writes a macro definition information on the report.
Abbreviation below is available.
write_macrodef(...) => MACRODEF(...)
PARAMETER¶ ↑
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 322 def write_macrodef(loc, macro_name, macro_type) write_code_struct(MacroDef.new(loc, macro_name, macro_type)) end
# File lib/adlint/report.rb, line 455 def write_pp_directive(loc, pp_dire, pp_tokens) write_code_struct(PPDirective.new(loc, pp_dire, pp_tokens)) end
DESCRIPTION¶ ↑
Writes a type declaration information on the report.
Abbreviation below is available.
write_typedcl(...) => TYPEDCL(...)
PARAMETER¶ ↑
- loc
- dcl_type
-
String
– Type declaration type. - type_name
-
String
– Type name. - type_rep
-
String
– Type representation string.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 224 def write_typedcl(loc, dcl_type, type_name, type_rep) write_code_struct(TypeDcl.new(loc, dcl_type, type_name, type_rep)) end
DESCRIPTION¶ ↑
Writes a variable definition information on the report.
Abbreviation below is available.
write_vardef(...) => VARDEF(...)
PARAMETER¶ ↑
- loc
- linkage_type
-
String
– Variable linkage type string. - scope_type
-
String
– Variable scope type string. - sc_type
-
String
– Variable storage class type. - var_name
-
String
– Variable name. - type_rep
-
String
– Variable type representation string.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 283 def write_vardef(loc, linkage, scope_type, sc_type, var_name, type_rep) write_code_struct(VarDef.new(loc, linkage, scope_type, sc_type, var_name, type_rep)) end
DESCRIPTION¶ ↑
Writes a warning message on the report.
Abbreviation below is available.
write_warning_message(loc, ...) => W(loc, ...)
PARAMETER¶ ↑
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 172 def write_warning_message(*args) check_class = self.class check_class = check_class.outer_module until check_class < CodeCheck head_msg = nil args.chunk { |arg| arg.kind_of?(Message) }.each do |*, chunk| case chunk.first when Message if head_msg chunk.each { |ctxt_msg| head_msg.complement_with(ctxt_msg) } end else head_msg = WarningMessage.new(message_catalog, check_class, *chunk) end end report.write_message(head_msg, suppressors) if head_msg end
DESCRIPTION¶ ↑
Writes a function cross reference information on the report.
Abbreviation below is available.
write_xref_function(...) => XREF_FUN(...)
PARAMETER¶ ↑
- loc
- referrer
-
FunctionId
– Accessing function identifier. - ref_type
-
String
– Access type string. - fun
-
FunctionId
– Accessed function identifier.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 445 def write_xref_function(loc, referrer, ref_type, fun) write_code_struct(XRefFun.new(loc, referrer, ref_type, fun)) end
DESCRIPTION¶ ↑
Writes a variable cross reference information on the report.
Abbreviation below is available.
write_xref_variable(...) => XREF_VAR(...)
PARAMETER¶ ↑
- loc
- referrer
-
FunctionId
– Accessing function identifier. - ref_type
-
String
– Access type string. - var_name
-
String
– Accessed variable name.
RETURN VALUE¶ ↑
None.
# File lib/adlint/report.rb, line 426 def write_xref_variable(loc, referrer, ref_type, var_name) write_code_struct(XRefVar.new(loc, referrer, ref_type, var_name)) end
Private Instance Methods
# File lib/adlint/report.rb, line 541 def write_code_metric(code_metric) report.write_code_metric(code_metric) nil end
# File lib/adlint/report.rb, line 536 def write_code_struct(code_struct) report.write_code_struct(code_struct) nil end