Showing 18 of 18 total issues
File AnnotationServiceImpl.java
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.groupdocs.ui.annotation.service;
import com.groupdocs.annotation.license.License;
import com.groupdocs.annotation.models.annotationmodels.AnnotationBase;
import com.groupdocs.annotation.Annotator;
Method mapAnnotationDataEntity
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public static AnnotationDataEntity mapAnnotationDataEntity(AnnotationBase annotationInfo, PageInfo pageInfo) {
String annotationTypeName = AnnotationType.getName(annotationInfo.getType()); //getAnnotationType(annotationInfo.getType()); //Enum.GetName(Operators.typeOf(AnnotationType.class), annotationInfo.getType());
float maxY = 0, minY = 0, maxX = 0, minX = 0;
float boxX = 0, boxY = 0, boxHeight = 0, boxWidth = 0;
String svgPath = "";
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method mapAnnotationDataEntity
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static AnnotationDataEntity mapAnnotationDataEntity(AnnotationBase annotationInfo, PageInfo pageInfo) {
String annotationTypeName = AnnotationType.getName(annotationInfo.getType()); //getAnnotationType(annotationInfo.getType()); //Enum.GetName(Operators.typeOf(AnnotationType.class), annotationInfo.getType());
float maxY = 0, minY = 0, maxX = 0, minX = 0;
float boxX = 0, boxY = 0, boxHeight = 0, boxWidth = 0;
String svgPath = "";
Method annotate
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public AnnotatedDocumentEntity annotate(AnnotationPostedDataEntity annotateDocumentRequest) {
AnnotatedDocumentEntity annotatedDocument = new AnnotatedDocumentEntity();
try {
// get/set parameters
Method annotate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
@Override
public AnnotatedDocumentEntity annotate(AnnotationPostedDataEntity annotateDocumentRequest) {
AnnotatedDocumentEntity annotatedDocument = new AnnotatedDocumentEntity();
try {
// get/set parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method loadDocument
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final AnnotatedDocumentEntity loadDocument(LoadDocumentRequest loadDocumentRequest, boolean loadAllPages) {
Annotator annotator = null;
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
String guid = loadDocumentRequest.getGuid();
String password = loadDocumentRequest.getPassword();
Method getDocumentPage
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public PageDataDescriptionEntity getDocumentPage(LoadDocumentPageRequest loadDocumentPageRequest) {
String password = "";
try {
// get/set parameters
Method loadDocument
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public final AnnotatedDocumentEntity loadDocument(LoadDocumentRequest loadDocumentRequest, boolean loadAllPages) {
Annotator annotator = null;
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
String guid = loadDocumentRequest.getGuid();
String password = loadDocumentRequest.getPassword();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method renderPageToMemoryStream
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static OutputStream renderPageToMemoryStream(int pageNumberToRender, String documentGuid, String password) {
try {
OutputStream result = new ByteArrayOutputStream(); // MemoryStream => OutputStream
InputStream inputStream = new FileInputStream(documentGuid); //final FileStream outputStream = File.openRead(documentGuid);
try {
Method createAnnotator
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static BaseAnnotator createAnnotator(AnnotationDataEntity annotationData, PageInfo pageInfo) {
AnnotationDataEntity roundedAnnotationData = roundCoordinates(annotationData);
switch (roundedAnnotationData.getType().toLowerCase()) { // addev .toLowerCase()
case "texthighlight": //textHighlight
return new TextHighlightAnnotator(roundedAnnotationData, pageInfo);
Method removeAnnotations
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void removeAnnotations(String documentGuid, String password) {
String tempPath = getTempPath(documentGuid);
try {
final InputStream inputStream = new FileInputStream(documentGuid);
Method getAnnotatedPagesForPrint
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private List<PageDataDescriptionEntity> getAnnotatedPagesForPrint(String password, String documentGuid) {
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
try {
InputStream outputStream = new FileInputStream(documentGuid);
try {
Method uploadFile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static String uploadFile(String documentStoragePath, MultipartFile content, String url, Boolean rewrite) {
String filePath;
try {
String fileName;
// save from file content
Method uploadFile
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static String uploadFile(String documentStoragePath, MultipartFile content, String url, Boolean rewrite) {
String filePath;
try {
String fileName;
// save from file content
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getYamlPropertiesFactoryBean
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static YamlPropertiesFactoryBean getYamlPropertiesFactoryBean() {
YamlPropertiesFactoryBean propertiesFactoryBean = new YamlPropertiesFactoryBean();
ClassPathResource defaultResource = new ClassPathResource(DEFAULT_CONFIGURATION_FILE);
File file = StringUtils.isEmpty(configurationFile) ? null : new File(configurationFile);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getAnnotatedPagesForPrint
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private List<PageDataDescriptionEntity> getAnnotatedPagesForPrint(String password, String documentGuid) {
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
try {
InputStream outputStream = new FileInputStream(documentGuid);
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method compare
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public int compare(File file1, File file2) {
if (file1.isDirectory() && file2.isFile()) {
return -1;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getAnnotationReplyInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected Reply getAnnotationReplyInfo(CommentsEntity comment) {
Reply reply = new Reply();
reply.setComment(comment.getText());
DateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("GMT"));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"