Skip to content

Commit 84d73e8

Browse files
authored
Merge pull request aws#131 from mattsb42-aws/linting
Decrypt oracle linting
2 parents f685003 + e227ea8 commit 84d73e8

File tree

9 files changed

+50
-28
lines changed

9 files changed

+50
-28
lines changed

.travis.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -285,23 +285,26 @@ matrix:
285285
# env:
286286
# DECRYPT_ORACLE=1
287287
# TOXENV=doc8
288-
# Pending linting cleanup
289-
#- python: 3.6
290-
# env:
291-
# DECRYPT_ORACLE=1
292-
# TOXENV=flake8
293-
#- python: 3.6
294-
# env:
295-
# DECRYPT_ORACLE=1
296-
# TOXENV=pylint
297-
#- python: 3.6
298-
# env:
299-
# DECRYPT_ORACLE=1
300-
# TOXENV=flake8-tests
301-
#- python: 3.6
302-
# env:
303-
# DECRYPT_ORACLE=1
304-
# TOXENV=pylint-tests
288+
- python: 3.6
289+
env:
290+
DECRYPT_ORACLE=1
291+
TOXENV=flake8
292+
stage: Decrypt Oracle Formatting Checks
293+
- python: 3.6
294+
env:
295+
DECRYPT_ORACLE=1
296+
TOXENV=pylint
297+
stage: Decrypt Oracle Formatting Checks
298+
- python: 3.6
299+
env:
300+
DECRYPT_ORACLE=1
301+
TOXENV=flake8-tests
302+
stage: Decrypt Oracle Formatting Checks
303+
- python: 3.6
304+
env:
305+
DECRYPT_ORACLE=1
306+
TOXENV=pylint-tests
307+
stage: Decrypt Oracle Formatting Checks
305308
install: pip install tox
306309
script:
307310
- |

decrypt_oracle/.chalice/pipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Generate the CloudFormation template for the deployment pipeline.
3-
"""
1+
"""Generate the CloudFormation template for the deployment pipeline."""
42
import argparse
53
import getpass
64
import logging
@@ -36,6 +34,7 @@ class AllowEverywhere(AWS.Statement):
3634
"""Shortcut for creating IAM Statements that Allow to Resource "*"."""
3735

3836
def __init__(self, *args, **kwargs):
37+
"""Set up override values."""
3938
my_kwargs = dict(Effect=AWS.Allow, Resource=["*"])
4039
my_kwargs.update(kwargs)
4140
super(AllowEverywhere, self).__init__(*args, **my_kwargs)
@@ -155,6 +154,7 @@ def _pipeline(
155154
github_branch: str,
156155
github_access_token: troposphere.AWSProperty,
157156
) -> codepipeline.Pipeline:
157+
# pylint: disable=too-many-locals,too-many-arguments
158158
"""Build and return the CodePipeline pipeline resource."""
159159
_source_output = "SourceOutput"
160160
get_source = codepipeline.Stages(

decrypt_oracle/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
"""Shim to pull decryption oracle app into expected location for Chalice."""
14-
from aws_encryption_sdk_decrypt_oracle.app import APP as app
14+
from aws_encryption_sdk_decrypt_oracle.app import APP as app # noqa pylint: disable=unused-import

decrypt_oracle/setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import_order_style = google
2020
application_import_names = aws_encryption_sdk_decryption_oracle
2121
builtins = raw_input
2222
ignore =
23-
# Ignoring D205 and D400 because of false positives
24-
D205, D400,
23+
# Ignoring D205, D400, and D401 because of false positives
24+
D205, D400, D401,
2525
# E203 is not PEP8 compliant https://github.com/ambv/black#slices
2626
E203,
2727
# W503 is not PEP8 compliant https://github.com/ambv/black#line-breaks--binary-operators

decrypt_oracle/src/aws_encryption_sdk_decrypt_oracle/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""Decrypt Oracle using the AWS Encryption SDK for Python."""
13+
"""Decrypt Oracle powered by the AWS Encryption SDK for Python."""
1414
import json
1515
import logging
1616
import os

decrypt_oracle/src/aws_encryption_sdk_decrypt_oracle/key_providers/counting.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(self) -> None:
3434

3535

3636
class CountingMasterKey(MasterKey):
37-
"""Master key that generates deterministic data keys and decrypts a pre-defined
37+
r"""Master key that generates deterministic data keys and decrypts a pre-defined
3838
encrypted data key value to that deterministic data keys.
3939
4040
Generated/decrypted data keys are of the form: ``\01\02\03\04...`` counting

decrypt_oracle/src/aws_encryption_sdk_decrypt_oracle/key_providers/null.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _null_plaintext_data_key(algorithm: AlgorithmSuite) -> bytes:
6767
return b"\x00" * algorithm.data_key_len
6868

6969
def _generate_data_key(self, algorithm: AlgorithmSuite, encryption_context: Dict[Text, Text]) -> DataKey:
70-
"""NullMasterKey does not support generate_data_key
70+
""":class:`NullMasterKey` does not support generate_data_key
7171
7272
:param algorithm: Algorithm on which to base data key
7373
:type algorithm: aws_encryption_sdk.identifiers.Algorithm
@@ -81,7 +81,7 @@ def _generate_data_key(self, algorithm: AlgorithmSuite, encryption_context: Dict
8181
def _encrypt_data_key(
8282
self, data_key: DataKey, algorithm: AlgorithmSuite, encryption_context: Dict[Text, Text]
8383
) -> NoReturn:
84-
"""NullMasterKey does not support encrypt_data_key
84+
""":class:`NullMasterKey` does not support encrypt_data_key
8585
8686
:param data_key: Unencrypted data key
8787
:type data_key: :class:`aws_encryption_sdk.structures.RawDataKey`

decrypt_oracle/test/pylintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[MESSAGES CONTROL]
2+
# Disabling messages that we either don't care about for tests or are necessary to break for tests.
3+
disable =
4+
invalid-name, # we prefer long, descriptive, names for tests
5+
missing-docstring, # we don't write docstrings for tests
6+
bad-continuation, # we let black handle this
7+
ungrouped-imports, # we let isort handle this
8+
9+
[FORMAT]
10+
max-line-length = 120
11+
12+
[REPORTS]
13+
msg-template = {path}:{line}: [{msg_id}({symbol}), {obj}] {msg}

decrypt_oracle/tox.ini

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ deps =
161161
commands =
162162
flake8 \
163163
src/aws_encryption_sdk_decrypt_oracle/ \
164+
app.py \
164165
setup.py \
166+
.chalice/pipeline.py \
165167
#doc/conf.py \
166168
{posargs}
167169

@@ -182,13 +184,16 @@ commands =
182184
basepython = python3
183185
deps =
184186
-rtest/requirements.txt
187+
{[testenv:generate-pipeline]deps}
185188
pyflakes
186189
pylint
187190
commands =
188191
pylint \
189192
--rcfile=src/pylintrc \
190193
src/aws_encryption_sdk_decrypt_oracle/ \
194+
app.py \
191195
setup.py \
196+
.chalice/pipeline.py \
192197
{posargs}
193198

194199
[testenv:pylint-tests]
@@ -198,7 +203,6 @@ commands =
198203
pylint \
199204
--rcfile=test/pylintrc \
200205
test/unit/ \
201-
test/functional/ \
202206
test/integration/ \
203207
{posargs}
204208

@@ -210,6 +214,7 @@ commands =
210214
black --line-length 120 \
211215
src/aws_encryption_sdk_decrypt_oracle/ \
212216
setup.py \
217+
app.py \
213218
#doc/conf.py \
214219
test/ \
215220
.chalice/pipeline.py \
@@ -244,6 +249,7 @@ commands = isort -rc \
244249
#doc \
245250
setup.py \
246251
.chalice/pipeline.py \
252+
app.py \
247253
{posargs}
248254

249255
[testenv:isort-check]

0 commit comments

Comments
 (0)