diff --git a/tools/warn/.pylintrc b/tools/warn/.pylintrc new file mode 100644 index 0000000000..6aeaed66ad --- /dev/null +++ b/tools/warn/.pylintrc @@ -0,0 +1,4 @@ +[FORMAT] + +# Two spaces for each indentation level. +indent-string=' ' diff --git a/tools/warn/html_writer.py b/tools/warn/html_writer.py index bed25ed6ff..ac5d4b7d84 100644 --- a/tools/warn/html_writer.py +++ b/tools/warn/html_writer.py @@ -144,12 +144,11 @@ def create_warnings(warn_patterns, project_names): 2D warnings array where warnings[p][s] is # of warnings in project name p of severity level s """ - # pylint:disable=invalid-name warnings = {p: {s.value: 0 for s in Severity.levels} for p in project_names} - for i in warn_patterns: - s = i['severity'].value - for p in i['projects']: - warnings[p][s] += i['projects'][p] + for pattern in warn_patterns: + value = pattern['severity'].value + for project in pattern['projects']: + warnings[project][value] += pattern['projects'][project] return warnings @@ -173,11 +172,11 @@ def emit_table_header(total_by_severity): """Returns list of HTML-formatted content for severity stats.""" stats_header = ['Project'] - for s in Severity.levels: - if total_by_severity[s.value]: + for severity in Severity.levels: + if total_by_severity[severity.value]: stats_header.append( '{}'.format( - s.color, s.column_header)) + severity.color, severity.column_header)) stats_header.append('TOTAL') return stats_header @@ -200,15 +199,15 @@ def emit_row_counts_per_project(warnings, total_by_project, total_by_severity, total_all_projects = 0 stats_rows = [] - for p in project_names: - if total_by_project[p]: - one_row = [p] - for s in Severity.levels: - if total_by_severity[s.value]: - one_row.append(warnings[p][s.value]) - one_row.append(total_by_project[p]) + for p_name in project_names: + if total_by_project[p_name]: + one_row = [p_name] + for severity in Severity.levels: + if total_by_severity[severity.value]: + one_row.append(warnings[p_name][severity.value]) + one_row.append(total_by_project[p_name]) stats_rows.append(one_row) - total_all_projects += total_by_project[p] + total_all_projects += total_by_project[p_name] return total_all_projects, stats_rows @@ -226,10 +225,10 @@ def emit_row_counts_per_severity(total_by_severity, stats_header, stats_rows, total_all_severities = 0 one_row = ['TOTAL'] - for s in Severity.levels: - if total_by_severity[s.value]: - one_row.append(total_by_severity[s.value]) - total_all_severities += total_by_severity[s.value] + for severity in Severity.levels: + if total_by_severity[severity.value]: + one_row.append(total_by_severity[severity.value]) + total_all_severities += total_by_severity[severity.value] one_row.append(total_all_projects) stats_rows.append(one_row) writer('