built-in predicate

logtalk_linter_hook/7

Description

logtalk_linter_hook(Goal, Flag, File, Lines, Type, Entity, Warning)

Multifile user-defined predicate, supporting the definition of custom linter warnings. Experimental. The Goal argument can be a message-sending goal, Object::Message, a call to a Prolog built-in predicate, or a call to a module predicate, Module:Predicate. The Flag argument must be a supported linter flag. The Warning argument must be a valid core message term. For a given Goal, only the first successful call to this predicate is considered.

Modes and number of proofs

logtalk_linter_hook(@callable, +atom, +atom, +pair(integer), +atom, @object_identifier, --callable) - zero_or_one

Errors

(none)

Examples

:- multifile(user::logtalk_linter_hook/7).
% warn about using list::append/3 to construct a list from an head and a tail
user::logtalk_linter_hook(
    list::append(L1,L2,L), suspicious_calls,
    File, Lines, Type, Entity,
    suspicious_call(File, Lines, Type, Entity, list::append(L1,L2,L), [L=[Head|L2]])
) :-
    nonvar(L1),
    L1 = [Head].