File CWXwikiBridge.java
has 486 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
CWXwikiBridge
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
@Component
@Singleton
@Named("eu.learnpad.cw.internal.CWXwikiBridge")
@Path("/learnpad/cw/bridge")
public class CWXwikiBridge extends XwikiBridge implements Initializable,
Method getPatchList
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Patches getPatchList(String modelSetId) {
// TODO
Attribute attribute1 = new Attribute();
attribute1.setId("123");
attribute1.setName("name");
Method getUserProfiles
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private UserDataCollection getUserProfiles(Collection<String> potentialUsers) {
XWikiContext xcontext = xcontextProvider.get();
XWiki xwiki = xcontext.getWiki();
DocumentReference userClassReference = stringDocumentReferenceResolver
.resolve(USER_CLASS);
Method getUserProfiles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private UserDataCollection getUserProfiles(Collection<String> potentialUsers) {
XWikiContext xcontext = xcontextProvider.get();
XWiki xwiki = xcontext.getWiki();
DocumentReference userClassReference = stringDocumentReferenceResolver
.resolve(USER_CLASS);
- 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 getScores
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@Override
public ScoreRecordCollection getScores(String userid, String modelid)
throws LpRestException {
Collection<ScoreRecord> res = new ArrayList<>();
for (String recordedUser : scoresBySessionByUser.keySet()) {
- 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 getFeedbackList
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Feedbacks getFeedbackList(String modelSetId) {
XWikiContext xcontext = xcontextProvider.get();
XWiki xwiki = xcontext.getWiki();
DocumentReference classReference = stringDocumentReferenceResolver
.resolve(FEEDBACK_CLASS);
Method resourceNotification
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
private void resourceNotification(String modelSetId, String modelId,
String artifactId, String resourceId, ResourceType resourceType,
String action, String userId) throws LpRestException {
Method attachmentNotification
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public void attachmentNotification(String modelSetId, String modelId,
String artifactId, String resourceId, String action, String userId)
Method feedbackNotification
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public void feedbackNotification(String modelSetId, String modelId,
String artifactId, String resourceId, String action, String userId)
Method pageNotification
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public void pageNotification(String modelSetId, String modelId,
String artifactId, String resourceId, String action, String userId)
Method commentNotification
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public void commentNotification(String modelSetId, String modelId,
String artifactId, String resourceId, String action, String userId)
Method notifyRecommendations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void notifyRecommendations(String modelsetid, String simulationid,
String userid, Recommendations recommendations)
throws LpRestException {
String xwikiUserId = String.format("XWiki.%s", userid);
- 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"