eu.solven.cleanthat.codeprovider.CodeProviderHelpers Maven / Gradle / Ivy
/*
* Copyright 2023 Benoit Lacelle - SOLVEN
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package eu.solven.cleanthat.codeprovider;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Path;
import java.util.Collection;
import java.util.Map;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
import eu.solven.cleanthat.code_provider.CleanthatPathHelpers;
import eu.solven.cleanthat.config.ConfigHelpers;
import eu.solven.cleanthat.config.ICleanthatConfigConstants;
/**
* Helpers working for any {@link ICodeProvider}
*
* @author Benoit Lacelle
*
*/
public class CodeProviderHelpers {
private static final Logger LOGGER = LoggerFactory.getLogger(CodeProviderHelpers.class);
protected Collection objectMappers;
public CodeProviderHelpers(Collection objectMappers) {
this.objectMappers = objectMappers;
}
// TODO Get the merged configuration head -> base
// Could be done by relying on the merge commit given a PR
// It will enable cleaning a PR given the configuration of the base branch
public Optional