deprecated_lints.append((os.path.splitext(os.path.basename(fn))[0],
match.group('name').lower(),
desc.replace('\\"', '"')))
-
+
for match in declare_clippy_lint_re.finditer(code):
# remove \-newline escapes from description string
desc = nl_escape_re.sub('', match.group('desc'))
desc.replace('\\"', '"')))
-def gen_group(lints, levels=None):
+def gen_group(lints):
"""Write lint group (list of all lints in the form module::NAME)."""
- if levels:
- lints = [tup for tup in lints if tup[2] in levels]
for (module, name, _, _) in sorted(lints):
yield ' %s::%s,\n' % (module, name.upper())
new_lines.append(line)
if not found:
- print "regex " + region_start + " not found"
+ print("regex " + region_start + " not found")
# write back to file
if write_back:
all_lints += value
if print_only:
- sys.stdout.writelines(gen_table(all_lints))
+ print_clippy_lint_groups = [
+ "correctness",
+ "style",
+ "complexity",
+ "perf",
+ "pedantic",
+ "nursery",
+ "restriction"
+ ]
+ for group in print_clippy_lint_groups:
+ sys.stdout.write('\n## ' + group + '\n')
+ for (_, name, _, descr) in sorted(clippy_lints[group]):
+ sys.stdout.write('* [' + name + '](https://rust-lang-nursery.github.io/rust-clippy/master/index.html#' + name + ') (' + descr + ')\n')
return
# update the lint counter in README.md
# update the links in the CHANGELOG
changed |= replace_region(
'CHANGELOG.md',
- "<!-- begin autogenerated links to wiki -->",
- "<!-- end autogenerated links to wiki -->",
+ "<!-- begin autogenerated links to lint list -->",
+ "<!-- end autogenerated links to lint list -->",
lambda: ["[`{0}`]: {1}#{0}\n".format(l[1], docs_link) for l in
sorted(all_lints + deprecated_lints,
key=lambda l: l[1])],
lambda: gen_mods(all_lints),
replace_start=False, write_back=not check)
- # same for "clippy_*" lint collections
+ # same for "clippy::*" lint collections
changed |= replace_region(
- 'clippy_lints/src/lib.rs', r'reg.register_lint_group\("clippy"', r'\]\);',
+ 'clippy_lints/src/lib.rs', r'reg.register_lint_group\("clippy::all"', r'\]\);',
lambda: gen_group(clippy_lint_list),
replace_start=False, write_back=not check)
for key, value in clippy_lints.iteritems():
- # same for "clippy_*" lint collections
+ # same for "clippy::*" lint collections
changed |= replace_region(
- 'clippy_lints/src/lib.rs', r'reg.register_lint_group\("clippy_' + key + r'"', r'\]\);',
+ 'clippy_lints/src/lib.rs', r'reg.register_lint_group\("clippy::' + key + r'"', r'\]\);',
lambda: gen_group(value),
replace_start=False, write_back=not check)