All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.codemodder.CodemodFileScanningResult Maven / Gradle / Ivy

package io.codemodder;

import io.codemodder.codetf.CodeTFAiMetadata;
import io.codemodder.codetf.UnfixedFinding;
import java.util.List;

/** Represents the result of scanning a file for changes. */
public interface CodemodFileScanningResult {

  /** Creates a new instance of {@link CodemodFileScanningResult} from the given values. */
  static CodemodFileScanningResult from(
      final List changes, final List unfixedFindings) {
    return new CodemodFileScanningResult() {
      @Override
      public List changes() {
        return List.copyOf(changes);
      }

      @Override
      public List unfixedFindings() {
        return List.copyOf(unfixedFindings);
      }
    };
  }

  /**
   * Creates a new instance of {@link CodemodFileScanningResult} from the given values, including AI
   * usage metadata
   */
  static CodemodFileScanningResult from(
      final List changes,
      final List unfixedFindings,
      CodeTFAiMetadata codeTFAiMetadata) {
    return new AICodemodFileScanningResult(changes, unfixedFindings, codeTFAiMetadata);
  }

  /** Creates an empty instance of {@link CodemodFileScanningResult}. */
  static CodemodFileScanningResult none() {
    return from(List.of(), List.of());
  }

  /** Creates an instance of {@link CodemodFileScanningResult} with only changes. */
  static CodemodFileScanningResult withOnlyChanges(final List changes) {
    return from(changes, List.of());
  }

  /** Returns the changes that were made to the file. */
  List changes();

  /** Returns the results of the findings that were hoping to be addressed. */
  List unfixedFindings();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy