• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pkiraly / metadata-qa-api / #677

07 May 2025 08:08PM UTC coverage: 87.245% (+0.01%) from 87.231%
#677

push

pkiraly
Implement SonarCloud quality suggestions #159: fix blockers

17 of 24 new or added lines in 9 files covered. (70.83%)

2 existing lines in 1 file now uncovered.

5520 of 6327 relevant lines covered (87.25%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

91.67
/src/main/java/de/gwdg/metadataqa/api/io/reader/JSONArrayRecordReader.java
1
package de.gwdg.metadataqa.api.io.reader;
2

3
import de.gwdg.metadataqa.api.calculator.CalculatorFacade;
4
import de.gwdg.metadataqa.api.interfaces.MetricResult;
5
import net.minidev.json.JSONArray;
6
import net.minidev.json.JSONValue;
7

8
import java.io.BufferedReader;
9
import java.io.IOException;
10
import java.util.List;
11
import java.util.Map;
12
import java.util.NoSuchElementException;
13

14
public class JSONArrayRecordReader extends RecordReader {
15

16
  private JSONArray records;
17
  private int current = 0;
1✔
18

19
  public JSONArrayRecordReader(BufferedReader inputReader, CalculatorFacade calculator) throws IOException {
20
    super(inputReader, calculator);
1✔
21
    StringBuilder jsonBuilder = new StringBuilder();
1✔
22
    String line;
23
    while ((line = inputReader.readLine()) != null) {
1✔
24
      jsonBuilder.append(line).append("\n");
1✔
25
    }
26
    records = (JSONArray) JSONValue.parse(jsonBuilder.toString());
1✔
27
  }
1✔
28

29
  @Override
30
  public boolean hasNext() {
31
    return records.size() > (current + 1);
1✔
32
  }
33

34
  @Override
35
  public Map<String, List<MetricResult>> next() {
36
    if (!hasNext())
1✔
NEW
37
      throw new NoSuchElementException();
×
38
    String record = records.get(current++).toString();
1✔
39
    return this.calculator.measureAsMetricResult(record);
1✔
40
  }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc