Skip to content

Commit

Permalink
Changed: No longer ignore the .gitignore file extension. (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
basrieter authored Apr 3, 2021
1 parent 6d490f8 commit 4069de3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
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.

0 comments on commit 4069de3

Please sign in to comment.