-
Notifications
You must be signed in to change notification settings - Fork 9
Don't crash on parse errors #34
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
Conversation
Instead of crashing out when encountering a parse error, this will report the issue as a parse error.
if node.attributes.key?("identifier") | ||
create_issue(node, path) | ||
else | ||
create_error(node, path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach introduces an unacceptable amount of syntactic duplication IMO. What do you think of instead doing the following:
check_name
is (basically)node.identifier || "parse-error"
- Have a
check_details
value that mapsparse-error
to[BugRisk]
/5_000
- Everything else about
#create_issue
stays as-is - No need for
#create_error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points all around. Will do all of that.
@pbrisbin cleaned up |
2de1b57
to
4968a34
Compare
require "shellwords" | ||
|
||
module CC | ||
module Engine | ||
MissingAttributesError = Class.new(StandardError) | ||
|
||
DEFAULT_IDENTIFIER = OpenStruct.new(value: "parse-error") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nifty
LGTM. Nice fix. |
Instead of crashing out when encountering a parse error, this will report
the issue as a parse error.
cc @codeclimate/review a bit different from other engines because we're not outputting to stderr, but this seems useful.