Skip to content

Commit 63e28c5

Browse files
committed
JavaScript: Drop redundant columns from files and folders relations
1 parent 3bdc92b commit 63e28c5

File tree

4 files changed

+10
-482
lines changed

4 files changed

+10
-482
lines changed

javascript/extractor/src/com/semmle/js/extractor/test/TrapTests.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.semmle.util.data.StringUtil;
1212
import com.semmle.util.extraction.ExtractorOutputConfig;
1313
import com.semmle.util.io.WholeIO;
14+
import com.semmle.util.process.Env;
1415
import com.semmle.util.srcarchive.DummySourceArchive;
1516
import com.semmle.util.trap.ITrapWriterFactory;
1617
import com.semmle.util.trap.TrapWriter;
@@ -21,6 +22,7 @@
2122
import java.util.ArrayList;
2223
import java.util.Arrays;
2324
import java.util.Comparator;
25+
import java.util.LinkedHashMap;
2426
import java.util.List;
2527
import java.util.Map.Entry;
2628
import org.junit.AfterClass;
@@ -140,6 +142,10 @@ public void runtest() {
140142
options.add(inputFile.getAbsolutePath());
141143
}
142144

145+
LinkedHashMap<String, String> vars = new LinkedHashMap<>();
146+
vars.put("CODEQL_REDUCE_FILES_FOLDERS_RELATIONS", "true");
147+
Env.systemEnv().pushEnvironmentContext(vars);
148+
143149
final List<Pair<String, String>> expectedVsActual = new ArrayList<Pair<String, String>>();
144150
Main main =
145151
new Main(

javascript/ql/lib/semmle/javascript/Files.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ abstract class Container extends @container {
156156

157157
/** A folder. */
158158
class Folder extends Container, @folder {
159-
override string getAbsolutePath() { folders(this, result, _) }
159+
override string getAbsolutePath() { folders(this, result) }
160160

161161
/** Gets the file or subfolder in this folder that has the given `name`, if any. */
162162
Container getChildContainer(string name) {
@@ -203,7 +203,7 @@ class File extends Container, @file {
203203
*/
204204
Location getLocation() { hasLocation(this, result) }
205205

206-
override string getAbsolutePath() { files(this, result, _, _, _) }
206+
override string getAbsolutePath() { files(this, result) }
207207

208208
/** Gets the number of lines in this file. */
209209
int getNumberOfLines() { result = sum(int loc | numlines(this, loc, _, _) | loc) }

javascript/ql/lib/semmlecode.javascript.dbscheme

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,11 @@ numlines(int element_id: @sourceline ref,
2020
int num_comment: int ref
2121
);
2222

23-
24-
/*
25-
fromSource(0) = unknown,
26-
fromSource(1) = from source,
27-
fromSource(2) = from library
28-
*/
2923
files(unique int id: @file,
30-
varchar(900) name: string ref,
31-
varchar(900) simple: string ref,
32-
varchar(900) ext: string ref,
33-
int fromSource: int ref);
24+
varchar(900) name: string ref);
3425

3526
folders(unique int id: @folder,
36-
varchar(900) name: string ref,
37-
varchar(900) simple: string ref);
27+
varchar(900) name: string ref);
3828

3929

4030
@container = @folder | @file ;

0 commit comments

Comments
 (0)