Skip to content

Commit

Permalink
Fix linter error in gsuite_workspace_calendar_external_sharing.py (#1383
Browse files Browse the repository at this point in the history
)
  • Loading branch information
le4ker authored Oct 10, 2024
1 parent 49f2deb commit 67fa051
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check-deprecated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
pull_request:

permissions:
contents: read
contents: read

jobs:
check_removed_rules:
Expand All @@ -20,10 +20,10 @@ jobs:
pypi.org:443
- name: Checkout panther-analysis
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 #v4.2.1

- name: Fetch Release
run: |
git fetch --depth=1 origin release
git fetch --depth=1 origin develop
- name: Set python version
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 #v5.2.0
Expand All @@ -39,4 +39,4 @@ jobs:
- name: Check for Removed Rules
run: |
pipenv run make check-deprecated
15 changes: 6 additions & 9 deletions .scripts/deleted_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@

def get_deleted_ids() -> set[str]:
# Run git diff, get output
result = subprocess.run(['git', 'diff', 'origin/release', 'HEAD'], capture_output=True)
result = subprocess.run(["git", "diff", "origin/develop", "HEAD"], capture_output=True)
if result.stderr:
raise Exception(result.stderr.decode("utf-8"))

ids = set()
for line in result.stdout.decode("utf-8").split("\n"):
if m := diff_pattern.match(line):
# Add the ID to the list
ids.add(m.group(1))

return ids


def get_deprecated_ids() -> set[str]:
""" Returns all the IDs listed in `deprecated.txt`. """
"""Returns all the IDs listed in `deprecated.txt`."""
with open("deprecated.txt", "r") as f:
return set(f.read().split("\n"))

Expand All @@ -43,6 +43,7 @@ def check(_):
else:
print("✅ No unaccounted deletions found! You're in the clear! 👍")


def remove(args):
api_token = args.api_token or os.environ.get("PANTHER_API_TOKEN")
api_host = args.api_host or os.environ.get("PANTHER_API_HOST")
Expand All @@ -61,11 +62,7 @@ def remove(args):
ids = list(get_deprecated_ids())

pat_args = argparse.Namespace(
analysis_id = ids,
query_id = [],
confirm_bypass = True,
api_token = api_token,
api_host = api_host
analysis_id=ids, query_id=[], confirm_bypass=True, api_token=api_token, api_host=api_host
)

logging.basicConfig(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ def title(event):
return (
f"GSuite workspace setting for default calendar sharing was changed by "
f"[{event.deep_get('actor', 'email', default='<UNKNOWN_EMAIL>')}] "
f"from [{event.deep_get('parameters', 'OLD_VALUE', default='<NO_OLD_SETTING_FOUND>')}] "
f"to [{event.deep_get('parameters', 'NEW_VALUE', default='<NO_NEW_SETTING_FOUND>')}]"
+ f"from [{event.deep_get('parameters', 'OLD_VALUE', default='<NO_OLD_SETTING_FOUND>')}] "
+ "to [{event.deep_get('parameters', 'NEW_VALUE', default='<NO_NEW_SETTING_FOUND>')}]"
)

0 comments on commit 67fa051

Please sign in to comment.