<commit_before>package org.jenkinsci.plugins.github.pullrequest.trigger.check;

import com.google.common.base.Predicate;
import hudson.model.TaskListener;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.jenkinsci.plugins.github.pullrequest.GitHubPRPullRequest;
import org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository;
import org.kohsuke.github.GHPullRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.CheckForNull;
import java.io.IOException;

import static java.util.Objects.isNull;

/**
 * @author lanwen (<NAME>)
 */
public class NotUpdatedPRFilter implements Predicate<GHPullRequest>, java.util.function.Predicate<GHPullRequest> {
    private static final Logger LOGGER = LoggerFactory.getLogger(NotUpdatedPRFilter.class);

    private final GitHubPRRepository localRepo;
    private final TaskListener logger;

    private NotUpdatedPRFilter(GitHubPRRepository localRepo, TaskListener logger) {
        this.localRepo = localRepo;
        this.logger = logger;
    }

    public static NotUpdatedPRFilter notUpdated(GitHubPRRepository localRepo, TaskListener logger) {
        return new NotUpdatedPRFilter(localRepo, logger);
    }

    @Override
    public boolean apply(GHPullRequest remotePR) {
        @CheckForNull GitHubPRPullRequest localPR = localRepo.getPulls().get(remotePR.getNumber());

        if (!isUpdated(remotePR, localPR)) { // light check
            logger.getLogger().println(String.format("PR [#%s %s] not changed", remotePR.getNumber(), remotePR.getTitle()));
            return false;
        }
        return true;
    }
<commit_msg>Add extra logging to NotUpdatedPRFilter when PR is not updated (#299)<commit_after>package org.jenkinsci.plugins.github.pullrequest.trigger.check;

import com.google.common.base.Predicate;
import hudson.model.TaskListener;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.CompareToBuilder;
import org.jenkinsci.plugins.github.pullrequest.GitHubPRPullRequest;
import org.jenkinsci.plugins.github.pullrequest.GitHubPRRepository;
import org.kohsuke.github.GHPullRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.CheckForNull;
import java.io.IOException;

import static java.util.Objects.isNull;

/**
 * @author lanwen (<NAME>)
 */
public class NotUpdatedPRFilter implements Predicate<GHPullRequest>, java.util.function.Predicate<GHPullRequest> {
    private static final Logger LOGGER = LoggerFactory.getLogger(NotUpdatedPRFilter.class);

    private final GitHubPRRepository localRepo;
    private final TaskListener logger;

    private NotUpdatedPRFilter(GitHubPRRepository localRepo, TaskListener logger) {
        this.localRepo = localRepo;
        this.logger = logger;
    }

    public static NotUpdatedPRFilter notUpdated(GitHubPRRepository localRepo, TaskListener logger) {
        return new NotUpdatedPRFilter(localRepo, logger);
    }

    @Override
    public boolean apply(GHPullRequest remotePR) {
        @CheckForNull GitHubPRPullRequest localPR = localRepo.getPulls().get(remotePR.getNumber());

        if (!isUpdated(remotePR, localPR)) { // light check
            String logMessage = String.format("PR [#%s %s] not changed", remotePR.getNumber(), remotePR.getTitle());
            logger.getLogger().println(logMessage);
            LOGGER.debug(logMessage);
            return false;
        }
        return true;
    }

{'fraction_non_alphanumeric': 0.09565962307252998, 'fraction_numerical': 0.0031410622501427754, 'mean_word_length': 4.348091603053435, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '686233', 'n_tokens_mistral': 1026, 'n_tokens_neox': 990, 'n_words': 204}