-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improve Error Output #28
Comments
@TrueWill - Let me know your thoughts and if possible lets hop on a call to discuss. |
@cjnickel Looking initially at
It's nice that it handles redirecting to a file; it doesn't give a bunch of color codes when you do that. I did notice that the colors don't show up in Git Bash; this doesn't matter to me, but I've seen one person use it. It works fine in cmd. I didn't test on Mac/Linux. Honestly I didn't think much about testing; this was a quick-and-dirty side project. I like the separation of the I/O from the assertions. Want to open a PR on that? |
@cjnickel On I'm iffy about the name "context" due to it being an overloaded term. The various assertions take in a context string that represents what file/section the check is in.
This and similar paths are definitely worth exploring. I'd like it to be more modular and easier to test. I do wonder if we'll get time to write tests against it; as it is I have to work on it outside of the office or in rare slices of downtime. |
(My main thought for testing was to create a sample project that had every possible warning, then run the tool on that and capture the output to use for regression testing. Basically poor man's snapshot testing.) |
Console ColorsFor reference this is what it looks like for me on iTerm on a Mac. Problems Summary / Summary
ContextAgree with your concern about PomParserI think this is actually handled by the context because the "as it is I have to work on it outside of the office or in rare slices of downtime." |
I've created two branches (feature/improve-error-output & chris/poc/context-and-reporter) but really want to get your opinion before I continue down this path. Didn't know if you already had a plan in your head how to accomplish improving error output and easier unit testing.
What I was wanting to do was mimic eslint's output for errors and warnings.
ESLint Output
Drawing from how eslint rules are written they are a JS object similar to this:
I like the idea of
meta.docs.url
with a link back to this repo with a readme explaining the particular rule but not necessary at the moment.To start I am basically interested in the
create
function that provides a common interface for each rule to be called from the eslint runner. In my 2nd branch, chris/poc/context-and-reporter, I started to explore having a context object that provides a way to access the mule project'sfolderInfo
,pomInfo
, and a way to read a file within thatfolderInfo
.Then I created a reporter that is also passed into each "rule"'s validate function. This is used to track problems found as rules are being evaluated and then it has a function to print out errors in the format of
severity category description
. Initially I was thinking to include acategory
for the error and ideally I'd like to look at adding which file the error was found.I think these two things will allow for the rules/validation functions to be passed their mock data to more easily unit test them without having to mock the
fs
package or always have a file to be read.The text was updated successfully, but these errors were encountered: