Ruby: Move language specific code out of FileSystem.qll (at least for now).

This commit is contained in:
Geoffrey White
2024-10-10 14:05:39 +01:00
parent d4414dabff
commit 8a895740ba
2 changed files with 18 additions and 18 deletions

View File

@@ -2,7 +2,6 @@
private import codeql.Locations
private import codeql.util.FileSystem
private import codeql.ruby.Diagnostics
private module Input implements InputSig {
abstract class ContainerBase extends @container {
@@ -35,20 +34,3 @@ class File extends Container, Impl::File {
/** Holds if this file was extracted from ordinary source code. */
predicate fromSource() { any() }
}
/**
* A successfully extracted file, that is, a file that was extracted and
* contains no extraction errors or warnings.
*/
class SuccessfullyExtractedFile extends File {
SuccessfullyExtractedFile() {
not exists(Diagnostic d |
d.getLocation().getFile() = this and
(
d instanceof ExtractionError
or
d instanceof ExtractionWarning
)
)
}
}

View File

@@ -18,6 +18,7 @@ private import ast.internal.Scope
private import ast.internal.Synthesis
private import ast.internal.TreeSitter
private import Customizations
private import Diagnostics
cached
private module Cached {
@@ -166,3 +167,20 @@ class RubyFile extends File {
/** Gets the number of lines of comments in this file. */
int getNumberOfLinesOfComments() { result = count(int line | this.line(line, true)) }
}
/**
* A successfully extracted file, that is, a file that was extracted and
* contains no extraction errors or warnings.
*/
class SuccessfullyExtractedFile extends RubyFile {
SuccessfullyExtractedFile() {
not exists(Diagnostic d |
d.getLocation().getFile() = this and
(
d instanceof ExtractionError
or
d instanceof ExtractionWarning
)
)
}
}