Skip to content

Descriptive error with exact path in json - #48

Open
ankuagarwal wants to merge 7 commits into
devfrom
refractor
Open

Descriptive error with exact path in json#48
ankuagarwal wants to merge 7 commits into
devfrom
refractor

Conversation

@ankuagarwal

@ankuagarwal ankuagarwal commented Jun 6, 2019

Copy link
Copy Markdown
Collaborator
  • Please check if the PR fulfills these requirements
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Feature

  • What is the current behavior? (You can also link to an open issue here)
    Currently we get all the error message caused in a file. It is difficult for user to pin point the exact location.

  • What is the new behavior (if this is a feature change)?

  • Adding an Error object containing the descriptive message, and the path in json where the error has occurred.
  • Renaming ReportRunner to ReportGenerator, Instead of passing LintRunner, we pass the error data, and we get the final report.
  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    Updated Doc for more info.

  • Other information:

- lint() method in LintRunner will lint the files without returning anything
- ReportRunner will generate the report based upon input error data
@ankuagarwal ankuagarwal added the enhancement New feature or request label Jun 6, 2019
@ankuagarwal ankuagarwal changed the title Canonical path in JSON Descriptive error with exact path in json Jun 6, 2019
Comment thread src/main/java/com/zachary_moore/lint/Error.java Outdated
Comment thread src/main/java/com/zachary_moore/lint/Error.java Outdated
Comment thread src/main/java/com/zachary_moore/lint/Error.java Outdated
Comment thread src/main/java/com/zachary_moore/lint/LintRule.java
Comment thread src/main/java/com/zachary_moore/lint/LintRule.java Outdated
Comment thread src/main/java/com/zachary_moore/runner/LintRunner.java Outdated
Comment thread src/test/java/com/zachary_moore/runner/LintRunnerShould.java Outdated
Comment thread src/main/java/com/zachary_moore/lint/Error.java Outdated
public String report(T t) throws NoReportSetException {
if (reportMessage == null) {
throw new NoReportSetException("No Report Message Set When Lint Error Found");
throw new NoReportSetException("No Report Message Set When Lint LintError Found");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this should be when LintError found not Lint LintError

*/
private String reportMessage;

private String path;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

what is this used for?

return wrappedObject;
}

public static String getPath(WrappedObject element) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

can we make this a list instead of string separated by a '.' as discussed offline


@Test
public void lintRunnerShouldValidErrorForWrappedPrimitive() throws Exception {
LintRule lintRule = new LintRule.Builder()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can pull out lintRule and hold on as a LintRule.Builder and only make implementation to avoid all the duplication in these tests


public class LintError {

private final String jsonPath;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can we use this in the RB? We are allowing us to get this info but not using it at all in reporting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants