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

Enhancement: Throw exception when configuration cannot be parsed as yaml #256

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

localheinz
Copy link
Contributor

This PR

  • throws an exception when configuration cannot be parsed as yaml

Before

Running

$ php deptrac.php analyze composer.lock

yields

deptrac is alpha, not production ready.
please help us and report feedback / bugs.


In Parser.php line 391:

  Unable to parse at line 1 (near "{").


analyze [--formatter-graphviz [FORMATTER-GRAPHVIZ]] [--formatter-graphviz-display [FORMATTER-GRAPHVIZ-DISPLAY]] [--formatter-graphviz-dump-image [FORMATTER-GRAPHVIZ-DUMP-IMAGE]] [--formatter-graphviz-dump-dot [FORMATTER-GRAPHVIZ-DUMP-DOT]] [--formatter-graphviz-dump-html [FORMATTER-GRAPHVIZ-DUMP-HTML]] [--formatter-console [FORMATTER-CONSOLE]] [--formatter-junit [FORMATTER-JUNIT]] [--formatter-junit-dump-xml [FORMATTER-JUNIT-DUMP-XML]] [--no-banner] [--no-progress] [--] [<depfile>]

After

Running

$ php deptrac.php analyze composer.lock

yields


deptrac is alpha, not production ready.
please help us and report feedback / bugs.


In FileCannotBeParsedAsYamlException.php line 11:

  File "composer.lock" cannot be parsed as YAML.


analyze [--formatter-graphviz [FORMATTER-GRAPHVIZ]] [--formatter-graphviz-display [FORMATTER-GRAPHVIZ-DISPLAY]] [--formatter-graphviz-dump-image [FORMATTER-GRAPHVIZ-DUMP-IMAGE]] [--formatter-graphviz-dump-dot [FORMATTER-GRAPHVIZ-DUMP-DOT]] [--formatter-graphviz-dump-html [FORMATTER-GRAPHVIZ-DUMP-HTML]] [--formatter-console [FORMATTER-CONSOLE]] [--formatter-junit [FORMATTER-JUNIT]] [--formatter-junit-dump-xml [FORMATTER-JUNIT-DUMP-XML]] [--no-banner] [--no-progress] [--] [<depfile>]

throw FileCannotBeParsedAsYamlException::fromFilename($file);
}

return Configuration::fromArray($data);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point, $data could not be an array, but I figured I would follow up in a separate PR.

@smoench smoench merged commit 8ef5ca7 into qossmic:master Aug 20, 2019
@smoench
Copy link
Contributor

smoench commented Aug 20, 2019

Thank you, @localheinz!

@localheinz localheinz deleted the feature/parse branch August 20, 2019 13:29
@localheinz
Copy link
Contributor Author

Thank you, @smoench!

@smoench smoench added this to the 0.6 milestone Sep 18, 2019
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