Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small improvements to existing FileParsers #107

Merged
merged 4 commits into from
Dec 21, 2018
Merged

small improvements to existing FileParsers #107

merged 4 commits into from
Dec 21, 2018

Conversation

joshuarli
Copy link
Contributor

Copy link
Collaborator

@KevinHock KevinHock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great refactoring of the lambs

def __init__(self, file):
self.parser = configparser.ConfigParser()
self.parser.optionxform = str
self.parser.read_file(file)

# Hacky way to keep track of line location
file.seek(0)
self.lines = list(map(lambda x: x.strip(), file.readlines()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

# as more language specific file parsers are implemented.
# discussion: https://github.com/Yelp/detect-secrets/pull/105
WHITELIST_REGEX = {
'yaml': WHITELIST_REGEXES[0],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super Nit: Maybe add to the regex comment # e.g. python -> # e.g. python or yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that'll be necessary if a python file parser is implemented. Then we can 'py': WHITELIST_REGEXES[0]. More language/specification specific file parsers is what I'm pushing for, or at least suggesting, architecturally. See #105.

@KevinHock KevinHock merged commit fa90802 into Yelp:master Dec 21, 2018
@joshuarli joshuarli deleted the file-parser-improvements branch December 21, 2018 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants