From 79b34d4310772963fc0e500b1bebd68819db23b4 Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Mon, 6 May 2024 14:18:03 -0400 Subject: [PATCH 1/5] lint.sh --- MODULE.bazel | 16 ++++----- Source/gui/SNTBinaryMessageWindowController.m | 5 +-- Source/santad/BUILD | 6 ++-- .../EventProviders/DiskArbitrationTestUtil.mm | 4 +-- .../SNTEndpointSecurityDeviceManagerTest.mm | 16 ++++----- Source/santad/ProcessTree/BUILD | 2 +- Source/santad/ProcessTree/annotations/BUILD | 4 +-- .../ProcessTree/annotations/originator.cc | 2 +- .../ProcessTree/annotations/originator.h | 4 +-- Testing/lint.sh | 2 +- WORKSPACE | 1 - non_module_deps.bzl | 36 +++++++++---------- 12 files changed, 47 insertions(+), 51 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 159309500..3e97df559 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -2,47 +2,44 @@ module(name = "santa") bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support") bazel_dep(name = "abseil-cpp", version = "20230802.1", repo_name = "com_google_absl") - bazel_dep(name = "rules_python", version = "0.31.0") bazel_dep(name = "rules_cc", version = "0.0.9") bazel_dep(name = "rules_apple", version = "3.5.0", repo_name = "build_bazel_rules_apple") bazel_dep(name = "rules_swift", version = "1.18.0", repo_name = "build_bazel_rules_swift") - bazel_dep(name = "protobuf", version = "main", repo_name = "com_google_protobuf") git_override( module_name = "protobuf", - remote = "https://github.com/protocolbuffers/protobuf.git", commit = "21d75f861cdbc03b0a6b235a9ccf3ba0e1f09b32", + remote = "https://github.com/protocolbuffers/protobuf.git", ) bazel_dep(name = "googletest", version = "1.14.0.bcr.1", repo_name = "com_google_googletest") - bazel_dep(name = "molcertificate", version = "2.1", repo_name = "MOLCertificate") git_override( module_name = "molcertificate", - remote = "https://github.com/google/macops-molcertificate.git", commit = "34f0ccf68a34a07cc636ada89057c529f90bec3a", + remote = "https://github.com/google/macops-molcertificate.git", ) bazel_dep(name = "molauthenticatingurlsession", version = "3.0", repo_name = "MOLAuthenticatingURLSession") git_override( module_name = "molauthenticatingurlsession", - remote = "https://github.com/google/macops-molauthenticatingurlsession.git", commit = "0a50a67f29d635a4012981714c1dedef9ac25fe6", + remote = "https://github.com/google/macops-molauthenticatingurlsession.git", ) bazel_dep(name = "molcodesignchecker", version = "3.0", repo_name = "MOLCodesignChecker") git_override( module_name = "molcodesignchecker", - remote = "https://github.com/google/macops-molcodesignchecker.git", commit = "5060bcc8baa90bae3b0ca705d14850328bbbec53", + remote = "https://github.com/google/macops-molcodesignchecker.git", ) bazel_dep(name = "molxpcconnection", version = "2.1", repo_name = "MOLXPCConnection") git_override( module_name = "molxpcconnection", - remote = "https://github.com/russellhancox/macops-molxpcconnection.git", commit = "da816dc49becac96d941ef6a5c4153ed39d1fe7c", + remote = "https://github.com/russellhancox/macops-molxpcconnection.git", ) non_module_deps = use_extension("//:non_module_deps.bzl", "non_module_deps") @@ -52,7 +49,6 @@ use_repo(non_module_deps, "OCMock") bazel_dep(name = "hedron_compile_commands", dev_dependency = True) git_override( module_name = "hedron_compile_commands", - remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git", commit = "0e990032f3c5a866e72615cf67e5ce22186dcb97", + remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git", ) - diff --git a/Source/gui/SNTBinaryMessageWindowController.m b/Source/gui/SNTBinaryMessageWindowController.m index 5271e5367..a88b75698 100644 --- a/Source/gui/SNTBinaryMessageWindowController.m +++ b/Source/gui/SNTBinaryMessageWindowController.m @@ -93,8 +93,9 @@ - (void)loadWindow { if (eventDetailText) { [self.openEventButton setTitle:eventDetailText]; // Require the button keyEquivalent set to be CMD + Return - [self.openEventButton setKeyEquivalent:@"\r"]; // Return Key - [self.openEventButton setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; // Command Key + [self.openEventButton setKeyEquivalent:@"\r"]; // Return Key + [self.openEventButton + setKeyEquivalentModifierMask:NSEventModifierFlagCommand]; // Command Key } } diff --git a/Source/santad/BUILD b/Source/santad/BUILD index 7d3f3fe65..db5d6b986 100644 --- a/Source/santad/BUILD +++ b/Source/santad/BUILD @@ -913,9 +913,6 @@ santa_unit_test( santa_unit_test( name = "SantadTest", srcs = ["SantadTest.mm"], - structured_resources = [ - "//Source/santad/testdata:binaryrules_testdata", - ], minimum_os_version = "11.0", sdk_dylibs = [ "bsm", @@ -924,6 +921,9 @@ santa_unit_test( sdk_frameworks = [ "DiskArbitration", ], + structured_resources = [ + "//Source/santad/testdata:binaryrules_testdata", + ], tags = ["exclusive"], deps = [ ":EndpointSecurityMessage", diff --git a/Source/santad/EventProviders/DiskArbitrationTestUtil.mm b/Source/santad/EventProviders/DiskArbitrationTestUtil.mm index 09c651987..e65f6be95 100644 --- a/Source/santad/EventProviders/DiskArbitrationTestUtil.mm +++ b/Source/santad/EventProviders/DiskArbitrationTestUtil.mm @@ -152,13 +152,13 @@ void DARegisterDiskAppearedCallback(DASessionRef session, CFDictionaryRef __null void DARegisterDiskDisappearedCallback(DASessionRef session, CFDictionaryRef __nullable match, DADiskDisappearedCallback callback, - void *__nullable context) {}; + void *__nullable context){}; void DARegisterDiskDescriptionChangedCallback(DASessionRef session, CFDictionaryRef __nullable match, CFArrayRef __nullable watch, DADiskDescriptionChangedCallback callback, - void *__nullable context) {}; + void *__nullable context){}; void DASessionSetDispatchQueue(DASessionRef session, dispatch_queue_t __nullable queue) { MockDiskArbitration *mockDA = [MockDiskArbitration mockDiskArbitration]; diff --git a/Source/santad/EventProviders/SNTEndpointSecurityDeviceManagerTest.mm b/Source/santad/EventProviders/SNTEndpointSecurityDeviceManagerTest.mm index 257cd34b2..483a1e1e0 100644 --- a/Source/santad/EventProviders/SNTEndpointSecurityDeviceManagerTest.mm +++ b/Source/santad/EventProviders/SNTEndpointSecurityDeviceManagerTest.mm @@ -387,16 +387,16 @@ - (void)testPerformStartupTasks { // Create mock disks with desired args MockDADisk * (^CreateMockDisk)(NSString *, NSString *) = ^MockDADisk *(NSString *mountOn, NSString *mountFrom) { - MockDADisk *mockDisk = [[MockDADisk alloc] init]; - mockDisk.diskDescription = @{ - @"DAVolumePath" : mountOn, // f_mntonname, - @"DADevicePath" : mountOn, // f_mntonname, - @"DAMediaBSDName" : mountFrom, // f_mntfromname, - }; - - return mockDisk; + MockDADisk *mockDisk = [[MockDADisk alloc] init]; + mockDisk.diskDescription = @{ + @"DAVolumePath" : mountOn, // f_mntonname, + @"DADevicePath" : mountOn, // f_mntonname, + @"DAMediaBSDName" : mountFrom, // f_mntfromname, }; + return mockDisk; + }; + // Reset the Mock DA property, setup disks and remount args, then trigger the test void (^PerformStartupTest)(NSArray *, NSArray *, SNTDeviceManagerStartupPreferences) = diff --git a/Source/santad/ProcessTree/BUILD b/Source/santad/ProcessTree/BUILD index 3e13917ae..4f3ea3f33 100644 --- a/Source/santad/ProcessTree/BUILD +++ b/Source/santad/ProcessTree/BUILD @@ -71,12 +71,12 @@ objc_library( name = "process_tree_test_helpers", srcs = ["process_tree_test_helpers.mm"], hdrs = ["process_tree_test_helpers.h"], + visibility = ["//Source/santad/ProcessTree:__subpackages__"], deps = [ ":process", ":process_tree", "@com_google_absl//absl/synchronization", ], - visibility = ["//Source/santad/ProcessTree:__subpackages__"], ) santa_unit_test( diff --git a/Source/santad/ProcessTree/annotations/BUILD b/Source/santad/ProcessTree/annotations/BUILD index d992e6c09..a10fd7ac2 100644 --- a/Source/santad/ProcessTree/annotations/BUILD +++ b/Source/santad/ProcessTree/annotations/BUILD @@ -14,8 +14,8 @@ cc_library( cc_library( name = "originator", - hdrs = ["originator.h"], srcs = ["originator.cc"], + hdrs = ["originator.h"], deps = [ ":annotator", "//Source/santad/ProcessTree:process", @@ -31,7 +31,7 @@ santa_unit_test( deps = [ ":originator", "//Source/santad/ProcessTree:process", - "//Source/santad/ProcessTree:process_tree_test_helpers", "//Source/santad/ProcessTree:process_tree_cc_proto", + "//Source/santad/ProcessTree:process_tree_test_helpers", ], ) diff --git a/Source/santad/ProcessTree/annotations/originator.cc b/Source/santad/ProcessTree/annotations/originator.cc index adc7bf5fc..9d9f216ad 100644 --- a/Source/santad/ProcessTree/annotations/originator.cc +++ b/Source/santad/ProcessTree/annotations/originator.cc @@ -18,10 +18,10 @@ #include #include -#include "absl/container/flat_hash_map.h" #include "Source/santad/ProcessTree/process.h" #include "Source/santad/ProcessTree/process_tree.h" #include "Source/santad/ProcessTree/process_tree.pb.h" +#include "absl/container/flat_hash_map.h" namespace ptpb = ::santa::pb::v1::process_tree; diff --git a/Source/santad/ProcessTree/annotations/originator.h b/Source/santad/ProcessTree/annotations/originator.h index edc7c7883..dc2891ffc 100644 --- a/Source/santad/ProcessTree/annotations/originator.h +++ b/Source/santad/ProcessTree/annotations/originator.h @@ -26,10 +26,10 @@ class OriginatorAnnotator : public Annotator { public: OriginatorAnnotator() : originator_(::santa::pb::v1::process_tree::Annotations::Originator:: - Annotations_Originator_UNSPECIFIED) {}; + Annotations_Originator_UNSPECIFIED){}; explicit OriginatorAnnotator( ::santa::pb::v1::process_tree::Annotations::Originator originator) - : originator_(originator) {}; + : originator_(originator){}; void AnnotateFork(ProcessTree &tree, const Process &parent, const Process &child) override; diff --git a/Testing/lint.sh b/Testing/lint.sh index b6aec0e7a..7b67ef28a 100755 --- a/Testing/lint.sh +++ b/Testing/lint.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -xo pipefail +set -xoe pipefail GIT_ROOT=$(git rev-parse --show-toplevel) diff --git a/WORKSPACE b/WORKSPACE index 62795ae8e..b4c4019d8 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -3,7 +3,6 @@ workspace(name = "santa") load( "@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", - "new_git_repository", ) load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") diff --git a/non_module_deps.bzl b/non_module_deps.bzl index fa157a62b..fa06d4465 100644 --- a/non_module_deps.bzl +++ b/non_module_deps.bzl @@ -1,13 +1,13 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") def _non_module_deps_impl(ctx): - # FMDB is used to access SQLite from Objective-C(++) code. - git_repository( - name = "FMDB", - remote = "https://github.com/ccgus/fmdb.git", - commit = "61e51fde7f7aab6554f30ab061cc588b28a97d04", - shallow_since = "1589301502 -0700", - build_file_content = """ + # FMDB is used to access SQLite from Objective-C(++) code. + git_repository( + name = "FMDB", + remote = "https://github.com/ccgus/fmdb.git", + commit = "61e51fde7f7aab6554f30ab061cc588b28a97d04", + shallow_since = "1589301502 -0700", + build_file_content = """ objc_library( name = "FMDB", srcs = glob(["src/fmdb/*.m"], exclude=["src/fmdb.m"]), @@ -17,12 +17,12 @@ objc_library( visibility = ["//visibility:public"], ) """, - ) + ) - # OCMock is used in several tests. - git_repository( - name = "OCMock", - build_file_content = """ + # OCMock is used in several tests. + git_repository( + name = "OCMock", + build_file_content = """ objc_library( name = "OCMock", testonly = 1, @@ -39,11 +39,11 @@ objc_library( visibility = ["//visibility:public"], ) """, - commit = "afd2c6924e8a36cb872bc475248b978f743c6050", # tag = v3.9.1 - patch_args = ["-p1"], - patches = ["//external_patches/OCMock:503.patch"], - remote = "https://github.com/erikdoe/ocmock", - shallow_since = "1635703064 +0100", -) + commit = "afd2c6924e8a36cb872bc475248b978f743c6050", # tag = v3.9.1 + patch_args = ["-p1"], + patches = ["//external_patches/OCMock:503.patch"], + remote = "https://github.com/erikdoe/ocmock", + shallow_since = "1635703064 +0100", + ) non_module_deps = module_extension(implementation = _non_module_deps_impl) From cc53e5b078398f73edb673b8bb3fd9eca76f2198 Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Mon, 6 May 2024 14:24:41 -0400 Subject: [PATCH 2/5] exo --- Testing/lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Testing/lint.sh b/Testing/lint.sh index 7b67ef28a..88f1630bf 100755 --- a/Testing/lint.sh +++ b/Testing/lint.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -xoe pipefail +set -exo pipefail GIT_ROOT=$(git rev-parse --show-toplevel) From 6baa659d63f50d5f0d0f3e66360f6c57f34f26fd Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Mon, 6 May 2024 14:31:28 -0400 Subject: [PATCH 3/5] non_module_deps.bzl lint fixes --- non_module_deps.bzl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/non_module_deps.bzl b/non_module_deps.bzl index fa06d4465..87fb9903d 100644 --- a/non_module_deps.bzl +++ b/non_module_deps.bzl @@ -1,6 +1,8 @@ +"""Modules for dependencies not included in the Bazel Central Registry""" + load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") -def _non_module_deps_impl(ctx): +def _non_module_deps_impl(_): # FMDB is used to access SQLite from Objective-C(++) code. git_repository( name = "FMDB", From 028c4d3d101ca98607a8e2bc9773954be4c90393 Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Mon, 6 May 2024 16:16:42 -0400 Subject: [PATCH 4/5] use pyink --- .pyink-config | 5 ++ Testing/fix.sh | 5 +- Testing/integration/actions/start_vm.py | 87 ++++++++++++++++-------- Testing/integration/actions/update_vm.py | 27 ++++---- Testing/lint.sh | 8 +-- 5 files changed, 86 insertions(+), 46 deletions(-) create mode 100644 .pyink-config diff --git a/.pyink-config b/.pyink-config new file mode 100644 index 000000000..900d68de7 --- /dev/null +++ b/.pyink-config @@ -0,0 +1,5 @@ +[tool.pyink] +pyink = true +line-length = 88 +pyink-indentation = 2 +pyink-use-majority-quotes = true diff --git a/Testing/fix.sh b/Testing/fix.sh index 9969396f5..79ee9e94c 100755 --- a/Testing/fix.sh +++ b/Testing/fix.sh @@ -1,5 +1,6 @@ #!/bin/bash GIT_ROOT=$(git rev-parse --show-toplevel) -find $GIT_ROOT \( -name "*.m" -o -name "*.h" -o -name "*.mm" -o -name "*.cc" \) -exec xcrun clang-format -i {} \+ -buildifier --lint=fix -r $GIT_ROOT +find ${GIT_ROOT} \( -name "*.m" -o -name "*.h" -o -name "*.mm" -o -name "*.cc" \) -exec xcrun clang-format -i {} \+ +buildifier --lint=fix -r ${GIT_ROOT} +python3 -m pyink --config ${GIT_ROOT}/.pyink-config ${GIT_ROOT} diff --git a/Testing/integration/actions/start_vm.py b/Testing/integration/actions/start_vm.py index fad37dbac..f702a7396 100644 --- a/Testing/integration/actions/start_vm.py +++ b/Testing/integration/actions/start_vm.py @@ -25,7 +25,7 @@ logging.fatal("Image name should be .tar.gz file") tar_path = VMS_DIR / args.vm - extracted_path = pathlib.Path(str(tar_path)[:-len(".tar.gz")]) + extracted_path = pathlib.Path(str(tar_path)[: -len(".tar.gz")]) with tempfile.TemporaryDirectory() as snapshot_dir: logging.info(f"Snapshot: {snapshot_dir}") @@ -34,27 +34,29 @@ # Get a JIT runner key github_token = os.environ["RUNNER_REG_TOKEN"] - body = json.dumps({ - "name": os.environ["GITHUB_RUN_ID"] + " inner", - "runner_group_id":1, - "labels":[ - "self-hosted", - "macOS", - "ARM64", - "e2e-vm", - ], - "work_folder":"/tmp/_work", - }) + body = json.dumps( + { + "name": os.environ["GITHUB_RUN_ID"] + " inner", + "runner_group_id": 1, + "labels": [ + "self-hosted", + "macOS", + "ARM64", + "e2e-vm", + ], + "work_folder": "/tmp/_work", + } + ) owner, repo = os.environ["GITHUB_REPOSITORY"].split("/", 1) request = urllib.request.Request( - f"https://api.github.com/repos/{owner}/{repo}/actions/runners/generate-jitconfig", - headers={ - "Content-Type": "application/json", - "Accept": "application/vnd.github+json", - "Authorization": f"Bearer {github_token}", - "X-GitHub-Api-Version": "2022-11-28", - }, - data=body.encode("utf-8"), + f"https://api.github.com/repos/{owner}/{repo}/actions/runners/generate-jitconfig", + headers={ + "Content-Type": "application/json", + "Accept": "application/vnd.github+json", + "Authorization": f"Bearer {github_token}", + "X-GitHub-Api-Version": "2022-11-28", + }, + data=body.encode("utf-8"), ) with urllib.request.urlopen(request) as response: jit_config = json.loads(response.read())["encoded_jit_config"] @@ -63,13 +65,26 @@ # Create a disk image to inject startup script init_dmg = pathlib.Path(snapshot_dir) / "init.dmg" - subprocess.check_output(["hdiutil", "create", "-attach", "-size", "1G", - "-fs", "APFS", "-volname", "init", init_dmg]) + subprocess.check_output( + [ + "hdiutil", + "create", + "-attach", + "-size", + "1G", + "-fs", + "APFS", + "-volname", + "init", + init_dmg, + ] + ) init_dmg_mount = pathlib.Path("/Volumes/init/") # And populate startup script with runner and JIT key with open(init_dmg_mount / "run.sh", "w") as run_sh: - run_sh.write(f"""#!/bin/sh + run_sh.write( + f"""#!/bin/sh set -xeuo pipefail curl -L -o /tmp/runner.tar.gz 'https://github.com/actions/runner/releases/download/v2.316.0/actions-runner-osx-arm64-2.316.0.tar.gz' @@ -78,7 +93,8 @@ cd /tmp/runner tar -xzf /tmp/runner.tar.gz ./run.sh --jitconfig '{jit_config}' -""") +""" + ) os.chmod(init_dmg_mount / "run.sh", 0o755) subprocess.check_output(["hdiutil", "detach", init_dmg_mount]) @@ -86,19 +102,34 @@ # Create a disk image for USB testing usb_dmg = pathlib.Path(snapshot_dir) / "usb.dmg" - subprocess.check_output(["hdiutil", "create", "-size", "100M", - "-fs", "ExFAT", "-volname", "USB", usb_dmg]) + subprocess.check_output( + [ + "hdiutil", + "create", + "-size", + "100M", + "-fs", + "ExFAT", + "-volname", + "USB", + usb_dmg, + ] + ) logging.info("Created usb.dmg") try: logging.info("Starting VM") subprocess.check_output( - [args.vmcli, pathlib.Path(snapshot_dir) / extracted_path.name, init_dmg, usb_dmg], + [ + args.vmcli, + pathlib.Path(snapshot_dir) / extracted_path.name, + init_dmg, + usb_dmg, + ], timeout=TIMEOUT, ) except subprocess.TimeoutExpired: logging.warning("VM timed out") logging.info("VM deleted") - diff --git a/Testing/integration/actions/update_vm.py b/Testing/integration/actions/update_vm.py index db11c03e2..a1088d528 100644 --- a/Testing/integration/actions/update_vm.py +++ b/Testing/integration/actions/update_vm.py @@ -31,7 +31,7 @@ logging.fatal("Image name should be .tar.gz file") tar_path = VMS_DIR / tar_name - extracted_path = pathlib.Path(str(tar_path)[:-len(".tar.gz")]) + extracted_path = pathlib.Path(str(tar_path)[: -len(".tar.gz")]) if "GOOGLE_APPLICATION_CREDENTIALS" not in os.environ: logging.fatal("Missing GCS credentials file") @@ -49,7 +49,8 @@ local_ctime = 0 if blob.updated > datetime.datetime.fromtimestamp( - local_ctime, tz=datetime.timezone.utc): + local_ctime, tz=datetime.timezone.utc + ): logging.info(f"VM {extracted_path} not present or not up to date, downloading...") # Remove the old version of the image if present @@ -78,13 +79,17 @@ logging.info("Verifying signature...") # Verify the signature of the hash file is OK - subprocess.check_output([ - COSIGN, - "verify-blob", - "--key", PUBKEY, - "--signature", sig_path, - hash_path, - ]) + subprocess.check_output( + [ + COSIGN, + "verify-blob", + "--key", + PUBKEY, + "--signature", + sig_path, + hash_path, + ] + ) # Then verify that the hash matches what we downloaded subprocess.check_output( ["shasum", "-a", "256", "-c", hash_path], @@ -92,7 +97,5 @@ ) logging.info("Extracting...") - subprocess.check_output( - ["tar", "-C", VMS_DIR, "-x", "-S", "-z", "-f", tar_path] - ) + subprocess.check_output(["tar", "-C", VMS_DIR, "-x", "-S", "-z", "-f", tar_path]) tar_path.unlink() diff --git a/Testing/lint.sh b/Testing/lint.sh index 88f1630bf..8fb06d0d1 100755 --- a/Testing/lint.sh +++ b/Testing/lint.sh @@ -3,12 +3,12 @@ set -exo pipefail GIT_ROOT=$(git rev-parse --show-toplevel) -find $GIT_ROOT \( -name "*.m" -o -name "*.h" -o -name "*.mm" -o -name "*.cc" \) -exec clang-format --Werror --dry-run {} \+ +find ${GIT_ROOT} \( -name "*.m" -o -name "*.h" -o -name "*.mm" -o -name "*.cc" \) -exec clang-format --Werror --dry-run {} \+ ! git grep -EIn $'[ \t]+$' -- ':(exclude)*.patch' go install github.com/bazelbuild/buildtools/buildifier@latest -~/go/bin/buildifier --lint=warn -r $GIT_ROOT +~/go/bin/buildifier --lint=warn -r ${GIT_ROOT} -python3 -m pip install -q pylint -find $GIT_ROOT \( -name "*.py" \) -exec python3 -m pylint --score n --rcfile=$GIT_ROOT/.pylintrc {} \+ +python3 -m pip install -q pyink +python3 -m pyink --config ${GIT_ROOT}/.pyink-config --check ${GIT_ROOT} From 0f31041670c69c828770dae78cebc4d88447e1ee Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Mon, 6 May 2024 16:17:20 -0400 Subject: [PATCH 5/5] remove .pylint --- .pylintrc | 429 ------------------------------------------------------ 1 file changed, 429 deletions(-) delete mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index be7798e81..000000000 --- a/.pylintrc +++ /dev/null @@ -1,429 +0,0 @@ -# This Pylint rcfile contains a best-effort configuration to uphold the -# best-practices and style described in the Google Python style guide: -# https://google.github.io/styleguide/pyguide.html -# -# Its canonical open-source location is: -# https://google.github.io/styleguide/pylintrc - -[MASTER] - -# Files or directories to be skipped. They should be base names, not paths. -ignore=third_party - -# Files or directories matching the regex patterns are skipped. The regex -# matches against base names, not paths. -ignore-patterns= - -# Pickle collected data for later comparisons. -persistent=no - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Use multiple processes to speed up Pylint. -jobs=4 - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -#enable= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -disable=abstract-method, - apply-builtin, - arguments-differ, - attribute-defined-outside-init, - backtick, - bad-option-value, - basestring-builtin, - buffer-builtin, - c-extension-no-member, - consider-using-enumerate, - cmp-builtin, - cmp-method, - coerce-builtin, - coerce-method, - delslice-method, - div-method, - duplicate-code, - eq-without-hash, - execfile-builtin, - file-builtin, - filter-builtin-not-iterating, - fixme, - getslice-method, - global-statement, - hex-method, - idiv-method, - implicit-str-concat, - import-error, - import-self, - import-star-module-level, - inconsistent-return-statements, - input-builtin, - intern-builtin, - invalid-str-codec, - locally-disabled, - long-builtin, - long-suffix, - map-builtin-not-iterating, - misplaced-comparison-constant, - missing-function-docstring, - metaclass-assignment, - next-method-called, - next-method-defined, - no-absolute-import, - no-else-break, - no-else-continue, - no-else-raise, - no-else-return, - no-init, # added - no-member, - no-name-in-module, - no-self-use, - nonzero-method, - oct-method, - old-division, - old-ne-operator, - old-octal-literal, - old-raise-syntax, - parameter-unpacking, - print-statement, - raising-string, - range-builtin-not-iterating, - raw_input-builtin, - rdiv-method, - reduce-builtin, - relative-import, - reload-builtin, - round-builtin, - setslice-method, - signature-differs, - standarderror-builtin, - suppressed-message, - sys-max-int, - too-few-public-methods, - too-many-ancestors, - too-many-arguments, - too-many-boolean-expressions, - too-many-branches, - too-many-instance-attributes, - too-many-locals, - too-many-nested-blocks, - too-many-public-methods, - too-many-return-statements, - too-many-statements, - trailing-newlines, - unichr-builtin, - unicode-builtin, - unnecessary-pass, - unpacking-in-except, - useless-else-on-loop, - useless-object-inheritance, - useless-suppression, - using-cmp-argument, - wrong-import-order, - xrange-builtin, - zip-builtin-not-iterating, - - -[REPORTS] - -# Set the output format. Available formats are text, parseable, colorized, msvs -# (visual studio) and html. You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=no - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -#msg-template= - - -[BASIC] - -# Good variable names which should always be accepted, separated by a comma -good-names=main,_ - -# Bad variable names which should always be refused, separated by a comma -bad-names= - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=no - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl - -# Regular expression matching correct function names -function-rgx=^(?:(?PsetUp|tearDown|setUpModule|tearDownModule)|(?P_?[A-Z][a-zA-Z0-9]*)|(?P_?[a-z][a-z0-9_]*))$ - -# Regular expression matching correct variable names -variable-rgx=^[a-z][a-z0-9_]*$ - -# Regular expression matching correct constant names -const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ - -# Regular expression matching correct attribute names -attr-rgx=^_{0,2}[a-z][a-z0-9_]*$ - -# Regular expression matching correct argument names -argument-rgx=^[a-z][a-z0-9_]*$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=^[a-z][a-z0-9_]*$ - -# Regular expression matching correct class names -class-rgx=^_?[A-Z][a-zA-Z0-9]*$ - -# Regular expression matching correct module names -module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$ - -# Regular expression matching correct method names -method-rgx=(?x)^(?:(?P_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P_{0,2}[a-z][a-z0-9_]*))$ - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=10 - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - - -[FORMAT] - -# Maximum number of characters on a single line. -max-line-length=80 - -# TODO(https://github.com/PyCQA/pylint/issues/3352): Direct pylint to exempt -# lines made too long by directives to pytype. - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines=(?x)( - ^\s*(\#\ )??$| - ^\s*(from\s+\S+\s+)?import\s+.+$) - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=yes - -# Maximum number of lines in a module -max-module-lines=99999 - -# String used as indentation unit. The internal Google style guide mandates 2 -# spaces. Google's externaly-published style guide says 4, consistent with -# PEP 8. Here, we use 2 spaces, for conformity with many open-sourced Google -# projects (like TensorFlow). -indent-string=' ' - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format= - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -notes=TODO - - -[STRING] - -# This flag controls whether inconsistent-quotes generates a warning when the -# character used as a quote delimiter is used inconsistently within a module. -check-quote-consistency=yes - - -[VARIABLES] - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_) - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_,_cb - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging,absl.logging,tensorflow.io.logging - - -[SIMILARITIES] - -# Minimum lines number of a similarity. -min-similarity-lines=4 - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=yes - -# Ignore imports when computing similarities. -ignore-imports=no - - -[SPELLING] - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[IMPORTS] - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=regsub, - TERMIOS, - Bastion, - rexec, - sets - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant, absl - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__, - __new__, - setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict, - _fields, - _replace, - _source, - _make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls, - class_ - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=StandardError, - Exception, - BaseException