from argparse import ArgumentParser
import re
-import common
-import metadata
import sys
from sets import Set
+import common
+import metadata
+import rewritemeta
+
config = None
options = None
"No need to specify that the app is for Android"),
(re.compile(r'.*[a-z0-9][.!?]( |$)'),
"Punctuation should be avoided"),
+ (re.compile(r'^\s'),
+ "Unnecessary leading space"),
+ (re.compile(r'.*\s$'),
+ "Unnecessary trailing space"),
],
'Description': [
(re.compile(r'^No description available$'),
def check_char_limits(app):
limits = config['char_limits']
- summ_chars = len(app.Summary)
- if summ_chars > limits['Summary']:
+ if len(app.Summary) > limits['Summary']:
yield "Summary of length %s is over the %i char limit" % (
- summ_chars, limits['Summary'])
+ len(app.Summary), limits['Summary'])
if len(app.Description) > limits['Description']:
yield "Description of length %s is over the %i char limit" % (
- desc_charcount, limits['Description'])
+ len(app.Description), limits['Description'])
def check_old_links(app):
# Parse command line...
parser = ArgumentParser(usage="%(prog)s [options] [APPID [APPID ...]]")
common.setup_global_opts(parser)
+ parser.add_argument("-f", "--format", action="store_true", default=False,
+ help="Also warn about formatting issues, like rewritemeta -l")
parser.add_argument("appid", nargs='*', help="app-id in the form APPID")
options = parser.parse_args()
]:
warns += check_func(app)
+ if options.format:
+ if not rewritemeta.proper_format(app):
+ warns.append("Run rewritemeta to fix formatting")
+
if warns:
anywarns = True
for warn in warns:
- print "%s: %s" % (appid, warn)
+ print("%s: %s" % (appid, warn))
if anywarns:
sys.exit(1)