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

Code quality tooling added #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AllanHoejgaardJensen
Copy link
Member

Added code quality tooling and changed code accordingly

@AllanHoejgaardJensen AllanHoejgaardJensen added the bug Something isn't working label Sep 2, 2018
String[] minimum = {"200", "202", "204", "301", "400", "404", "415", "500"};
String[] standard = {"200", "201", "202", "203", "204", "301", "304", "307",
private final String[] minimum = {"200", "202", "204", "301", "400", "404", "415", "500"};
private final String[] standard = {"200", "201", "202", "203", "204", "301", "304", "307",

Choose a reason for hiding this comment

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

Why not
private static final String[] MINIMUM = {...} and
private static final String[] STANDARD = {...}?

Copy link
Member Author

Choose a reason for hiding this comment

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

Youre right, why not - it is a part fo the latest commit, thank you for pointing to that.

@@ -143,7 +136,18 @@ public void execute() throws MojoExecutionException, MojoFailureException {
);
}

private void ApplySpecificHeadersAndResponses(Swagger api, Set<String> codes) {
private String findFileFormat(String fileAndPathName) {
Copy link
Member

Choose a reason for hiding this comment

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

Could be realized with streams? Not sure whether its more readable or not but you avoid the branching. The extensions could maybe also be added to the OutputFormat enumeration since this seems to be somewhat related to the extension - actually looking at the method name findFileFormat I might have expected it to return a FileFormat - it is actually returning a file name - isn't it? :-)

    private String findFileFormat(final String fileAndPathName) {
        return Arrays.asList(".json", ".yaml", ".yml").stream()
            .filter(ext -> Files.exists(Paths.get(fileAndPathName + ext)))
            .findAny()
            .orElse(fileAndPathName);
    }

Copy link
Member Author

Choose a reason for hiding this comment

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

Is part of the latest commit - thanks for suggesting that.

@langecode
Copy link
Member

I guess this solves #1 (just to link the PR to the issue :-) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants