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
Adding ability to have lint rules for JSONFile, exposing extension in… #49
base: dev
Are you sure you want to change the base?
Conversation
initializeWrappedObjects(file); | ||
} | ||
|
||
private void initializeWrappedObjects(File file) throws IOException { | ||
BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); |
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.
We can use try-with syntax to ensure that this always gets closed no matter the exception
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
} | ||
|
||
@Override | ||
public void parseAndReplaceWithWrappers() { } |
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.
So does it still make sense to have this function in the interface if its implementation isn't necessary to be a WrappedObject?
throw new RuntimeException("Could not parse either a JSONArray or JSONObject from file"); | ||
} | ||
public WrappedObject getChild() { | ||
return wrappedJsonObject != null ? wrappedJsonObject : wrappedJsonArray; |
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.
Why even have separate variables for wrappedJSONObject
and wrappedJsonArray
if at the end we only return a WrappedObject? We can have a single variable called wrappedChild
and return that in getChild
|
||
@Override | ||
public String report(JSONFile jsonFile) { | ||
return "Expect a JSONArray as child"; |
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 message is misleading. Please change.
#28
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Exposes JSONFile to the linter, allows users to make lint rules for the file.
Adds file extension to the JSONFile
What is the current behavior? (You can also link to an open issue here)
You can't lint on JSONFile
What is the new behavior (if this is a feature change)?
Lint rules for JSONFile can be created.
File extension exposed
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
getObject is no longer usable but should not have been used outside of library.
Other information: