Skip to content

Commit

Permalink
Added pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
TGWolf committed Sep 11, 2022
1 parent 2a800b5 commit e6023bb
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/cicd-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
with:
python-version: '3.10'
- name: Run Pur
env:
SHOW_ERRORS: true
run: bash <(curl -s https://raw.githubusercontent.com/CICDToolbox/pur/master/pipeline.sh)

pycodestyle:
Expand All @@ -40,6 +38,18 @@ jobs:
- name: Run Pycodestyle
run: bash <(curl -s https://raw.githubusercontent.com/CICDToolbox/pycodestyle/master/pipeline.sh)

pylint:
runs-on: ubuntu-latest
name: Pylint
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Run Pylint
run: bash <(curl -s https://raw.githubusercontent.com/CICDToolbox/pylint/master/pipeline.sh)

awesomebot:
name: Awesomebot
runs-on: ubuntu-latest
Expand Down Expand Up @@ -83,6 +93,7 @@ jobs:
- bandit
- pur
- pycodestyle
- pylint
- awesomebot
- shellcheck
- yaml-lint
Expand Down
5 changes: 5 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[FORMAT]
max-line-length=240

[MESSAGES CONTROL]
disable=broad-except
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ This changelog was automatically generated using [Caretaker](https://github.com/

### [Unreleased](https://github.com/AWSToolbox/list-rds-instances/compare/v0.1.1...HEAD)

- Add greetings [`[head]`](https://github.com/AWSToolbox/list-rds-instances/commit/)
- Added pylint [`[head]`](https://github.com/AWSToolbox/list-rds-instances/commit/)

- Add greetings [`[2a800b5]`](https://github.com/AWSToolbox/list-rds-instances/commit/2a800b5d7ffd960ce9bab0c471192bc1d66aaac4)

- Fix codeql errors [`[bdb4d42]`](https://github.com/AWSToolbox/list-rds-instances/commit/bdb4d428b5deaffad0a856dd47006ec2c1d7f5e4)

Expand Down
16 changes: 9 additions & 7 deletions src/list-rds-instances.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python
# pylint: disable=C0103

"""
Example Usage:
Expand All @@ -9,8 +10,9 @@
from __future__ import print_function

import argparse
import boto3
import sys
import boto3
import botocore

from prettytable import PrettyTable

Expand All @@ -35,7 +37,7 @@ def main(cmdline=None) -> None:
else:
client = boto3.client('rds')

results = query_api(client, args)
results = query_api(client)
display_results(results)


Expand All @@ -51,7 +53,7 @@ def make_parser():
return parser


def query_api(client, args):
def query_api(client):
"""
Query the API
"""
Expand All @@ -60,16 +62,16 @@ def query_api(client, args):

try:
response = client.describe_db_instances()
except EndpointConnectionError as e:
print("ERROR: %s (Probably an invalid region!)" % e)
except botocore.exceptions.EndpointConnectionError as e:
print(f'ERROR: {e} (Probably an invalid region!)')
except Exception as e:
print("Unknown error: " + str(e))
else:
if 'DBInstances' in response:
for parts in response['DBInstances']:
if 'AvailabilityZone' in parts:
if 'SecondaryAvailabilityZone' in parts:
AZS = '%s & %s' % (parts['AvailabilityZone'], parts['SecondaryAvailabilityZone'])
AZS = f'{parts["AvailabilityZone"]} & {parts["SecondaryAvailabilityZone"]}'
else:
AZS = parts['AvailabilityZone']
else:
Expand Down Expand Up @@ -117,7 +119,7 @@ def display_results(results):
parts['Status'],
parts['AvailabilityZone'],
parts['PubliclyAccessible'],
'%s GB' % parts['AllocatedStorage'],
f'{parts["AllocatedStorage"]} GB',
parts['StorageEncrypted'],
parts['Engine'],
parts['EngineVersion'],
Expand Down

0 comments on commit e6023bb

Please sign in to comment.