Module: AdLint::ReportUtil
- Included in:
- Cpp::Preprocessor, Examination
- Defined in:
- lib/adlint/report.rb
Instance Method Summary collapse
-
#create_context_message(msg_name, loc, *parts) ⇒ Object
(also: #C)
DESCRIPTION Creates a context message.
-
#write_assignment(loc, var_name, assign_rep) ⇒ Object
(also: #ASSIGNMENT)
DESCRIPTION Writes an assignment information on the report.
-
#write_error_message(msg_name, loc, *parts) ⇒ Object
(also: #E)
DESCRIPTION Writes an error message on the report.
- #write_FL_FUNC(fpath, fun_cnt) ⇒ Object (also: #FL_FUNC)
- #write_FL_STMT(fpath, stmt_cnt) ⇒ Object (also: #FL_STMT)
- #write_FN_CALL(fun_sig, loc, caller_cnt) ⇒ Object (also: #FN_CALL)
- #write_FN_CSUB(fun_id, loc, funcall_cnt) ⇒ Object (also: #FN_CSUB)
- #write_FN_CYCM(fun_id, loc, cycl_compl) ⇒ Object (also: #FN_CYCM)
- #write_FN_GOTO(fun_id, loc, goto_cnt) ⇒ Object (also: #FN_GOTO)
- #write_FN_LINE(fun_id, loc, fun_lines) ⇒ Object (also: #FN_LINE)
- #write_FN_NEST(fun_id, loc, max_nest) ⇒ Object (also: #FN_NEST)
- #write_FN_PARA(fun_id, loc, param_cnt) ⇒ Object (also: #FN_PARA)
- #write_FN_PATH(fun_id, loc, path_cnt) ⇒ Object (also: #FN_PATH)
- #write_FN_RETN(fun_id, loc, ret_cnt) ⇒ Object (also: #FN_RETN)
- #write_FN_STMT(fun_id, loc, stmt_cnt) ⇒ Object (also: #FN_STMT)
- #write_FN_UELS(fun_id, loc, if_stmt_cnt) ⇒ Object (also: #FN_UELS)
- #write_FN_UNRC(fun_id, loc, unreached_stmt_cnt) ⇒ Object (also: #FN_UNRC)
- #write_FN_UNUV(fun_id, loc, useless_var_cnt) ⇒ Object (also: #FN_UNUV)
-
#write_funcall(loc, caller_fun, callee_fun) ⇒ Object
(also: #FUNCALL)
DESCRIPTION Writes a function call information on the report.
-
#write_fundcl(loc, linkage, scope_type, dcl_type, fun_id) ⇒ Object
(also: #FUNDCL)
DESCRIPTION Writes a function declaration information on the report.
-
#write_fundef(loc, linkage, scope_type, fun_id, lines) ⇒ Object
(also: #FUNDEF)
DESCRIPTION Writes a function definition information on the report.
-
#write_gvardcl(loc, var_name, type_rep) ⇒ Object
(also: #GVARDCL)
DESCRIPTION Writes a global variable decaration information on the report.
-
#write_include(loc, fpath) ⇒ Object
(also: #INCLUDE)
DESCRIPTION Writes a header include information on the report.
-
#write_initialization(loc, var_name, init_rep) ⇒ Object
(also: #INITIALIZATION)
DESCRIPTION Writes an initialization information on the report.
-
#write_labeldef(loc, label_name) ⇒ Object
(also: #LABELDEF)
DESCRIPTION Writes a label definition information on the report.
- #write_literal(loc, lit_type, prefix, suffix, value) ⇒ Object (also: #LIT)
-
#write_macrodef(loc, macro_name, macro_type) ⇒ Object
(also: #MACRODEF)
DESCRIPTION Writes a macro definition information on the report.
- #write_pp_directive(loc, pp_dire, pp_tokens) ⇒ Object (also: #PP_DIRECTIVE)
-
#write_typedcl(loc, dcl_type, type_name, type_rep) ⇒ Object
(also: #TYPEDCL)
DESCRIPTION Writes a type declaration information on the report.
-
#write_vardef(loc, linkage, scope_type, sc_type, var_name, type_rep) ⇒ Object
(also: #VARDEF)
DESCRIPTION Writes a variable definition information on the report.
-
#write_warning_message(*args) ⇒ Object
(also: #W)
DESCRIPTION Writes a warning message on the report.
-
#write_xref_function(loc, referrer, ref_type, fun) ⇒ Object
(also: #XREF_FUN)
DESCRIPTION Writes a function cross reference information on the report.
-
#write_xref_variable(loc, referrer, ref_type, var_name) ⇒ Object
(also: #XREF_VAR)
DESCRIPTION Writes a variable cross reference information on the report.
Instance Method Details
#create_context_message(msg_name, loc, *parts) ⇒ Object Also known as: C
DESCRIPTION
Creates a context message.
Abbreviation below is available.
create_context_message(msg_name, loc, ...) => C(msg_name, loc, ...)
PARAMETER
- msg_name
-
Symbol – Message name.
- loc
-
Location – Location where the message points to.
- parts
-
Array< Object > – Message formatting parts.
RETURN VALUE
ContextMessage – New context message.
205 206 207 |
# File 'lib/adlint/report.rb', line 205 def (msg_name, loc, *parts) ContextMessage.new(, msg_name, self.class, loc, *parts) end |
#write_assignment(loc, var_name, assign_rep) ⇒ Object Also known as: ASSIGNMENT
DESCRIPTION
Writes an assignment information on the report.
Abbreviation below is available.
write_assignment(...) => ASSIGNMENT(...)
PARAMETER
- loc
-
Location – Location where the variable appears.
- var_name
-
String – Assigned variable name.
- assign_rep
-
String – String representation of the assignment.
RETURN VALUE
None.
375 376 377 |
# 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 |
#write_error_message(msg_name, loc, *parts) ⇒ Object Also known as: E
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
-
Symbol – Message name.
- loc
-
Location – Location where the message points to.
- parts
-
Array< Object > – Message formatting parts.
RETURN VALUE
None.
155 156 157 158 |
# File 'lib/adlint/report.rb', line 155 def (msg_name, loc, *parts) report.( ErrorMessage.new(, msg_name, loc, *parts)) end |
#write_FL_FUNC(fpath, fun_cnt) ⇒ Object Also known as: FL_FUNC
465 466 467 |
# 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 |
#write_FL_STMT(fpath, stmt_cnt) ⇒ Object Also known as: FL_STMT
460 461 462 |
# 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 |
#write_FN_CALL(fun_sig, loc, caller_cnt) ⇒ Object Also known as: FN_CALL
530 531 532 |
# 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 |
#write_FN_CSUB(fun_id, loc, funcall_cnt) ⇒ Object Also known as: FN_CSUB
495 496 497 |
# 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 |
#write_FN_CYCM(fun_id, loc, cycl_compl) ⇒ Object Also known as: FN_CYCM
525 526 527 |
# 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 |
#write_FN_GOTO(fun_id, loc, goto_cnt) ⇒ Object Also known as: FN_GOTO
500 501 502 |
# 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 |
#write_FN_LINE(fun_id, loc, fun_lines) ⇒ Object Also known as: FN_LINE
480 481 482 |
# 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 |
#write_FN_NEST(fun_id, loc, max_nest) ⇒ Object Also known as: FN_NEST
515 516 517 |
# 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 |
#write_FN_PARA(fun_id, loc, param_cnt) ⇒ Object Also known as: FN_PARA
485 486 487 |
# 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 |
#write_FN_PATH(fun_id, loc, path_cnt) ⇒ Object Also known as: FN_PATH
520 521 522 |
# 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 |
#write_FN_RETN(fun_id, loc, ret_cnt) ⇒ Object Also known as: FN_RETN
505 506 507 |
# 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 |
#write_FN_STMT(fun_id, loc, stmt_cnt) ⇒ Object Also known as: FN_STMT
470 471 472 |
# 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 |
#write_FN_UELS(fun_id, loc, if_stmt_cnt) ⇒ Object Also known as: FN_UELS
510 511 512 |
# 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 |
#write_FN_UNRC(fun_id, loc, unreached_stmt_cnt) ⇒ Object Also known as: FN_UNRC
475 476 477 |
# 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 |
#write_FN_UNUV(fun_id, loc, useless_var_cnt) ⇒ Object Also known as: FN_UNUV
490 491 492 |
# 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 |
#write_funcall(loc, caller_fun, callee_fun) ⇒ Object Also known as: FUNCALL
DESCRIPTION
Writes a function call information on the report.
Abbreviation below is available.
write_funcall(...) => FUNCALL(...)
PARAMETER
- loc
-
Location – Location where the function call appears.
- caller_fun
-
FunctionId – Calling function identifier.
- callee_fun
-
FunctionId – Called function identifier.
407 408 409 |
# 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 |
#write_fundcl(loc, linkage, scope_type, dcl_type, fun_id) ⇒ Object Also known as: FUNDCL
DESCRIPTION
Writes a function declaration information on the report.
Abbreviation below is available.
write_fundcl(...) => FUNDCL(...)
PARAMETER
- loc
-
Location – Location where the declaration appears.
- 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.
262 263 264 |
# 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 |
#write_fundef(loc, linkage, scope_type, fun_id, lines) ⇒ Object Also known as: FUNDEF
DESCRIPTION
Writes a function definition information on the report.
Abbreviation below is available.
write_fundef(...) => FUNDEF(...)
PARAMETER
- loc
-
Location – Location where the definition appears.
- 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.
304 305 306 |
# 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 |
#write_gvardcl(loc, var_name, type_rep) ⇒ Object Also known as: GVARDCL
DESCRIPTION
Writes a global variable decaration information on the report.
Abbreviation below is available.
write_gvardcl(...) => GVARDCL(...)
PARAMETER
- loc
-
Location – Location where the declaration appears.
- var_name
-
String – Global variable name.
- type_rep
-
String – Type representation string.
RETURN VALUE
None.
242 243 244 |
# 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 |
#write_include(loc, fpath) ⇒ Object Also known as: INCLUDE
DESCRIPTION
Writes a header include information on the report.
Abbreviation below is available.
write_include(...) => INCLUDE(...)
PARAMETER
- loc
-
Location – Location where the directive appears.
- fpath
-
Pathname – Path name of the included file.
RETURN VALUE
None.
392 393 394 |
# File 'lib/adlint/report.rb', line 392 def write_include(loc, fpath) write_code_struct(Include.new(loc, fpath)) end |
#write_initialization(loc, var_name, init_rep) ⇒ Object Also known as: INITIALIZATION
DESCRIPTION
Writes an initialization information on the report.
Abbreviation below is available.
write_initialization(...) => INITIALIZATION(...)
PARAMETER
- loc
-
Location – Location where the variable appears.
- var_name
-
String – Initialized variable name.
- init_rep
-
String – String representation of the initializer.
RETURN VALUE
None.
357 358 359 |
# 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 |
#write_labeldef(loc, label_name) ⇒ Object Also known as: LABELDEF
DESCRIPTION
Writes a label definition information on the report.
Abbreviation below is available.
write_labeldef(...) => LABELDEF(...)
PARAMETER
- loc
-
Location – Location where the definition appears.
- label_name
-
String – Label name.
RETURN VALUE
None.
339 340 341 |
# File 'lib/adlint/report.rb', line 339 def write_labeldef(loc, label_name) write_code_struct(LabelDef.new(loc, label_name)) end |
#write_literal(loc, lit_type, prefix, suffix, value) ⇒ Object Also known as: LIT
450 451 452 |
# 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 |
#write_macrodef(loc, macro_name, macro_type) ⇒ Object Also known as: MACRODEF
DESCRIPTION
Writes a macro definition information on the report.
Abbreviation below is available.
write_macrodef(...) => MACRODEF(...)
PARAMETER
- loc
-
Location – Location where the definition appears.
- macro_name
-
String – Macro name.
- macro_type
-
String – Macro type string.
RETURN VALUE
None.
322 323 324 |
# 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 |
#write_pp_directive(loc, pp_dire, pp_tokens) ⇒ Object Also known as: PP_DIRECTIVE
455 456 457 |
# 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 |
#write_typedcl(loc, dcl_type, type_name, type_rep) ⇒ Object Also known as: TYPEDCL
DESCRIPTION
Writes a type declaration information on the report.
Abbreviation below is available.
write_typedcl(...) => TYPEDCL(...)
PARAMETER
- loc
-
Location – Location where the declaration appears.
- dcl_type
-
String – Type declaration type.
- type_name
-
String – Type name.
- type_rep
-
String – Type representation string.
RETURN VALUE
None.
224 225 226 |
# 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 |
#write_vardef(loc, linkage, scope_type, sc_type, var_name, type_rep) ⇒ Object Also known as: VARDEF
DESCRIPTION
Writes a variable definition information on the report.
Abbreviation below is available.
write_vardef(...) => VARDEF(...)
PARAMETER
- loc
-
Location – Location where the definition appears.
- 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.
283 284 285 286 |
# 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 |
#write_warning_message(*args) ⇒ Object Also known as: W
DESCRIPTION
Writes a warning message on the report.
Abbreviation below is available.
write_warning_message(loc, ...) => W(loc, ...)
PARAMETER
- loc
-
Location – Location where the message points to.
RETURN VALUE
None.
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/adlint/report.rb', line 172 def (*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(, check_class, *chunk) end end report.(head_msg, suppressors) if head_msg end |
#write_xref_function(loc, referrer, ref_type, fun) ⇒ Object Also known as: XREF_FUN
DESCRIPTION
Writes a function cross reference information on the report.
Abbreviation below is available.
write_xref_function(...) => XREF_FUN(...)
PARAMETER
- loc
-
Location – Location where the cross-ref appears.
- referrer
-
FunctionId – Accessing function identifier.
- ref_type
-
String – Access type string.
- fun
-
FunctionId – Accessed function identifier.
RETURN VALUE
None.
445 446 447 |
# 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 |
#write_xref_variable(loc, referrer, ref_type, var_name) ⇒ Object Also known as: XREF_VAR
DESCRIPTION
Writes a variable cross reference information on the report.
Abbreviation below is available.
write_xref_variable(...) => XREF_VAR(...)
PARAMETER
- loc
-
Location – Location where the cross-ref appears.
- referrer
-
FunctionId – Accessing function identifier.
- ref_type
-
String – Access type string.
- var_name
-
String – Accessed variable name.
RETURN VALUE
None.
426 427 428 |
# 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 |