# Linebreak Ansible Filters

**URL:** <https://forum.ansible.com/t/linebreak-ansible-filters/30291>\
**Category:** Ansible Project\
**Created:** [May 9, 2019, 4:45pm UTC](https://forum.ansible.com/t/linebreak-ansible-filters/30291 "2019-05-09T16:45:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ron\_Gebauer](https://avatars.discourse-cdn.com/v4/letter/r/b487fb/32.png) [@Ron\_Gebauer](https://forum.ansible.com/u/Ron_Gebauer)\
**Post date:** [May 9, 2019, 4:45pm UTC](https://forum.ansible.com/t/linebreak-ansible-filters/30291/1 "2019-05-09T16:45:19Z")

</div>

Hi,

I want to fix the Ansible Linter issue “**[204]** Lines should be no longer than 160 chars”.

But how I can linebreak filters?

`

local\_filters\_in\_templates\_list: “{{ local\_filters\_in\_templates.files | map(attribute=‘path’) | map(‘regex\_replace’,‘^(.\*)/’) | map(‘regex\_replace’,‘.j2$’) | list }}”

`

simply break after “|”?

Best regards,  
Mazorius

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [May 10, 2019, 3:37pm UTC](https://forum.ansible.com/t/linebreak-ansible-filters/30291/2 "2019-05-10T15:37:05Z")

</div>

> Hi,
> 
> I want to fix the Ansible Linter issue "\*[204]\* Lines should be no longer  
> than 160 chars".

In my opinion the best this is often to disable the to long line check.

> But how I can linebreak filters?
> 
> local\_filters\_in\_templates\_list: "{{ local\_filters\_in\_templates.files |  
> map(attribute='path') | map('regex\_replace','^(.\*)/') |  
> map('regex\_replace','.j2$') | list }}"
> 
> simply break after "|"?

If you use multiline yaml you can break anywhere you can have a space.  
So this is valid

local\_filters\_in\_templates\_list: \>  
&nbsp;&nbsp;{{ local\_filters\_in\_templates.files  
&nbsp;&nbsp;\>  
&nbsp;&nbsp;map(attribute='path')  
&nbsp;&nbsp;\>  
&nbsp;&nbsp;map('regex\_replace','^(.\*)/')  
&nbsp;&nbsp;\>  
&nbsp;&nbsp;map('regex\_replace','.j2$')  
&nbsp;&nbsp;\>  
&nbsp;&nbsp;list }}

Of course this is not very readable, so break it where you like it to be.

And it's important not to use the double quotes when using the multiline, if you do it will be a string and not a list.
