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

Fixed some Sonar issues #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

nbartels
Copy link
Contributor

@nbartels nbartels commented Dec 8, 2018

This is basically a port from RestFB and improved even further.

  • Duplicate strings used in several Exceptions moved to constant values
  • IntelliJ IDE project files added to gitignore

This fixes improve the code quality according to the default sonarqube java quality profile.

@bernardosulzbach
Copy link
Contributor

Location was made Serializable. Why is it so?

@nbartels
Copy link
Contributor Author

nbartels commented Dec 8, 2018

Ah sorry, I forgot to mention this one.

Location is used as field in the ParseException and the exception class is serializable because every exception extends Throwable.

So all fields of the ParseException should be serializable, too. Or the field needs to be transient.
But because there are methods that work directly on the Location field, serializable look like the better way.

@bernardosulzbach
Copy link
Contributor

Location is used as field in the ParseException and the exception class is serializable because every exception extends Throwable.

I see.

Well, it looks like a good pull request to me, but I don't think it will be merged any time soon, as the maintainer seems to have distanced himself from the project.

@nbartels
Copy link
Contributor Author

nbartels commented Dec 9, 2018

Hm okay, I see. That's a pity, since I really like minimal-json and with its zero dependency approach it is a good "partner" for the RestFB library. I try to contact Ralf and check the state of minimal-json.

@bernardosulzbach
Copy link
Contributor

Good luck. What I really liked about this library is that it's just a clean Java JSON library.

No reflection, no nonsensical casts, and a quite lean API.

@ralfstx
Copy link
Owner

ralfstx commented Dec 16, 2018

Thanks for the PR and sorry for letting you wait.

I understand that Sonar recommends extracting constants, however, in this case, I don't see much value in this change. It creates a dependency between the parameter names and the constants. It's really not a big issue, but I have a slight preference to keep the messages close to the parameter names they refer to. The change also does not help to reduce the size of the compiled jar. In fact, it even adds ~ 290 bytes.

For these reasons, I'd feel better not to include this change.

Making Location serializable looks reasonable to me.

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.

3 participants