Fair enough. If you wanted to use a simpler string/regex match for the original
use case, you might want to write something like this:
[
inputs:
["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
|> Enum.flat_map(&Path.wildcard(&1, match_dot: true)
|> Enum.reject(&(&1 =~ "test/example_app"))
]
On Wed, Apr 27, 2022, at 3:13 PM, Ignacio Aguirrezabal wrote:
> Makes sense José <3
> Thanks everyone for your input
>
> On Wednesday, April 27, 2022 at 10:10:40 AM UTC-3 José Valim wrote:
>> Thank you for the proposal, however I would prefer to not add this behaviour.
>>
>> It is definitely possible to do it today and at the same time we don't want
>> to encourage excluding some files, unless absolutely necessary. And for the
>> cases it is absolutely necessary, the current ways suffice. :)
>>
>>
>> On Wed, Apr 27, 2022 at 3:03 PM Andrea Leopardi <[email protected]> wrote:
>>> __
>>> Hey Ignacio, thanks for the proposal.
>>>
>>> I don't feel too strongly about this, but I think it could be a useful
>>> addition.
>>>
>>> One note: I think :exclude should rather be exclude_pattern and be a regex.
>>> If an expanded filename matches the regex, it gets excluded. I think having
>>> a wildcard limits us unnecessarily since we have to expand the inputs
>>> wildcard anyways first.
>>>
>>> Unless other members of the team are against this feature, a PR would be
>>> welcome 😉
>>>
>>> Andrea
>>>
>>> On Wed, Apr 27, 2022, at 2:51 PM, Bruce Tate wrote:
>>>> +1 from me. Providing convenient ways to opt out will only increase
>>>> formatter adoption.
>>>>
>>>> -bt
>>>>
>>>> On Tue, Apr 26, 2022 at 4:35 PM Jon Rowe <[email protected]> wrote:
>>>>> __
>>>>> I wanted this feature recently as with the addition of the heex formatter
>>>>> I wanted to format most of an app, but not one file temporarily due to a
>>>>> whitespace wrapping issue (thats getting addressed :)) but still wanted
>>>>> the rest of the app formatted.
>>>>>
>>>>> So I'm in favour.
>>>>>
>>>>> Cheers
>>>>> Jon
>>>>>
>>>>> On Tue, 26 Apr 2022, at 6:33 PM, Ignacio Aguirrezabal wrote:
>>>>>> Hello everyone,
>>>>>>
>>>>>> Currently, the only way to exclude files from the formatter is to do
>>>>>> something like this:
>>>>>>
>>>>>> [
>>>>>> inputs:
>>>>>> Enum.flat_map(
>>>>>> ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
>>>>>> &Path.wildcard(&1, match_dot: true)
>>>>>> ) -- Path.wildcard("test/example_app/**/*.*", match_dot: true) ]
>>>>>>
>>>>>>
>>>>>>
>>>>>> So I think it would be nice to have a more convenient way to do it.
>>>>>> Maybe something like:
>>>>>> [
>>>>>> inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
>>>>>> exclude: ["test/example_app/**/*.*"]
>>>>>> ]
>>>>>>
>>>>>> I have a working implementation in this branch but I didn't want to open
>>>>>> a PR before checking this is actually useful:
>>>>>> https://github.com/elixir-lang/elixir/compare/main...iaguirre88:formatter-exclude-dir?expand=1
>>>>>>
>>>>>> Thanks,
>>>>>> Ignacio
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "elixir-lang-core" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>>> an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/elixir-lang-core/27d4a121-1f5f-4483-94e2-b43643dbe315n%40googlegroups.com
>>>>>>
>>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/27d4a121-1f5f-4483-94e2-b43643dbe315n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups
>>>>> "elixir-lang-core" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>>> email to [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/elixir-lang-core/c1efa923-947d-4fea-abd8-2778c31cad10%40www.fastmail.com
>>>>>
>>>>> <https://groups.google.com/d/msgid/elixir-lang-core/c1efa923-947d-4fea-abd8-2778c31cad10%40www.fastmail.com?utm_medium=email&utm_source=footer>.
>>>>
>>>>
>>>> --
>>>>
>>>> Regards,
>>>> Bruce Tate
>>>> CEO
>>>>
<https://bowtie.mailbutler.io/tracking/hit/f8218219-d2a8-4de4-9fef-1cdde6e723f6/c7c97460-016e-45fb-a4ab-0a70318c7b97>
>>>>
>>>>
>>>> Groxio, LLC.
>>>> 512.799.9366 <tel:(512)%20799-9366>
>>>> [email protected]
>>>> grox.io
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "elixir-lang-core" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>> email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-5S4nHpN1ohrTYVG-F6hsPT3KDEa%3DyzJ-2B1911wupyXA%40mail.gmail.com
>>>>
>>>> <https://groups.google.com/d/msgid/elixir-lang-core/CAFXvW-5S4nHpN1ohrTYVG-F6hsPT3KDEa%3DyzJ-2B1911wupyXA%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "elixir-lang-core" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/elixir-lang-core/b7cade68-af9b-4ed8-86da-16e62e8450f0%40www.fastmail.com
>>>
>>> <https://groups.google.com/d/msgid/elixir-lang-core/b7cade68-af9b-4ed8-86da-16e62e8450f0%40www.fastmail.com?utm_medium=email&utm_source=footer>.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/cc1b078b-ea6b-46a3-8ff6-313594edfa05n%40googlegroups.com
>
> <https://groups.google.com/d/msgid/elixir-lang-core/cc1b078b-ea6b-46a3-8ff6-313594edfa05n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
You received this message because you are subscribed to the Google Groups
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elixir-lang-core/afdbb8a0-c688-42c7-99e4-f71732964c22%40www.fastmail.com.