-
Notifications
You must be signed in to change notification settings - Fork 42
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
Ignore some hidden files and folders #131
Conversation
Better would be to not exclude all |
But why do we want to process any folder that is hidden? |
Because those should be also checked if they contain none allowed files. |
I think we're mixing stuff up.
If you run it on a single addon, local or in a git source repo, we don't
want to process hidden folders. Files should always be processed, only
exception is them being in a hidden folder.
If we're testing in the repo context those need to be reported and then
removed by the person sending the pr.
…On Mon, 15 Oct 2018, 21:22 Rechi, ***@***.***> wrote:
Because those should be also checked if they contain none allowed files.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#131 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFqyZCMSswvAXd3nHAO4ffa0eNJNjj6Cks5ulOBhgaJpZM4XczXb>
.
|
Repo vs single addon seperation is fine for me. Edit: Is PR check implemented as repo or single addon check? |
@razzeee is there any changes required in this? |
@Rechi the PR flag get's handed down in both cases and is taken care of in a single check it executes at the moment. I'm torn now, while I think me design above is correct, it would lead to you running the reporter local/in your git branch and not getting errors. Then sending it to our git and probably getting errors :/ |
@razzeee what do you think about ignoring files which are marked as export-ignored in git (https://git-scm.com/docs/gitattributes#_creating_an_archive)? |
Can you explain how that would help? |
It wouldn't ignore all files/folders starting with . by default, but you could exactly define which files/folders to ignore (eg also tests). |
I hoped to keep it convention over configuration :/ |
As long as the check run at xbmc/repo-* doesn't ignore any files, I would be okay with ignoring .* files. |
I think we need two modes. Additional to PR.
While it's not fun to get new errors when you open the PR version, it's better then having no error reporting at all. If we don't implement it, nobody will use it for their local/dev repos, as they will get false positives all the time. |
kodi_addon_checker/handle_files.py
Outdated
@@ -39,7 +39,8 @@ def create_file_index(path: str): | |||
file_index = [] | |||
for dirs in os.walk(path): | |||
for file_name in dirs[2]: | |||
file_index.append({"path": dirs[0], "name": file_name}) | |||
if not file_name.startswith("."): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
kodi_addon_checker/handle_files.py
Outdated
file_index.append({"path": dirs[0], "name": file_name}) | ||
for root, _, files in os.walk(path): | ||
for file_name in files: | ||
if not file_name.startswith(".") and not os.path.basename(root).startswith("."): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
07f3a3f
to
98c4095
Compare
@@ -49,7 +49,9 @@ def create_file_index(path: str): | |||
if ".git" in folders: | |||
folders.remove(".git") | |||
for file_name in files: | |||
file_index.append({"path": root, "name": file_name}) | |||
if not os.path.basename(root).startswith("."): |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Now, this is what this code is doing: Say we have the following directory structure:
Now if we run this code on the above-mentioned directory we'll get the following
I think this is what we want. |
The current PR title tells that everything in |
@@ -46,10 +46,14 @@ def create_file_index(path: str): | |||
""" | |||
file_index = [] | |||
for root, folders, files in os.walk(path, topdown=True): | |||
if ".directory" in files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only skip directories named .directory
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean to say we should ignore all the hidden files in the root directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is special about a folder named .directory
that it should be ignored, but e.g. not a folder named .abc
?
The current code does ignore .directory
folders everywhere, not only in the root directory.
The current PR title is "Ignore hidden files and folders", which means ignore all files and folder for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.directory
is a file, that's why I am checking it in files as
if ".directory" in files:
Also why I am ignoring it? Because I thought since it doesn't have any information usable by us so it would be good to ignore it.
Yes, I named it when I thought we were going to ignore everything. I'll change the name accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is basically used by file managers to keep track of the direcotries and also used for the preview of the direcotries.
Why I decided to ignore them? Since these files might be present in the folders(root) of addon but they don't consist any data that can be used by an addon so I simply decided to ignore them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it's like .DS_Store
and Thumbs.db
on other OSes?
Still the checker shouldn't ignore the file, as the checker now doesn't warn about those files submitted in an add-on submission.
@razzeee Is there anything other changes required in this? |
Fixes #123