Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public Object parse(String language, String content, String filePath) {
// Individual parsers
// ------------------------------------------------------------------

@SuppressWarnings("unchecked")
private Object parseYaml(String content) {
var yaml = new Yaml(new org.yaml.snakeyaml.constructor.SafeConstructor(new org.yaml.snakeyaml.LoaderOptions()));
var docs = new java.util.ArrayList<>();
Expand All @@ -82,7 +81,6 @@ private Object parseYaml(String content) {
return result;
}

@SuppressWarnings("unchecked")
private Object parseJson(String content) throws Exception {
Object data = objectMapper.readValue(content, Object.class);
Map<String, Object> result = new LinkedHashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import java.nio.file.Path;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.Instant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import java.nio.file.Path;
import java.text.NumberFormat;
import java.time.Instant;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.stream.Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
* (which have no legacy flat equivalent) are still read via the unified
* loader path and composed into the overlay.
*/
@SuppressWarnings("unchecked")
private static LegacyParse readAndTranslateLegacy(Path oldFile) {
Map<String, Object> raw;
try {
Expand Down Expand Up @@ -196,8 +195,7 @@
* {@code null} so {@link io.github.randomcodespace.iq.config.unified.ConfigMerger}
* correctly falls through to lower layers.
*/
@SuppressWarnings("unchecked")
static CodeIqUnifiedConfig translateLegacyToUnified(Map<String, Object> raw) {

Check warning on line 198 in src/main/java/io/github/randomcodespace/iq/config/ProjectConfigLoader.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 69 to 64, Complexity from 23 to 14, Nesting Level from 3 to 2, Number of Variables from 26 to 6.

See more on https://sonarcloud.io/project/issues?id=RandomCodeSpace_code-iq&issues=AZ26tzSQYodWBZ91j5Xw&open=AZ26tzSQYodWBZ91j5Xw&pullRequest=58
// --- project layer ---
String root = raw.containsKey("root_path") ? String.valueOf(raw.get("root_path")) : null;
String serviceName = raw.containsKey("service_name") ? String.valueOf(raw.get("service_name")) : null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.randomcodespace.iq.detector.csharp;

import io.github.randomcodespace.iq.detector.AbstractAntlrDetector;
import io.github.randomcodespace.iq.grammar.AntlrParserFactory;
import io.github.randomcodespace.iq.detector.DetectorContext;
import io.github.randomcodespace.iq.detector.DetectorResult;
import io.github.randomcodespace.iq.model.CodeEdge;
Expand Down Expand Up @@ -36,7 +35,6 @@ public class CSharpStructuresDetector extends AbstractAntlrDetector {
private static final Pattern USING_RE = Pattern.compile("^\\s*using\\s+([\\w.]+)\\s*;", Pattern.MULTILINE);
private static final Pattern HTTP_ATTR_RE = Pattern.compile("\\[(Http(?:Get|Post|Put|Delete|Patch))\\s*(?:\\(\"([^\"]*)\"\\))?\\]");
private static final Pattern ROUTE_RE = Pattern.compile("\\[Route\\(\"([^\"]*)\"\\)\\]");
private static final Pattern API_CONTROLLER_RE = Pattern.compile("\\[ApiController\\]");
private static final Pattern METHOD_RE = Pattern.compile("(?:public|protected|private|internal)\\s+(?:static\\s+|virtual\\s+|override\\s+|async\\s+|abstract\\s+)*(?:[\\w<>\\[\\]?,\\s]+)\\s+(\\w+)\\s*\\(");

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public class GraphqlResolverDetector extends AbstractRegexDetector {
private static final Pattern MUTATION_MAPPING_RE = Pattern.compile("@MutationMapping(?:\\s*\\(\\s*(?:name\\s*=\\s*)?\"([^\"]*)\"\\s*\\))?");
private static final Pattern SUBSCRIPTION_MAPPING_RE = Pattern.compile("@SubscriptionMapping(?:\\s*\\(\\s*(?:name\\s*=\\s*)?\"([^\"]*)\"\\s*\\))?");
private static final Pattern SCHEMA_MAPPING_RE = Pattern.compile("@SchemaMapping\\s*\\(\\s*(?:typeName\\s*=\\s*\"([^\"]*)\")?");
private static final Pattern BATCH_MAPPING_RE = Pattern.compile("@BatchMapping(?:\\s*\\(\\s*(?:field\\s*=\\s*)?\"([^\"]*)\"\\s*\\))?");
private static final Pattern DGS_QUERY_RE = Pattern.compile("@DgsQuery(?:\\s*\\(\\s*field\\s*=\\s*\"([^\"]*)\"\\s*\\))?");
private static final Pattern DGS_MUTATION_RE = Pattern.compile("@DgsMutation(?:\\s*\\(\\s*field\\s*=\\s*\"([^\"]*)\"\\s*\\))?");
private static final Pattern DGS_SUBSCRIPTION_RE = Pattern.compile("@DgsSubscription(?:\\s*\\(\\s*field\\s*=\\s*\"([^\"]*)\"\\s*\\))?");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"ManyToMany", "many_to_many");

// ---- Regex fallback patterns ----
private static final Pattern ENTITY_RE = Pattern.compile("@Entity");
private static final Pattern TABLE_RE = Pattern.compile("@Table\\s*\\(\\s*(?:name\\s*=\\s*)?\"(\\w+)\"");
private static final Pattern CLASS_RE = Pattern.compile("(?:public\\s+)?class\\s+(\\w+)");
private static final Pattern COLUMN_RE = Pattern.compile("@Column\\s*\\(([^)]*)\\)");
Expand All @@ -76,7 +75,7 @@
@Override
public DetectorResult detect(DetectorContext ctx) {
String text = ctx.content();
if (text == null || !text.contains("@Entity")) return DetectorResult.empty();

Check failure on line 78 in src/main/java/io/github/randomcodespace/iq/detector/jvm/java/JpaEntityDetector.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "@Entity" 3 times.

See more on https://sonarcloud.io/project/issues?id=RandomCodeSpace_code-iq&issues=AZ26tzJzYodWBZ91j5Xs&open=AZ26tzJzYodWBZ91j5Xs&pullRequest=58

Optional<CompilationUnit> cu = parse(ctx);
if (cu.isPresent()) {
Expand Down Expand Up @@ -236,7 +235,7 @@

// ==================== Regex fallback ====================

private DetectorResult detectWithRegex(DetectorContext ctx) {

Check warning on line 238 in src/main/java/io/github/randomcodespace/iq/detector/jvm/java/JpaEntityDetector.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 85 to 64, Complexity from 19 to 14, Nesting Level from 5 to 2, Number of Variables from 34 to 6.

See more on https://sonarcloud.io/project/issues?id=RandomCodeSpace_code-iq&issues=AZ26tzJzYodWBZ91j5Xt&open=AZ26tzJzYodWBZ91j5Xt&pullRequest=58
String text = ctx.content();
String[] lines = text.split("\n", -1);
List<CodeNode> nodes = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
)
@Component
public class SpringRestDetector extends AbstractJavaParserDetector {
private static final String PROP_REQUESTMAPPING = "RequestMapping";
private static final String PROP_CONSUMES = "consumes";
private static final String PROP_PATH = "path";
private static final String PROP_PRODUCES = "produces";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.randomcodespace.iq.detector.jvm.kotlin;

import io.github.randomcodespace.iq.detector.AbstractAntlrDetector;
import io.github.randomcodespace.iq.grammar.AntlrParserFactory;
import io.github.randomcodespace.iq.detector.DetectorContext;
import io.github.randomcodespace.iq.detector.DetectorResult;
import io.github.randomcodespace.iq.detector.StructuresDetectorHelper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.randomcodespace.iq.detector.jvm.scala;

import io.github.randomcodespace.iq.detector.AbstractAntlrDetector;
import io.github.randomcodespace.iq.grammar.AntlrParserFactory;
import io.github.randomcodespace.iq.detector.DetectorContext;
import io.github.randomcodespace.iq.detector.DetectorResult;
import io.github.randomcodespace.iq.detector.StructuresDetectorHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}

@Override
public DetectorResult detect(DetectorContext ctx) {

Check warning on line 51 in src/main/java/io/github/randomcodespace/iq/detector/structured/CloudFormationDetector.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 90 to 64, Complexity from 18 to 14, Nesting Level from 3 to 2, Number of Variables from 37 to 6.

See more on https://sonarcloud.io/project/issues?id=RandomCodeSpace_code-iq&issues=AZ26tzPFYodWBZ91j5Xu&open=AZ26tzPFYodWBZ91j5Xu&pullRequest=58
Map<String, Object> data = getData(ctx);
if (data == null) {
return DetectorResult.empty();
Expand Down Expand Up @@ -187,7 +187,6 @@
return false;
}

@SuppressWarnings("unchecked")
private void collectRefs(Object value, Set<String> refs) {
if (value instanceof Map<?, ?> map) {
Object ref = map.get("Ref");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ private List<Map<String, Object>> getDocuments(DetectorContext ctx) {
return List.of();
}

@SuppressWarnings("unchecked")
private List<Map<String, Object>> extractContainers(Map<String, Object> spec, String kind) {
List<Map<String, Object>> containers = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.randomcodespace.iq.detector.systems.cpp;

import io.github.randomcodespace.iq.detector.AbstractAntlrDetector;
import io.github.randomcodespace.iq.grammar.AntlrParserFactory;
import io.github.randomcodespace.iq.detector.DetectorContext;
import io.github.randomcodespace.iq.detector.DetectorResult;
import io.github.randomcodespace.iq.model.CodeEdge;
Expand Down Expand Up @@ -55,7 +54,7 @@
}

@Override
protected DetectorResult detectWithRegex(DetectorContext ctx) {

Check warning on line 57 in src/main/java/io/github/randomcodespace/iq/detector/systems/cpp/CppStructuresDetector.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

A "Brain Method" was detected. Refactor it to reduce at least one of the following metrics: LOC from 88 to 64, Complexity from 20 to 14, Nesting Level from 3 to 2, Number of Variables from 34 to 6.

See more on https://sonarcloud.io/project/issues?id=RandomCodeSpace_code-iq&issues=AZ26tzQKYodWBZ91j5Xv&open=AZ26tzQKYodWBZ91j5Xv&pullRequest=58
String text = ctx.content();
if (text == null || text.isEmpty()) return DetectorResult.empty();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.github.randomcodespace.iq.detector.DetectorContext;
import io.github.randomcodespace.iq.detector.DetectorResult;
import io.github.randomcodespace.iq.grammar.AntlrParserFactory;
import io.github.randomcodespace.iq.grammar.javascript.JavaScriptParser;
import io.github.randomcodespace.iq.grammar.javascript.JavaScriptParserBaseListener;
import io.github.randomcodespace.iq.model.CodeNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ public class SequelizeORMDetector extends AbstractTypeScriptDetector {
"class\\s+(\\w+)\\s+extends\\s+Model\\s*\\{"
);

private static final Pattern MODEL_INIT_RE = Pattern.compile(
"(\\w+)\\.init\\s*\\(\\s*\\{"
);

private static final Pattern CONNECTION_RE = Pattern.compile(
"new\\s+Sequelize(?:\\.Sequelize)?\\s*\\("
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.github.randomcodespace.iq.grammar.golang;

import java.util.List;
import org.antlr.v4.runtime.*;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.github.randomcodespace.iq.analyzer;

import io.github.randomcodespace.iq.analyzer.linker.Linker;
import io.github.randomcodespace.iq.analyzer.linker.LinkResult;
import io.github.randomcodespace.iq.config.CodeIqConfig;
import io.github.randomcodespace.iq.detector.Detector;
import io.github.randomcodespace.iq.detector.DetectorContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.github.randomcodespace.iq.analyzer;

import io.github.randomcodespace.iq.analyzer.linker.Linker;
import io.github.randomcodespace.iq.cache.AnalysisCache;
import io.github.randomcodespace.iq.config.CodeIqConfig;
import io.github.randomcodespace.iq.detector.Detector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,10 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;

import io.github.randomcodespace.iq.model.CodeEdge;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import static org.junit.jupiter.api.Assertions.*;

Expand All @@ -135,7 +131,6 @@ class FullAnalysisIntegrationTest {
/**
* Build all detectors manually — no Spring context needed.
*/
@SuppressWarnings("unchecked")
private static List<Detector> allDetectors() {
// Use explicit Detector[] to avoid List.of() varargs inference issue with 90+ subtypes
Detector[] detectors = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import io.github.randomcodespace.iq.model.CodeNode;
import io.github.randomcodespace.iq.model.NodeKind;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ private Map<String, Object> asWrapper(Object result) {
return (Map<String, Object>) result;
}

@SuppressWarnings("unchecked")
private <T> T getData(Object result) {
Map<String, Object> wrapper = asWrapper(result);
return (T) wrapper.get("data");
}

// ---- YAML ----

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.is;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,14 @@
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
package io.github.randomcodespace.iq.api;

import io.github.randomcodespace.iq.config.CodeIqConfig;
import io.github.randomcodespace.iq.query.TopologyService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import io.github.randomcodespace.iq.config.CodeIqConfig;
import io.github.randomcodespace.iq.graph.GraphStore;
import io.github.randomcodespace.iq.mcp.McpTools;
import io.github.randomcodespace.iq.model.CodeEdge;
import io.github.randomcodespace.iq.model.CodeNode;
import io.github.randomcodespace.iq.query.QueryService;
import io.github.randomcodespace.iq.query.StatsService;
import io.github.randomcodespace.iq.query.TopologyService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.github.randomcodespace.iq.config.CodeIqConfig;
import io.github.randomcodespace.iq.flow.FlowEngine;
import io.github.randomcodespace.iq.graph.GraphStore;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -20,7 +19,6 @@
import java.util.zip.ZipFile;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.when;
import io.github.randomcodespace.iq.config.CodeIqConfigTestSupport;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import io.github.randomcodespace.iq.config.CodeIqConfig;
import io.github.randomcodespace.iq.flow.FlowEngine;
import io.github.randomcodespace.iq.flow.FlowModels.FlowDiagram;
import io.github.randomcodespace.iq.graph.GraphStore;
import io.github.randomcodespace.iq.model.CodeNode;
import io.github.randomcodespace.iq.model.NodeKind;
Expand All @@ -22,7 +21,6 @@
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
import java.util.Map;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.*;
import io.github.randomcodespace.iq.config.CodeIqConfigTestSupport;

Expand Down
Loading
Loading