Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply exclude_files to files absolute paths #356

Commits on Aug 17, 2024

  1. Apply exclude_files to files absolute paths

    When calling `erlfmt` with absolute paths for the files to format, the
    excludes don't apply, even if the resolved paths of the excludes would
    match the files to format.
    
    Resolve the paths of the excludes based on the current working directory
    and add them to the excludes.
    
    This issue was observed when using the
    [VS Code Erlang Formatter extension](https://marketplace.visualstudio.com/items?itemName=szTheory.erlang-formatter).
    The extension invokes `rebar3 fmt` with the full path of the file to
    format.
    danielfinke committed Aug 17, 2024
    Configuration menu
    Copy the full SHA
    3245632 View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Use filename:absname/2 to resolve absolute paths

    This handles Windows' `volumerelative` path types by properly resolving
    them based on the "per-drive" working directory.
    
    Also, resolve the input file absolute paths. This is new functionality;
    if you were previously to use a file path like `a/../b`, that would have
    been directly matched against the excludes. As a result, an exclude of
    `b` would not have applied. This change makes sure relative path
    resolution is consistent between `files`/`exclude_files`.
    
    To avoid displaying different paths from what was requesting by config
    or CLI options (e.g. when using the verbose flag), use a map of absolute
    paths -> original paths and return the original paths from
    `erlfmt_cli:set_difference/2` after applying excludes.
    danielfinke committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    915d7e2 View commit details
    Browse the repository at this point in the history