您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

BlameCommand.java 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2019 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.api.batch.scm;
  21. import java.util.List;
  22. import org.sonar.api.scanner.ScannerSide;
  23. import org.sonar.api.batch.fs.FileSystem;
  24. import org.sonar.api.batch.fs.InputFile;
  25. /**
  26. * This class should be implemented by SCM providers.
  27. * @since 5.0
  28. */
  29. @ScannerSide
  30. public abstract class BlameCommand {
  31. /**
  32. * Compute blame of the provided files.
  33. * Computation can be done in parallel if this is more efficient.
  34. * If there is an error that prevent to blame a file then an exception should be raised. If
  35. * one file is new or contains local modifications then an exception should be raised.
  36. * @see BlameOutput#blameResult(InputFile, List)
  37. */
  38. public abstract void blame(BlameInput input, BlameOutput output);
  39. /**
  40. * Callback for the provider to report results of blame per file.
  41. */
  42. public interface BlameInput {
  43. /**
  44. * Filesystem of the current (sub )project.
  45. */
  46. FileSystem fileSystem();
  47. /**
  48. * List of files that should be blamed.
  49. */
  50. Iterable<InputFile> filesToBlame();
  51. }
  52. /**
  53. * Callback for the provider to report results of blame per file.
  54. */
  55. public interface BlameOutput {
  56. /**
  57. * Add result of the blame command for a single file. Number of lines should
  58. * be consistent with {@link InputFile#lines()}. This method is thread safe.
  59. * @param lines One entry per line in the file. <b>Every line must have a <code>non-null</code> date and revision </b>.
  60. */
  61. void blameResult(InputFile file, List<BlameLine> lines);
  62. }
  63. }