Showing 24 of 50 total issues
Method extractData
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public void extractData() {
List<Monitor> monitorList = monitorRepository.getActiveMonitors();
int extractionRequestsCounter = 0;
boolean stopByBlockSize;
- 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
RepositoryConfiguration
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
@Configuration
public class RepositoryConfiguration {
@Value("${twitter.apiKey}")
private String apiKey;
Method extractData
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void extractData() {
List<Monitor> monitorList = monitorRepository.getActiveMonitors();
int extractionRequestsCounter = 0;
boolean stopByBlockSize;
Method find
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public void find(String hashtag) {
int contents = 0;
boolean stop = false;
int calls = 0;
int maxResults = 100;
- 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 resolveDraws
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private void resolveDraws(List<Proposal> proposalList) {
if (proposalList != null && proposalList.size() > 1 && proposalList.get(0).getVotes() == proposalList.get(1)
.getVotes()) {
int draws = 1;
Ranking ranking = rankingRepository.loadRanking();
- 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 restoreSecurityContext
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public void restoreSecurityContext(HttpServletRequest request, HttpServletResponse response) {
if (SecurityContextHolder.getContext().getAuthentication() == null) {
AuthToken authToken = authCookieService.extractAuthToken(request);
if (authToken != null) {
AuthenticationUser authenticationUser = null;
- 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 find
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void find(String hashtag) {
int contents = 0;
boolean stop = false;
int calls = 0;
int maxResults = 100;
Method handleError
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
@RequestMapping("/error")
public String handleError(HttpServletRequest request) {
Object status = request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE);
if (status != null) {
Integer statusCode = Integer.valueOf(status.toString());
- 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 restoreSecurityContext
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void restoreSecurityContext(HttpServletRequest request, HttpServletResponse response) {
if (SecurityContextHolder.getContext().getAuthentication() == null) {
AuthToken authToken = authCookieService.extractAuthToken(request);
if (authToken != null) {
AuthenticationUser authenticationUser = null;
Method createFromMonitorExtractedTweet
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public TwitterExtraction createFromMonitorExtractedTweet(Monitor monitor, Tweet tweet) {
final Interaction interaction;
if (tweet.getQuotedStatus() != null) {
interaction = new Interaction(TwitterExtraction.TYPE_QUOTE,
tweet.getQuotedStatus().getIdStr(),
Method resolveDraws
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void resolveDraws(List<Proposal> proposalList) {
if (proposalList != null && proposalList.size() > 1 && proposalList.get(0).getVotes() == proposalList.get(1)
.getVotes()) {
int draws = 1;
Ranking ranking = rankingRepository.loadRanking();
Method createPoll
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
String authorId,
String authorNickname,
String description,
LocalDateTime startProposalsTime,
LocalDateTime endProposalsTime,
Method createPoll
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
User author,
String description,
LocalDateTime startProposalsTime,
LocalDateTime endProposalsTime,
LocalDateTime endVotingTime,
Method createPoll
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
@RequestParam("description")
String description,
@RequestParam("startProposalsTime")
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
LocalDateTime startProposalsTime,
Method closeModeration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
String pollId,
String proposalAuthorId,
String hashtag,
String subject,
String cancelationReason,
Method closeModeration
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
@PathVariable("pollId")
String pollId,
@PathVariable("proposalAuthorId")
String proposalAuthorId,
@RequestParam("hashtag")
Method save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean save(Monitor monitor, SearchTweetsResult searchTweetsResult, boolean ranked) {
Set<String> updatedUserIds = new HashSet<>();
User user;
TwitterExtraction twitterExtraction;
- 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 create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public Proposal create(String pollId, String authorId, String authorNickname, String hashtag, String subject) {
Method pollProposal
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
@PathVariable("pollId") String pollId,
@RequestParam("hashtag")
String hashtag,
@RequestParam("subject")
String subject,
Method cachedMonitorRepository
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
JdbcMonitorRepository jdbcMonitorRepository,
@Qualifier("monitorCache") LoadingCache<String, Monitor> monitorCache,
@Qualifier("monitorListCache") LoadingCache<String, List<Monitor>> monitorListCache,
@Qualifier("reportCache") LoadingCache<String, Report> reportCache,
@Qualifier("rankingCache") LoadingCache<String, Ranking> rankingCache) {