<commit_before>package com.commafeed;

import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;

import java.util.Date;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

import lombok.Getter;

import org.apache.commons.lang.time.DateUtils;

import com.fasterxml.jackson.annotation.JsonProperty;

@Getter
public class CommaFeedConfiguration extends Configuration {

	public static enum CacheType {
		NOOP, REDIS
	}

	@Valid
	@NotNull
	@JsonProperty("database")
	private DataSourceFactory database = new DataSourceFactory();

	@Valid
	@NotNull
	@JsonProperty("app")
	private ApplicationSettings applicationSettings;

	@Getter
	public static class ApplicationSettings {
		@JsonProperty
		private String contextPath;

		@JsonProperty
		private String publicUrl;

		@JsonProperty
		private boolean allowRegistrations;

		@JsonProperty
		private String googleAnalyticsTrackingCode;

		@JsonProperty
		private int backgroundThreads;

		@JsonProperty
		private int databaseUpdateThreads;

		@JsonProperty
		private String smtpHost;

		@JsonProperty
		private int smtpPort;

		@JsonProperty
		private boolean smtpTls;

		@JsonProperty
		private String smtpUserName;

		@JsonProperty
		private String smtpPassword;

		@JsonProperty
		private boolean heavyLoad;

		@JsonProperty
		private boolean pubsubhubbub;

		@JsonProperty
		private boolean imageProxyEnabled;

		@JsonProperty
		private int queryTimeout;

		@JsonProperty
		private int keepStatusDays;

		@JsonProperty
		private int refreshIntervalMinutes;

		@JsonProperty
		private CacheType cache;

		@JsonProperty
		private String announcement;

		public Date getUnreadThreshold() {
			int keepStatusDays = getKeepStatusDays();
			return keepStatusDays > 0 ? DateUtils.addDays(new Date(), -1 * keepStatusDays) : null;
		}
<commit_msg>configuration validation<commit_after>package com.commafeed;

import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;

import java.util.Date;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import lombok.Getter;

import org.apache.commons.lang.time.DateUtils;
import org.hibernate.validator.constraints.NotBlank;

import com.fasterxml.jackson.annotation.JsonProperty;

@Getter
public class CommaFeedConfiguration extends Configuration {

	public static enum CacheType {
		NOOP, REDIS
	}

	@Valid
	@NotNull
	@JsonProperty("database")
	private DataSourceFactory database = new DataSourceFactory();

	@Valid
	@NotNull
	@JsonProperty("app")
	private ApplicationSettings applicationSettings;

	@Getter
	public static class ApplicationSettings {
		@JsonProperty
		@NotNull
		@NotBlank
		private String contextPath;

		@JsonProperty
		@NotNull
		@NotBlank
		private String publicUrl;

		@JsonProperty
		@NotNull
		private boolean allowRegistrations;

		@JsonProperty
		private String googleAnalyticsTrackingCode;

		@JsonProperty
		@NotNull
		@Min(1)
		private int backgroundThreads;

		@JsonProperty
		@NotNull
		@Min(1)
		private int databaseUpdateThreads;

		@JsonProperty
		private String smtpHost;

		@JsonProperty
		private int smtpPort;

		@JsonProperty
		private boolean smtpTls;

		@JsonProperty
		private String smtpUserName;

		@JsonProperty
		private String smtpPassword;

		@JsonProperty
		@NotNull
		private boolean heavyLoad;

		@JsonProperty
		@NotNull
		private boolean pubsubhubbub;

		@JsonProperty
		@NotNull
		private boolean imageProxyEnabled;

		@JsonProperty
		@NotNull
		@Min(0)
		private int queryTimeout;

		@JsonProperty
		@NotNull
		@Min(0)
		private int keepStatusDays;

		@JsonProperty
		@NotNull
		@Min(0)
		private int refreshIntervalMinutes;

		@JsonProperty
		@NotNull
		private CacheType cache;

		@JsonProperty
		@NotNull
		private String announcement;

		public Date getUnreadThreshold() {
			int keepStatusDays = getKeepStatusDays();
			return keepStatusDays > 0 ? DateUtils.addDays(new Date(), -1 * keepStatusDays) : null;
		}

{'fraction_non_alphanumeric': 0.06949322629202208, 'fraction_numerical': 0.0022579026593075764, 'mean_word_length': 4.82043795620438, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '252633', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1149, 'n_words': 303}