Skip to content

Commit f7815f8

Browse files
committed
Don't store line numbers file
1 parent 6983cd8 commit f7815f8

File tree

2 files changed

+10
-200
lines changed

2 files changed

+10
-200
lines changed

snippets_line_numbers.csv

Lines changed: 0 additions & 189 deletions
This file was deleted.

src/main/java/AggregateSnippets.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ public static void main(String[] args) throws Throwable {
3535
final var aggregator = new AggregateSnippets(snippetsSrcRoot);
3636
aggregator.computeContents();
3737
aggregator.saveContentsToFile(repoRoot.resolve("SNIPPETS.md"));
38-
aggregator.saveLineNumbersToCsv(repoRoot.resolve("snippets_line_numbers.csv"));
3938
}
4039

4140

42-
public record CodeSnippetFile(
41+
public record CodeSnippetFileInfo(
4342
Path file,
4443
int mainStartIndex, int mainEndIndex,
4544
int clientStartIndex, int clientEndIndex
4645
) { }
4746

4847
private StringBuilder sb;
4948
private final Path snippetsSrcRoot;
50-
private Collection<CodeSnippetFile> snippetFiles;
49+
private Collection<CodeSnippetFileInfo> snippetFiles;
5150

5251
public AggregateSnippets(Path snippetsSrcRoot) {
5352
this.snippetsSrcRoot = Objects.requireNonNull(snippetsSrcRoot);
@@ -59,7 +58,7 @@ private void checkComputed() {
5958
}
6059
}
6160

62-
public Collection<CodeSnippetFile> getLineNumbers() {
61+
public Collection<CodeSnippetFileInfo> getLineNumbers() {
6362
checkComputed();
6463
return snippetFiles;
6564
}
@@ -77,13 +76,13 @@ public void saveLineNumbersToCsv(Path destPath) throws IOException {
7776
checkComputed();
7877
try (var writer = Files.newBufferedWriter(destPath, StandardOpenOption.CREATE)) {
7978
writer.write("File,MainStart,MainEnd,ClientStart,ClientEnd\n");
80-
for (var file : snippetFiles) {
79+
for (var metadata : snippetFiles) {
8180
writer.write(
82-
file.file.getFileName() + "," +
83-
file.mainStartIndex + "," +
84-
file.mainEndIndex + "," +
85-
file.clientStartIndex + "," +
86-
file.clientEndIndex + "\n"
81+
metadata.file.getFileName() + "," +
82+
metadata.mainStartIndex + "," +
83+
metadata.mainEndIndex + "," +
84+
metadata.clientStartIndex + "," +
85+
metadata.clientEndIndex + "\n"
8786
);
8887
}
8988
}
@@ -163,7 +162,7 @@ else if (level > 2 && path.getName().endsWith(".java")) {
163162
sb.append("\n```java\n").append(nugget).append("\n```\n");
164163

165164
boolean standalone = clientInitEndIndex < 12;
166-
snippetFiles.add(new CodeSnippetFile(path.toPath(),
165+
snippetFiles.add(new CodeSnippetFileInfo(path.toPath(),
167166
lineNumberFromIndex(fileContent, startIndex) + 1,
168167
lineNumberFromIndex(fileContent, endIndex),
169168
standalone ? -1 : lineNumberFromIndex(fileContent, clientInitStartIndex) + 1,

0 commit comments

Comments
 (0)