File tree Expand file tree Collapse file tree 3 files changed +2
-33
lines changed Expand file tree Collapse file tree 3 files changed +2
-33
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ def _enrich_matcherror_with_task_details(
108
108
) -> None :
109
109
match .task = task
110
110
if not match .details :
111
- match .details = "Task/Handler: " + ansiblelint . utils . task_to_str (task )
111
+ match .details = "Task/Handler: " + str (task )
112
112
113
113
match .lineno = max (match .lineno , task [LINE_NUMBER_KEY ])
114
114
Original file line number Diff line number Diff line change @@ -712,37 +712,6 @@ def normalize_task_v2(task: Task) -> dict[str, Any]:
712
712
return result
713
713
714
714
715
- def task_to_str (task : dict [str , Any ]) -> str :
716
- """Make a string identifier for the given task."""
717
- name = task .get ("name" )
718
- if name :
719
- return str (name )
720
- action = task .get ("action" )
721
- if isinstance (action , str ) or not isinstance (action , dict ):
722
- return str (action )
723
- args = [
724
- f"{ k } ={ v } "
725
- for (k , v ) in action .items ()
726
- if k
727
- not in [
728
- "__ansible_module__" ,
729
- "__ansible_module_original__" ,
730
- "_raw_params" ,
731
- LINE_NUMBER_KEY ,
732
- FILENAME_KEY ,
733
- ]
734
- ]
735
-
736
- raw_params = action .get ("_raw_params" , [])
737
- if isinstance (raw_params , list ):
738
- for item in raw_params :
739
- args .extend (str (item ))
740
- else :
741
- args .append (raw_params )
742
-
743
- return f"{ action ['__ansible_module__' ]} { ' ' .join (args )} "
744
-
745
-
746
715
# pylint: disable=too-many-nested-blocks
747
716
def extract_from_list ( # type: ignore[no-any-unimported]
748
717
blocks : AnsibleBaseYAMLObject ,
Original file line number Diff line number Diff line change @@ -281,7 +281,7 @@ def test_template(template: str, output: str) -> None:
281
281
def test_task_to_str_unicode () -> None :
282
282
"""Ensure that extracting messages from tasks preserves Unicode."""
283
283
task = utils .Task ({"fail" : {"msg" : "unicode é ô à" }}, filename = "filename.yml" )
284
- result = utils .task_to_str (task ._normalize_task ()) # noqa: SLF001
284
+ result = str ( utils .Task (task ._normalize_task () )) # noqa: SLF001
285
285
assert result == "fail msg=unicode é ô à"
286
286
287
287
You can’t perform that action at this time.
0 commit comments