Skip to content

Commit

Permalink
Merge branch 'dev/global-rules' into 'master'
Browse files Browse the repository at this point in the history
Annotate global rules in help output

See merge request eng/libadalang/langkit-query-language!84
  • Loading branch information
ArnaudCharlet committed Aug 10, 2023
2 parents 9920ced + 60113a2 commit 60ea31a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lkql_checker/share/lkql/deeply_nested_inlining.lkql
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ fun check_inlining(node, n: int) =
if a is Name when a.p_is_call()
and check_inlining(inlined_body(a), n - 1)]?[1] != ()

@check(message="deeply nested inlining", category="Feature")
@check(help="deeply nested inlining (global analysis required)",
message="deeply nested inlining", category="Feature")
fun deeply_nested_inlining(node, n: int = 3) =
match node
| ClassicSubpDecl => node.p_has_aspect("Inline") and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import stdlib

@check(message="callback may propagate exceptions",
@check(help="callback may propagate exceptions (global analysis required)",
message="callback may propagate exceptions",
category="Style", subcategory="Programming Practice")
fun exception_propagation_from_callbacks(node, callbacks=[]) =
# Select 'Access or 'Address on subprograms in a subprogram call
Expand Down
3 changes: 2 additions & 1 deletion lkql_checker/share/lkql/integer_types_as_enum.lkql
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ fun types() =
[c.f_type_def.f_subtype_indication?.f_name?.p_referenced_decl()
for c in select TypeDecl(f_type_def is DerivedTypeDef)].to_list)

@check(message="integer type may be replaced by an enumeration",
@check(help="integer type may be replaced by an enumeration (global analysis required)",
message="integer type may be replaced by an enumeration",
category="Style", subcategory="Programming Practice")
fun integer_types_as_enum(node) =
node is TypeDecl(p_is_int_type() is true)
Expand Down
3 changes: 2 additions & 1 deletion lkql_checker/share/lkql/recursive_subprograms.lkql
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ selector calls

# Note: we keep skip_dispatching_calls for compatibility only

@check(message="recursive subprogram", follow_generic_instantiations=true,
@check(help="recursive subprogram (global analysis required)",
message="recursive subprogram", follow_generic_instantiations=true,
category="Style", subcategory="Programming Practice")
fun recursive_subprograms(node,
skip_dispatching_calls=true,
Expand Down
2 changes: 1 addition & 1 deletion lkql_checker/share/lkql/same_instantiations.lkql
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fun same_instance(node, library_only) =
i.f_generic_pkg_name.p_referenced_decl() and
same_non_null_params(node, i)]?[1]

@unit_check(help="duplicate generic package instantiations",
@unit_check(help="duplicate generic package instantiations (global analysis required)",
category="Style", subcategory="Program Structure")
fun same_instantiations(unit, library_level_only = false) =
[{message: "same instantiation found at " &
Expand Down
3 changes: 2 additions & 1 deletion lkql_checker/share/lkql/unavailable_body_calls.lkql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# potentially missing recursion detection and identify potential missing
# checks.

@check(message="call to unavailable body",
@check(help="call to unavailable body (global analysis required)",
message="call to unavailable body",
category="Style", subcategory="Programming Practice")
fun unavailable_body_calls(node, indirect_calls = false) =
node is Name
Expand Down

0 comments on commit 60ea31a

Please sign in to comment.