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

language_detect:fix ignore files correctly on Windows #854

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

matheusalcantarazup
Copy link
Contributor

@matheusalcantarazup matheusalcantarazup commented Dec 6, 2021

Previously when checking which files should be ignored by analysis on
Windows the directories patterns was not working properly, this is
because we was expecting that these paths would be always Unix like
paths so when a user set a path **/tests/** we can not ignore the
tests directory on Windows since the path would be **\\tests\\**.

This commit fix this issue converting all paths and all patterns to Unix
like paths before checking if should be ignored. Now **/tests/** would
match both foo/bar/tests and foo\\bar\\tests.

If the user set the pattern to use Windows slashes like **\\tests\\**,
this will work correctly only on Windows, so it is recommend that users
should always use the Unix slashes when configuring patterns that should
be ignored by analysis.

Signed-off-by: Matheus Alcantara matheus.alcantara@zup.com.br

- What I did

- How to verify it

- Description for the changelog

@matheusalcantarazup matheusalcantarazup force-pushed the fix-language-detect-windows branch 15 times, most recently from d0b00e3 to d9c99d1 Compare December 7, 2021 18:00
@matheusalcantarazup matheusalcantarazup changed the title language_detect: fix ignore files on Windows language_detect:fix ignore files correctly on Windows Dec 7, 2021
Previously when checking which files should be ignored by analysis on
Windows the directories patterns was not working properly, this is
because we was expecting that these paths would be always Unix like
paths so when a user set a path `**/tests/**` we can not ignore the
tests directory on Windows since the path would be `**\\tests\\**`.

This commit fix this issue converting all paths and all patterns to Unix
like paths before checking if should be ignored. Now `**/tests/**` would
match both `foo/bar/tests` and `foo\\bar\\tests`.

If the user set the pattern to use Windows slashes like `**\\tests\\**`,
this will work correctly only on Windows, so it is recommend that users
should always use the Unix slashes when configuring patterns that should
be ignored by analysis.

Signed-off-by: Matheus Alcantara <matheus.alcantara@zup.com.br>
@iancardosozup
Copy link
Contributor

If the user set the pattern to use Windows slashes like **\\tests\\**,
this will work correctly only on Windows, so it is recommend that users
should always use the Unix slashes when configuring patterns that should
be ignored by analysis.

i think this should be added to the docs

@matheusalcantarazup
Copy link
Contributor Author

If the user set the pattern to use Windows slashes like **\\tests\\**,
this will work correctly only on Windows, so it is recommend that users
should always use the Unix slashes when configuring patterns that should
be ignored by analysis.

i think this should be added to the docs

Definitely agree.

@matheusalcantarazup matheusalcantarazup merged commit 63fe01f into main Dec 13, 2021
@matheusalcantarazup matheusalcantarazup deleted the fix-language-detect-windows branch December 13, 2021 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants