705a3dcb90454c2d6ab2a857ac0b88dff2ef0bab,src/python/pants/core/goals/lint.py,,lint,#Any#Any#Any#Any#Any#,134

Before Change


        )

    sorted_results = sorted(itertools.chain.from_iterable(results), key=lambda res: res.linter_name)
    if not sorted_results:
        return Lint(exit_code=0)

    linter_to_reports = defaultdict(list)
    for result in sorted_results:
        if result.report:
            linter_to_reports[result.linter_name].append(result.report)
    if linter_to_reports:
        // TODO(/�): Tolerate when a linter has multiple reports.
        linters_with_multiple_reports = [
            linter for linter, reports in linter_to_reports.items() if len(reports) > 1
        ]
        if linters_with_multiple_reports:
            if lint_subsystem.per_target_caching:
                suggestion = "Try running without `--lint-per-target-caching` set."
            else:
                suggestion = (
                    "The linters likely partitioned the input targets, such as grouping by Python "
                    "interpreter compatibility. Try running on fewer targets or unset "
                    "`--lint-reports-dir`."
                )
            raise InvalidLinterReportsError(
                "Multiple reports would have been written for these linters: "
                f"{linters_with_multiple_reports}. The option `--lint-reports-dir` only works if "
                f"each linter has a single result. {suggestion}"
            )
        reports = itertools.chain.from_iterable(linter_to_reports.values())
        merged_reports = await Get(Digest, MergeDigests(report.digest for report in reports))
        workspace.write_digest(merged_reports, path_prefix=lint_subsystem.reports_dir)
        logger.info(f"Wrote lint result files to {lint_subsystem.reports_dir}.")

After Change


            for field_set in request.field_sets
        )
        // We consolidate all results for each linter into a single `LintResults`.
        all_results = tuple(
            LintResults(
                itertools.chain.from_iterable(
                    per_target_results.results for per_target_results in all_linter_results
                ),
                linter_name=linter_name,
            )
            for linter_name, all_linter_results in itertools.groupby(
                all_per_target_results, key=lambda results: results.linter_name
            )
        )
    else:
        all_results = await MultiGet(
            Get(LintResults, LintRequest, lint_request) for lint_request in valid_requests
        )

    all_results = tuple(sorted(all_results, key=lambda results: results.linter_name))

    reports = list(itertools.chain.from_iterable(results.reports for results in all_results))
    if reports:
        // TODO(/�): Tolerate when a linter has multiple reports.
        linters_with_multiple_reports = [
            results.linter_name for results in all_results if len(results.reports) > 1
        ]
        if linters_with_multiple_reports:
            if lint_subsystem.per_target_caching:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: pantsbuild/pants
Commit Name: 705a3dcb90454c2d6ab2a857ac0b88dff2ef0bab
Time: 2020-08-16
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/core/goals/lint.py
Class Name:
Method Name: lint


Project Name: erikbern/ann-benchmarks
Commit Name: 21608a6b6e6883504a0bcb06abbf9c7d8029897b
Time: 2019-07-21
Author: maau@itu.dk
File Name: ann_benchmarks/distance.py
Class Name:
Method Name: transform_dense_to_sparse


Project Name: idank/explainshell
Commit Name: 1fffcec16578e6bea8de6e685632b3f56713a438
Time: 2013-09-07
Author: idankk86@gmail.com
File Name: explainshell/matcher.py
Class Name: matcher
Method Name: _mergeadjacent