Skip to content

ExcludeByFile add traversal support when full path specified. #236

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

Merged
merged 1 commit into from
Dec 16, 2018
Merged

ExcludeByFile add traversal support when full path specified. #236

merged 1 commit into from
Dec 16, 2018

Conversation

SlowLogicBoy
Copy link
Contributor

@SlowLogicBoy SlowLogicBoy commented Nov 7, 2018

Fixes
System.ArgumentException: ".." can be only added at the beginning of the pattern.
when specifying full path with path traversal:
<ExcludeByFile>$(MSBuildThisFileDirectory)../**/*.Designer.cs</ExcludeByFile>

The main problem might be that we can't specify our own root path, it's ether Directory.GetCurrentDirectory() or Path.GetRootPath(pattern).

@codecov
Copy link

codecov bot commented Nov 7, 2018

Codecov Report

Merging #236 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #236   +/-   ##
=======================================
  Coverage   94.91%   94.91%           
=======================================
  Files          15       15           
  Lines        1633     1633           
=======================================
  Hits         1550     1550           
  Misses         83       83
Impacted Files Coverage Δ
src/coverlet.core/Helpers/InstrumentationHelper.cs 98.46% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b54c93c...c6b1ad4. Read the comment docs.

Copy link
Collaborator

@tonerdo tonerdo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to do some personal testing on this. Any gotchas I should be aware of?

@SlowLogicBoy
Copy link
Contributor Author

SlowLogicBoy commented Nov 13, 2018

D:\Some\Path\..\..\..\SomeOther\Path: when traversing more then there is path. The only gotcha that bothers me, since I didn't check for that.
Also it might not be a good idea to do Path.GetFullPath(excludeRule) when there is no path traversal (../) since it might add additional overhead (it accesses physical files if it exists).
GetFullPath

EDIT:

D:\Some\Path\..\..\..\SomeOther\Path: when traversing more then there is path. The only gotcha that bothers me, since I didn't check for that.

Looks like it ignores traversal if it's exceeded:
D:\Some\Path\..\..\..\SomeOther\Path becomes D:\SomeOther\Path

@tonerdo tonerdo merged commit 820a450 into coverlet-coverage:master Dec 16, 2018
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.

2 participants