From 197d8694821fa2bbafe6ac7f3b1266b882c2829c Mon Sep 17 00:00:00 2001 From: c-parsons Date: Mon, 14 Jan 2019 12:41:43 -0500 Subject: [PATCH] fix various linter errors (#93) --- lib/unittest.bzl | 4 ++-- tests/maprule_tests.bzl | 6 +++--- workspace.bzl | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/unittest.bzl b/lib/unittest.bzl index d459f0a..0d5307b 100644 --- a/lib/unittest.bzl +++ b/lib/unittest.bzl @@ -32,7 +32,7 @@ def register_unittest_toolchains(): TOOLCHAIN_TYPE = "@bazel_skylib//toolchains/unittest:toolchain_type" -_UnittestToolchain = provider( +_UnittestToolchainInfo = provider( doc = "Execution platform information for rules in the bazel_skylib repository.", fields = ["file_ext", "success_templ", "failure_templ", "join_on"], ) @@ -40,7 +40,7 @@ _UnittestToolchain = provider( def _unittest_toolchain_impl(ctx): return [ platform_common.ToolchainInfo( - unittest_toolchain_info = _UnittestToolchain( + unittest_toolchain_info = _UnittestToolchainInfo( file_ext = ctx.attr.file_ext, success_templ = ctx.attr.success_templ, failure_templ = ctx.attr.failure_templ, diff --git a/tests/maprule_tests.bzl b/tests/maprule_tests.bzl index 49a346d..5261d9a 100644 --- a/tests/maprule_tests.bzl +++ b/tests/maprule_tests.bzl @@ -45,7 +45,7 @@ def _assert_error(env, errors, expected_fragment, msg): return unittest.fail(env, msg + ": did not find \"%s\" in: [%s]" % (expected_fragment, "\n".join(errors))) -def _contains_substrings_in_order(env, s, substrings): +def _contains_substrings_in_order(s, substrings): index = 0 for ss in substrings: index = s.find(ss, index) @@ -56,7 +56,7 @@ def _contains_substrings_in_order(env, s, substrings): def _assert_error_fragments(env, errors, expected_fragments, msg): for e in errors: - if _contains_substrings_in_order(env, e, expected_fragments): + if _contains_substrings_in_order(e, expected_fragments): return unittest.fail(env, msg + ": did not find expected fragments in \"%s\" in order" % "\n".join(errors)) @@ -337,7 +337,7 @@ def _create_outputs_test(ctx): src3 = _mock_file(ctx, language + "/bar/src1.txt") foreach_srcs = [src1, src2, src3] - outs_dicts, all_output_files, src_placeholders_dicts, errors = ( + outs_dicts, all_output_files, _, errors = ( maprule_testing.create_outputs( ctx, "my_maprule", diff --git a/workspace.bzl b/workspace.bzl index 50b6db5..6bf67b5 100644 --- a/workspace.bzl +++ b/workspace.bzl @@ -1,3 +1,5 @@ +"""Dependency registration helpers for repositories which need to load bazel-skylib.""" + load("@bazel_skylib//lib:unittest.bzl", "register_unittest_toolchains") def bazel_skylib_workspace():