8000 Compare paths case insensitive #329 by Spacetown · Pull Request #386 · gcovr/gcovr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Compare paths case insensitive #329 #386

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 4 commits into from
Jul 21, 2020

Conversation

Spacetown
Copy link
Member

If HOME directory is case insensitive the pattern match is also done case insensitive.
Test for exclude filter adapted to give filename with wrong case if testcase.exe exists in filesystem.

@Spacetown Spacetown force-pushed the filter_case_insensitive branch 2 times, most recently from 39c493f to 8b56e52 Compare June 3, 2020 18:22
@codecov
Copy link
codecov bot commented Jun 3, 2020

Codecov Report

Merging #386 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #386      +/-   ##
==========================================
- Coverage   94.95%   94.92%   -0.03%     
==========================================
  Files          19       19              
  Lines        2160     2189      +29     
  Branches      374      379       +5     
==========================================
+ Hits         2051     2078      +27     
  Misses         50       50              
- Partials       59       61       +2     
Impacted Files Coverage Δ
gcovr/utils.py 92.10% <100.00%> (+0.43%) ⬆️
gcovr/csv_generator.py 85.71% <0.00%> (-4.77%) ⬇️
gcovr/__main__.py 89.67% <0.00%> (-0.76%) ⬇️
gcovr/configuration.py 96.88% <0.00%> (ø)
gcovr/json_generator.py 100.00% <0.00%> (ø)
gcovr/tests/test_args.py 100.00% <0.00%> (ø)
gcovr/tests/test_gcovr.py 92.02% <0.00%> (ø)

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 1bb7249...218aeb3. Read the comment docs.

@Spacetown
Copy link
Member Author

Changed from HOME to cwd.
I thought about a scenario with SCM ClearCase which we are using at work. This SCM uses a virtual file system driver called MVFS. This can be configured to be case sensitive even on Windows.
I think that using the CWD is the best choice because this is normaly in the filesystem of the source files. Using python directory can lead to a false detection if it is installed localy and the sources are on a different drive.

@Spacetown Spacetown force-pushed the filter_case_insensitive branch from 8b56e52 to 138aea2 Compare July 16, 2020 19:26
@Spacetown Spacetown requested a review from latk July 17, 2020 18:45
- If cwd exist uppercase and lowercase the pattern match is also done case insensitive.
@Spacetown Spacetown force-pushed the filter_case_insensitive branch from 138aea2 to a49601d Compare July 17, 2020 19:15
@Spacetown Spacetown added Filters related to filters, include/exclude, path handling Platform: Windows Type: Bug labels Jul 17, 2020
@Spacetown Spacetown linked an issue Jul 17, 2020 that may be closed by this pull request
gcovr/utils.py Outdated
@@ -180,7 +180,12 @@ def __init__(self, regex, path_context=None):

class Filter(object):
def __init__(self, pattern):
self.pattern = re.compile(pattern)
cwd = os.getcwd()
is_fs_case_insensitive = os.path.exists(cwd.upper()) and os.path.exists(cwd.lower())
Copy link
Member

Choose a reason for hiding this comment

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

I agree that using cwd is sensible. But there might be the case that cwd = '/' on Unix, which would falsely suggest a case-insensitive file system. In principle arbitrary non-alphabetic paths are possible, and I'm not sure to which degree this should be handled.

I'd suggest just a check is_fs_case_insensitive = (cwd != '/') and ..., ignoring other paths that are case-invariant because nearly all projects will use a sane folder layout in practice.

Copy link
Member Author
@Spacetown Spacetown Jul 19, 2020

Choose a reason for hiding this comment

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

Good point. I've used os.path.sep instead of '/'.

Copy link
Contributor
@chrta chrta left a comment

Choose a reason for hiding this comment

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

Just some minor comments

Copy link
Contributor
@chrta chrta left a comment

Choose a reason for hiding this comment

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

LGTM, but I could only test on linux.

@Spacetown
Copy link
Member Author

@latk: AppVeyor hangs on master branch but the gcovr team has no access to the project. Please can you check this?

@latk
Copy link
Member
latk commented Jul 21, 2020

Build should be fixed now

@Spacetown Spacetown merged commit 98d471e into gcovr:master Jul 21, 2020
@Spacetown Spacetown deleted the filter_case_insensitive branch July 21, 2020 07:45
@Spacetown Spacetown added this to the 4.3 milestone Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filters related to filters, include/exclude, path handling Platform: Windows Type: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Headers containing definitions are filtered in out-of-source build
3 participants
0