Skip to content

Commit 16c6c23

Browse files
committed
Enable analysis over a single file provided as a string to codeanalyzer.
Signed-off-by: Rahul Krishna <[email protected]>
1 parent c289cc6 commit 16c6c23

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

output.json

Whitespace-only changes.

src/main/java/com/ibm/northstar/CodeAnalyzer.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class CodeAnalyzer implements Runnable {
5858
@Option(names = {"--no-build"}, description = "Do not build your application. Use this option if you have already built your application.")
5959
private static boolean noBuild = false;
6060

61-
@Option(names = {"-a", "--analysis-level"}, description = "Level of analysis to perform. Options: 1 (for just symbol table) or 2 (for full analysis including the system depenedency graph). Default: 1")
61+
@Option(names = {"-a", "--analysis-level"}, description = "Level of analysis to perform. Options: 1 (for just symbol table) or 2 (for call graph). Default: 1")
6262
private static int analysisLevel = 1;
6363

6464
@Option(names = {"-d", "--dependencies"}, description = "Path to the application 3rd party dependencies that may be helpful in analyzing the application.")
@@ -158,15 +158,7 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG
158158

159159
private static void emit(String consolidatedJSONString) throws IOException {
160160
if (output == null) {
161-
byte[] bytes = consolidatedJSONString.getBytes(StandardCharsets.UTF_8);
162-
// Create the GZIPOutputStream, using System.out
163-
GZIPOutputStream gzipOS = new GZIPOutputStream(System.out);
164-
// Write the byte array to the GZIPOutputStream
165-
gzipOS.write(bytes);
166-
// Flush the GZIPOutputStream
167-
gzipOS.flush();
168-
// Close the GZIPOutputStream
169-
gzipOS.close();
161+
System.out.println(consolidatedJSONString);
170162
} else {
171163
// If output is not null, export to a file
172164
File file = new File(output, "analysis.json");

0 commit comments

Comments
 (0)