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

Xcov not picking up .xcovignore file #102

Closed
wolesolana opened this issue Dec 22, 2017 · 13 comments
Closed

Xcov not picking up .xcovignore file #102

wolesolana opened this issue Dec 22, 2017 · 13 comments

Comments

@wolesolana
Copy link

Hi,

I created a .xcovignore file in the default path for xcov (.fastlane/.xcovignore) but I keep getting this warning when I run my test suite:

Skipping file blacklisting as no ignore file was found at path ./fastlane/.xcovignore

This creates a problem as I have a number of files I need to ignore to get accurate coverage report. Is this a bug or am I missing something in my setup?

I am using xcov 1.3.1 and fastlane 2.70.3

Thanks for your help.

@nakiostudio
Copy link
Collaborator

Hi @wolesolana 👋

Thanks for reporting, could you try placing the .xcovignore file in the path where fastlane is run from?

You can also specify the path to the file using the ignore_file_path argument.

@wolesolana
Copy link
Author

Thanks for the response @nakiostudio ( I appreciate you reaching out on Christmas day). I tried using the ignore_file_path argument using an absolute reference to the .xcovignore file but I still got the same error.

When you say I should place the .xcovignore file in the fastlane path, what do you mean? I run fastlane using bundle exec fastlane.

@wolesolana
Copy link
Author

Happy New Year @nakiostudio! Any updates on this bug? Is it something I'm doing wrong?

@thelvis4
Copy link
Contributor

thelvis4 commented Jan 6, 2018

Hi @wolesolana!
Is your Fastlane folder hidden (Project/.fastlane/)?
If yes, #103 should fix the issue.

@wolesolana
Copy link
Author

Thanks for the response @thelvis4. No, my fastlane folder is not hidden.

@thelvis4
Copy link
Contributor

thelvis4 commented Jan 7, 2018

@wolesolana Can you, please, check if the syntax of .xcovignore is correct, by running:

$ irb

and then (in interactive mode):

require 'yaml'
ignore_file_path = "/Path/to/your/.xcovignore"
YAML.load_file(ignore_file_path)

* Replace /Path/to/your/.xcovignore with the path where .xcovignore stays.

@wolesolana
Copy link
Author

Hi @thelvis4, I did what you suggested and I got this error output:

Psych::SyntaxError: did not find expected alphabetic or numeric character while scanning an alias at line 3 column 3
from /ruby-2.4.2/lib/ruby/2.4.0/psych.rb:377:in `parse'

So I guess my xcovignore file is not written properly? Here's the text of my .xcovignore file:

# Generated Resource Files
- R.generated.swift
- *.json

# Exclude all dependencies
- Frameworks/

I'm suspecting the issue is with the *.json line?

@wolesolana wolesolana reopened this Jan 8, 2018
@wolesolana
Copy link
Author

I just took out that line and everything runs fine. What is the correct syntax to ignore all files of a particular type? Since it seems the *.file_type syntax generates an error?

@wolesolana
Copy link
Author

Never mind. I think I found the answer in the documentation. Thanks for the help!

@liang-notes
Copy link

Never mind. I think I found the answer in the documentation. Thanks for the help!

hi, when I excute the command in terminal, It work!, But I meet the same issue in Jenkins with you, can you help me How did you work at last?

@gauravdalal
Copy link

@wolesolana Can you, please, check if the syntax of .xcovignore is correct, by running:

$ irb

and then (in interactive mode):

require 'yaml'
ignore_file_path = "/Path/to/your/.xcovignore"
YAML.load_file(ignore_file_path)
  • Replace /Path/to/your/.xcovignore with the path where .xcovignore stays.

I'm a newbie and have few questions.
Q1: Is this .xcovignore an file extension or is it a ruby file, since @thelvis4 suggested to run irb command. Not quite sure about the file type?

Q2: Where to put this file on directory level ? Fastlane folder is not hidden and existing in "code" folder in my repo workspace and this .xcovignore file is inside that fastlane folder. Why seems to be not working with this message - Skipping file blacklisting as no ignore file was found at path ./fastlane/.xcovignore .

Q3: Does this flag "include_targets" works ? Have passed comma separated and single values in this and nothing happens, it simply shows 0% coverage in json /html file.

Working on Jenkins (also ran through teminal) on mac running on catalina 10.15.2 with XCode 11.4

@wolesolana
Copy link
Author

Hi @gauravdalal. I haven't used xcov in a while, but unless something has changed drastically, here are my answers to your questions, AFAIK:

Q1: .xcovignore is a plain text file
Q2: I put the .xcovignore file at the top level of the fastlane folder
Q3: I'm not sure about this.

You could check the README for the latest documentation on how to set this up as I think my original issue has been resolved.

@KacperCzapp
Copy link

In my case it was the issue of having:

- *Request.swift
- *Response.swift

instead of

- .*Request.swift
- .*Response.swift

(notice the dot before the asterisk)

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

No branches or pull requests

6 participants