mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 15:30:28 +03:00
lint: error on unused files
For now, this is just patch files.
This commit is contained in:
parent
736391d3d9
commit
0c6269bb67
1 changed files with 26 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
@ -309,6 +310,30 @@ def check_builds(app):
|
||||||
yield "Branch '%s' used as commit in srclib '%s'" % (s, srclib)
|
yield "Branch '%s' used as commit in srclib '%s'" % (s, srclib)
|
||||||
|
|
||||||
|
|
||||||
|
def check_files_dir(app):
|
||||||
|
dir_path = os.path.join('metadata', app.id)
|
||||||
|
if not os.path.isdir(dir_path):
|
||||||
|
return
|
||||||
|
files = set()
|
||||||
|
for name in os.listdir(dir_path):
|
||||||
|
path = os.path.join(dir_path, name)
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
yield "Found non-file at %s" % path
|
||||||
|
continue
|
||||||
|
files.add(name)
|
||||||
|
|
||||||
|
used = set()
|
||||||
|
for build in app.builds:
|
||||||
|
for fname in build.patch:
|
||||||
|
if fname not in files:
|
||||||
|
yield "Unknown file %s in build '%s'" % (fname, build.version)
|
||||||
|
else:
|
||||||
|
used.add(fname)
|
||||||
|
|
||||||
|
for name in files.difference(used):
|
||||||
|
yield "Unused file at %s" % os.path.join(dir_path, name)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
global config, options
|
global config, options
|
||||||
|
|
@ -348,6 +373,7 @@ def main():
|
||||||
check_mediawiki_links,
|
check_mediawiki_links,
|
||||||
check_bulleted_lists,
|
check_bulleted_lists,
|
||||||
check_builds,
|
check_builds,
|
||||||
|
check_files_dir,
|
||||||
]:
|
]:
|
||||||
warns += check_func(app)
|
warns += check_func(app)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue