<commit_before>package org.jenkinsci.plugins.github.webhook;

import com.google.common.annotations.Beta;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.model.AbstractProject;
import jenkins.model.Jenkins;
import org.kohsuke.github.GHEvent;

import java.util.Set;

/**
 * Extension point to contribute events plugin interested in.
 * This point should return true in {@link #isApplicable(AbstractProject)}
 * only if it can parse hooks with events contributed in {@link #events()}
 *
 * Each time this plugin wants to get events list from contributors it asks for applicable status
 *
 * @author lanwen (<NAME>)
 * @since 1.11.4
 */
public abstract class GHEventsListener implements ExtensionPoint {

    /**
     * Should return true only if this listener interested in {@link #events()} set for this project
     *
     * @param project to check
     *
     * @return true to provide events to register and listen for this project
     */
    public abstract boolean isApplicable(AbstractProject<?, ?> project);

    /**
     * @return immutable set of events this listener wants to register and then listen to
     */
    public abstract Set<GHEvent> events();

    @Beta
    public void processEvent(GHEvent event, String payload) {
        // TODO can be changed
    }

    public static ExtensionList<GHEventsListener> all() {
        return Jenkins.getInstance().getExtensionList(GHEventsListener.class);
    }

    /**<commit_msg>get rid of event parser in listener for now<commit_after>package org.jenkinsci.plugins.github.webhook;

import com.google.common.annotations.Beta;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.model.AbstractProject;
import jenkins.model.Jenkins;
import org.kohsuke.github.GHEvent;

import java.util.Set;

/**
 * Extension point to contribute events plugin interested in.
 * This point should return true in {@link #isApplicable(AbstractProject)}
 * only if it can parse hooks with events contributed in {@link #events()}
 *
 * Each time this plugin wants to get events list from contributors it asks for applicable status
 *
 * @author lanwen (<NAME>)
 * @since 1.11.4
 */
public abstract class GHEventsListener implements ExtensionPoint {

    /**
     * Should return true only if this listener interested in {@link #events()} set for this project
     *
     * @param project to check
     *
     * @return true to provide events to register and listen for this project
     */
    public abstract boolean isApplicable(AbstractProject<?, ?> project);

    /**
     * @return immutable set of events this listener wants to register and then listen to
     */
    public abstract Set<GHEvent> events();

    /**
     * @return All listener extensions
     */
    public static ExtensionList<GHEventsListener> all() {
        return Jenkins.getInstance().getExtensionList(GHEventsListener.class);
    }

    /**
{'fraction_non_alphanumeric': 0.08978126020241593, 'fraction_numerical': 0.002611818478615736, 'mean_word_length': 3.706605222734255, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6274008', 'n_tokens_mistral': 839, 'n_tokens_neox': 809, 'n_words': 293}