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

Descriptive error with exact path in json #48

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open

Conversation

ankuagarwal
Copy link
Collaborator

@ankuagarwal ankuagarwal commented Jun 6, 2019

  • 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
src/main/java/com/zachary_moore/lint/Error.java Outdated Show resolved Hide resolved
src/main/java/com/zachary_moore/lint/Error.java Outdated Show resolved Hide resolved
src/main/java/com/zachary_moore/lint/Error.java Outdated Show resolved Hide resolved
src/main/java/com/zachary_moore/lint/LintRule.java Outdated Show resolved Hide resolved
src/main/java/com/zachary_moore/runner/LintRunner.java Outdated Show resolved Hide resolved
@@ -32,7 +34,7 @@
*/
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
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

@@ -11,6 +11,8 @@
*/
private String reportMessage;

private String path;
Copy link
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?

@@ -29,4 +32,25 @@ static WrappedObject getWrappedObject(String originatingKey,
}
return wrappedObject;
}

public static String getPath(WrappedObject element) {
Copy link
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
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
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.

None yet

3 participants