mirror of
https://github.com/cmur2/kube-stale-resources.git
synced 2024-12-22 02:54:24 +01:00
module: add formatting and linting configuration
- apply formatting
This commit is contained in:
parent
d5bb54cc8e
commit
79779b6377
5
.pylintrc
Normal file
5
.pylintrc
Normal file
@ -0,0 +1,5 @@
|
||||
[FORMAT]
|
||||
max-line-length=121
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=invalid-name,missing-module-docstring,missing-function-docstring
|
3
.style.yapf
Normal file
3
.style.yapf
Normal file
@ -0,0 +1,3 @@
|
||||
[style]
|
||||
based_on_style = pep8
|
||||
column_limit = 120
|
@ -4,10 +4,11 @@ import argparse
|
||||
import re
|
||||
import sys
|
||||
|
||||
from typing import (List, Tuple, IO)
|
||||
|
||||
import requests
|
||||
import yaml
|
||||
|
||||
from typing import (List, Any, Dict, Tuple, IO)
|
||||
K8sResourceIdentifier = Tuple[str, str, str, str]
|
||||
|
||||
HEADERS = {"Content-Type": "application/json"}
|
||||
@ -98,7 +99,7 @@ def get_compact_resource_identifiers(tuples: List[K8sResourceIdentifier]) -> Lis
|
||||
return [namespace + ':' + apiVersion + ':' + kind + ':' + name for namespace, apiVersion, kind, name in tuples]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Utility to detect k8s configuration drift.')
|
||||
|
||||
parser.add_argument('-f',
|
||||
@ -121,7 +122,7 @@ if __name__ == "__main__":
|
||||
if args.blacklist_file:
|
||||
print(f'Reading blacklist file {args.blacklist_file}...')
|
||||
with open(args.blacklist_file, 'r') as f:
|
||||
blacklist_regexs += filter(lambda x: not re.match(r'^\s*$', x), f.read().split('\n'))
|
||||
blacklist_regexs += list(filter(lambda x: not re.match(r'^\s*$', x), f.read().split('\n')))
|
||||
|
||||
print('Retrieving target state...')
|
||||
if args.target_manifests_file == '-':
|
||||
@ -154,3 +155,7 @@ if __name__ == "__main__":
|
||||
counter += 1
|
||||
print(' ' + x)
|
||||
print("..", counter, "entries")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user