Upgrade json simple & fix big overview comment issue#118
Upgrade json simple & fix big overview comment issue#118kingoleg wants to merge 9 commits intoAmadeusITGroup:coverage_split_sensorfrom
Conversation
kingoleg
commented
Mar 27, 2017
- Upgrade json simple
- Cannot post a summary comment. Too many characters. #113
Other word, cannot understand what is a path related to issue - ignore it
…ects with same level parent setup
|
Can you remove the workingdir/projectbasedir changes from this PR? |
t-8ch
left a comment
There was a problem hiding this comment.
In general this is useful, I would like the implementation to change a bit though.
And we should define what maxiumum comment sizes to use.
| } | ||
|
|
||
| private static void validateResponse(Response response, int expectedStatusCode, String message) throws StashClientException { | ||
| private static void validateResponse(JsonObject body, Response response, int expectedStatusCode, String message) throws StashClientException { |
There was a problem hiding this comment.
I am not sure about this parameter.
If we keep it it should be named requestBody.
OTOH it seems weird to pass the body only for logging.
How about removing the exception from validateResponse(), making it return a bool instead and throwing the exception/logging from performRequest directly
| private static final Logger LOGGER = LoggerFactory.getLogger(StashProjectBuilder.class); | ||
|
|
||
| private static final int SOFT_SUMMARY_COMMENT_MAX_LENGTH = 30000; | ||
| private static final int HARD_SUMMARY_COMMENT_MAX_LENGTH = Short.MAX_VALUE; |
There was a problem hiding this comment.
How did you obtain these values?
| sb.append("| ").append(printIssueMarkdown(issue, sonarQubeURL)).append(" |").append(NEW_LINE); | ||
| if (sb.length() > maxLength) { | ||
| sb.append("| ").append(MarkdownPrinter.printSeverityMarkdown(issue.severity())); | ||
| sb.append("The rest issues are skipped |").append(NEW_LINE); |
There was a problem hiding this comment.
"The rest of the issues have been skipped, because of..."
There was a problem hiding this comment.
This would still allow the message to exceed maxLength
| sb.append("|------------|").append(NEW_LINE); | ||
| for (String severity: orderedSeverities) { | ||
| sb.append(printIssueListBySeverityMarkdown(generalIssues, sonarQubeURL, severity)); | ||
| int maxLength = SOFT_SUMMARY_COMMENT_MAX_LENGTH / 2 - sb.length(); |
There was a problem hiding this comment.
I would prefer to have the truncation/maxlength logic in its own wrapper class around StringBuffer.
With the signature:
class SizeSensitiveStringBuffer() {
public SizeSensitiveStringBuffer(int maxLength);
public boolean append(String content, int maxLength, String alternativeContent);
public void append(String content);
}| } | ||
|
|
||
| if (sb.length() > HARD_SUMMARY_COMMENT_MAX_LENGTH) { | ||
| LOGGER.debug("Overview comment is too big, trimming"); |
| assertEquals(diff1.getSource(), (long) 10); | ||
| assertEquals(diff1.getDestination(),(long) 20); | ||
| assertEquals(diff1.getSource(), 10); | ||
| assertEquals(diff1.getDestination(),20); |
There was a problem hiding this comment.
There is a space missing before the ,
|
This would be a nice fix to have, on large projects we are getting this error: |