Skip to content

Commit

Permalink
🎓 Standardize comments
Browse files Browse the repository at this point in the history
Start capitalized and after 2 spaces when on the same line as code
  • Loading branch information
KevinHock committed Sep 19, 2019
1 parent bc4f922 commit 0b2c0e1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion detect_secrets/core/bidirectional_iterator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class BidirectionalIterator(object):
def __init__(self, collection):
self.collection = collection
self.index = -1 # starts on -1, as index is increased _before_ getting result
self.index = -1 # Starts on -1, as index is increased _before_ getting result
self.step_back_once = False

def __next__(self):
Expand Down
8 changes: 4 additions & 4 deletions detect_secrets/plugins/artifactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class ArtifactoryDetector(RegexBasedDetector):
secret_type = 'Artifactory Credentials'

denylist = [
# artifactory tokens begin with AKC
re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'), # api token
# artifactory encrypted passwords begin with AP[A-Z]
re.compile(r'(?:\s|=|:|"|^)AP[\dABCDEF][a-zA-Z0-9]{8,}'), # password
# Artifactory tokens begin with AKC
re.compile(r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}'), # API token
# Artifactory encrypted passwords begin with AP[A-Z]
re.compile(r'(?:\s|=|:|"|^)AP[\dABCDEF][a-zA-Z0-9]{8,}'), # Password
]
2 changes: 1 addition & 1 deletion detect_secrets/plugins/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def verify_aws_secret_access_key(key, secret): # pragma: no cover
return True


def _sign(key, message, hex=False): # pragma: no cover
def _sign(key, message, hex=False): # pragma: no cover
value = hmac.new(key, message.encode('utf-8'), hashlib.sha256)
if not hex:
return value.digest()
Expand Down
4 changes: 2 additions & 2 deletions detect_secrets/plugins/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
]
]

# add to this mapping (and ALLOWLIST_REGEXES if applicable) lazily,
# Add to this mapping (and ALLOWLIST_REGEXES if applicable) lazily,
# as more language specific file parsers are implemented.
# discussion: https://github.com/Yelp/detect-secrets/pull/105
# Discussion: https://github.com/Yelp/detect-secrets/pull/105
ALLOWLIST_REGEX = {
'yaml': ALLOWLIST_REGEXES[0],
}
12 changes: 6 additions & 6 deletions detect_secrets/plugins/common/ini_file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def __init__(self, file, add_header=False, exclude_lines_regex=None):
"""
self.parser = configparser.ConfigParser()
try:
# python2.7 compatible
# Python2.7 compatible
self.parser.optionxform = unicode
except NameError: # pragma: no cover
# python3 compatible
# Python3 compatible
self.parser.optionxform = str

self.exclude_lines_regex = exclude_lines_regex
Expand All @@ -53,10 +53,10 @@ def __init__(self, file, add_header=False, exclude_lines_regex=None):
content = '[global]\n' + content

try:
# python2.7 compatible
# Python2.7 compatible
self.parser.read_string(unicode(content))
except NameError: # pragma: no cover
# python3 compatible
# Python3 compatible
self.parser.read_string(content)

# Hacky way to keep track of line location
Expand Down Expand Up @@ -135,7 +135,7 @@ def _get_value_and_line_offset(self, key, values):

if current_value_list_index == len(values_list):
if index == 0:
index = 1 # don't want to count the same line again
index = 1 # Don't want to count the same line again
self.line_offset += index
self.lines = self.lines[index:]
lines_modified = True
Expand Down Expand Up @@ -163,7 +163,7 @@ def _construct_values_list(values):
>>> key = value0
... value1
...
... # comment line here
... # Comment line here
... value2
given that normally, either value0 is supplied, or (value1, value2),
Expand Down
2 changes: 1 addition & 1 deletion detect_secrets/plugins/stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ class StripeDetector(RegexBasedDetector):
secret_type = 'Stripe Access Key'

denylist = (
# stripe standard keys begin with sk_live and restricted with rk_live
# Stripe standard keys begin with sk_live and restricted with rk_live
re.compile(r'(?:r|s)k_live_[0-9a-zA-Z]{24}'),
)

0 comments on commit 0b2c0e1

Please sign in to comment.