Skip to content

Commit 7f03b87

Browse files
hvitvedaibaars
authored andcommitted
Drop redundant columns from files and folders relations
1 parent 32253aa commit 7f03b87

File tree

4 files changed

+5
-50
lines changed

4 files changed

+5
-50
lines changed

extractor/src/extractor.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,6 @@ impl TrapWriter {
6868
vec![
6969
Arg::Label(file_label),
7070
Arg::String(normalize_path(absolute_path)),
71-
Arg::String(match absolute_path.file_name() {
72-
None => "".to_owned(),
73-
Some(file_name) => format!("{}", file_name.to_string_lossy()),
74-
}),
75-
Arg::String(match absolute_path.extension() {
76-
None => "".to_owned(),
77-
Some(ext) => format!("{}", ext.to_string_lossy()),
78-
}),
79-
Arg::Int(1), // 1 = from source
8071
],
8172
);
8273
self.populate_parent_folders(file_label, absolute_path.parent());
@@ -102,10 +93,6 @@ impl TrapWriter {
10293
vec![
10394
Arg::Label(folder_label),
10495
Arg::String(normalize_path(folder)),
105-
Arg::String(match folder.file_name() {
106-
None => "".to_owned(),
107-
Some(file_name) => format!("{}", file_name.to_string_lossy()),
108-
}),
10996
],
11097
);
11198
path = folder.parent();

generator/src/main.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -375,27 +375,6 @@ fn create_files_table<'a>() -> dbscheme::Entry<'a> {
375375
ql_type: ql::Type::String,
376376
ql_type_is_ref: true,
377377
},
378-
dbscheme::Column {
379-
db_type: dbscheme::DbColumnType::String,
380-
name: "simple",
381-
unique: false,
382-
ql_type: ql::Type::String,
383-
ql_type_is_ref: true,
384-
},
385-
dbscheme::Column {
386-
db_type: dbscheme::DbColumnType::String,
387-
name: "ext",
388-
unique: false,
389-
ql_type: ql::Type::String,
390-
ql_type_is_ref: true,
391-
},
392-
dbscheme::Column {
393-
db_type: dbscheme::DbColumnType::Int,
394-
name: "fromSource",
395-
unique: false,
396-
ql_type: ql::Type::Int,
397-
ql_type_is_ref: true,
398-
},
399378
],
400379
})
401380
}
@@ -418,13 +397,6 @@ fn create_folders_table<'a>() -> dbscheme::Entry<'a> {
418397
ql_type: ql::Type::String,
419398
ql_type_is_ref: true,
420399
},
421-
dbscheme::Column {
422-
db_type: dbscheme::DbColumnType::String,
423-
name: "simple",
424-
unique: false,
425-
ql_type: ql::Type::String,
426-
ql_type_is_ref: true,
427-
},
428400
],
429401
})
430402
}

ql/lib/codeql/files/FileSystem.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,19 @@ abstract class Container extends @container {
155155

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

160160
/** Gets the URL of this folder. */
161161
override string getURL() { result = "folder://" + getAbsolutePath() }
162162
}
163163

164164
/** A file. */
165165
class File extends Container, @file {
166-
override string getAbsolutePath() { files(this, result, _, _, _) }
166+
override string getAbsolutePath() { files(this, result) }
167167

168168
/** Gets the URL of this file. */
169169
override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
170170

171171
/** Holds if this file was extracted from ordinary source code. */
172-
predicate fromSource() { files(this, _, _, _, 1) }
172+
predicate fromSource() { any() }
173173
}

ql/lib/ruby.dbscheme

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@ numlines(
2323

2424
files(
2525
unique int id: @file,
26-
string name: string ref,
27-
string simple: string ref,
28-
string ext: string ref,
29-
int fromSource: int ref
26+
string name: string ref
3027
);
3128

3229
folders(
3330
unique int id: @folder,
34-
string name: string ref,
35-
string simple: string ref
31+
string name: string ref
3632
);
3733

3834
@container = @file | @folder

0 commit comments

Comments
 (0)