Skip to content

Commit

Permalink
Merge branch 'topic/fix_no_closing_names' into 'master'
Browse files Browse the repository at this point in the history
Fix the "No_Closing_Names" rule

Closes #411

See merge request eng/libadalang/langkit-query-language!351
  • Loading branch information
HugoGGuerrier committed Jan 7, 2025
2 parents d5e2ff0 + bf35160 commit 437764f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lkql_checker/share/lkql/no_closing_names.lkql
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ fun no_closing_names(node, n : int = 0) =
and node.token_end().end_line - node.token_start().start_line >= n
and match node
| (TaskTypeDecl | ProtectedTypeDecl | SingleProtectedDecl) =>
node.f_definition.f_end_name == null
node.f_definition is (ProtectedDef | TaskDef)(f_end_name: null)
| * => node.f_end_name == null
2 changes: 1 addition & 1 deletion testsuite/tests/checks/no_closing_names/prj.gpr
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
project Prj is
end Prj;
end Prj;
8 changes: 8 additions & 0 deletions testsuite/tests/checks/no_closing_names_n0/names.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
procedure Names is -- FLAG
task T3; -- NOFLAG

task body T3 is -- NOFLAG
begin
null;
end T3;
end;
2 changes: 2 additions & 0 deletions testsuite/tests/checks/no_closing_names_n0/prj.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project Prj is
end Prj;
4 changes: 4 additions & 0 deletions testsuite/tests/checks/no_closing_names_n0/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
names.adb:1:11: rule violation: no closing name
1 | procedure Names is -- FLAG
| ^^^^^

5 changes: 5 additions & 0 deletions testsuite/tests/checks/no_closing_names_n0/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
driver: checker
rule_name: no_closing_names
project: prj.gpr
rule_arguments:
no_closing_names.n: 0

0 comments on commit 437764f

Please sign in to comment.