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

Changed: No longer ignore the .gitignore file extension. #253

Merged
merged 1 commit into from
Apr 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kodi_addon_checker/check_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def check_file_whitelist(report: Report, file_index: list, addon_path: str):
return

whitelist = (
r"\.?(py|xml|gif|png|jpg|jpeg|md|txt|po|json|gitignore|markdown|yml|"
r"\.?(py|xml|gif|png|jpg|jpeg|md|txt|po|json|markdown|yml|"
r"rst|ini|flv|wav|mp4|html|css|lst|pkla|g|template|in|cfg|xsd|directory|"
r"help|list|mpeg|pls|info|ttf|xsp|theme|yaml|dict|crt|ico)?$"
)
Expand Down
12 changes: 11 additions & 1 deletion tests/test_check_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest
from os.path import abspath, dirname, join

from kodi_addon_checker.check_files import check_file_permission
from kodi_addon_checker.check_files import check_file_permission, check_file_whitelist
from kodi_addon_checker.handle_files import create_file_index

from kodi_addon_checker.common import load_plugins
Expand Down Expand Up @@ -39,3 +39,13 @@ def test_check_file_permission_is_None(self):
path = join(HERE, 'test_data', 'Non-Executable_file')
file_index = create_file_index(path)
self.assertIsNone(check_file_permission(self.report, file_index))

def test_gitignore(self):
path = join(HERE, 'test_data', 'GitIgnore')
string = "WARN: Found non whitelisted file ending in filename {path}" \
.format(path=relative_path(join(path, ".gitignore")))
file_index = create_file_index(path)
check_file_whitelist(self.report, file_index, path)
records = [Record.__str__(r) for r in ReportManager.getEnabledReporters()[0].reports]
self.assertGreater(len(records), 0)
self.assertEqual(records[-1], string)
Empty file.