@@ -93,23 +93,6 @@ def matchtask(
93
93
),
94
94
)
95
95
96
- notify = task .get ("notify" )
97
- if notify :
98
- if isinstance (notify , str ):
99
- notify = [notify ]
100
-
101
- results .extend (
102
- [
103
- self .create_matcherror (
104
- message = f"Task notify '{ handler } ' should start with an uppercase letter." ,
105
- lineno = task [LINE_NUMBER_KEY ],
106
- tag = "name[casing]" ,
107
- filename = file ,
108
- )
109
- for handler in notify
110
- if check_handler_case (handler )
111
- ],
112
- )
113
96
return results
114
97
115
98
def _prefix_check (
@@ -268,27 +251,10 @@ def update_task_name(task_name: str) -> str:
268
251
if orig_task_name == task ["notify" ][idx ]:
269
252
task ["notify" ][idx ] = updated_task_name
270
253
271
- if isinstance (item , dict ) and "handlers" in item :
272
- for task in item ["handlers" ]:
273
- listener_task_name = task .get ("listen" , None )
274
- if (
275
- listener_task_name
276
- and listener_task_name == orig_task_name
277
- ):
278
- task ["listen" ] = updated_task_name
279
-
280
254
target_task ["name" ] = updated_task_name
281
255
match .fixed = True
282
256
283
257
284
- def check_handler_case (handler : str ) -> bool :
285
- """Check the casing of a handler."""
286
- # Handlers may be prefixed with "role_name : " to indicate a handler from a specific role
287
- # Strip this before checking
288
- handler = handler .split (" : " , 1 )[- 1 ]
289
- return handler [0 ].isalpha () and handler [0 ].islower () and not handler [0 ].isupper ()
290
-
291
-
292
258
if "pytest" in sys .modules :
293
259
from ansiblelint .rules import RulesCollection
294
260
from ansiblelint .runner import Runner
@@ -381,17 +347,6 @@ def test_rule_name_lowercase() -> None:
381
347
assert errs [0 ].tag == "name[casing]"
382
348
assert errs [0 ].rule .id == "name"
383
349
384
- def test_rule_notify_lowercase () -> None :
385
- """Negative test for a task notify that starts with lowercase."""
386
- collection = RulesCollection ()
387
- collection .register (NameRule ())
388
- failure = "examples/playbooks/name_case_notify_fail.yml"
389
- bad_runner = Runner (failure , rules = collection )
390
- errs = bad_runner .run ()
391
- assert len (errs ) == 5
392
- assert all (err .tag == "name[casing]" for err in errs )
393
- assert all (err .rule .id == "name" for err in errs )
394
-
395
350
def test_name_play () -> None :
396
351
"""Positive test for name[play]."""
397
352
collection = RulesCollection ()
0 commit comments