Skip to content

Commit 12e56ec

Browse files
authored
Merge pull request #6887 from github/hubwriter/codeql-ruby-support
Docs: Updates for Ruby support
2 parents 02b1fe2 + 8f15dc4 commit 12e56ec

File tree

11 files changed

+37
-13
lines changed

11 files changed

+37
-13
lines changed

docs/codeql/codeql-cli/about-ql-packs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ QL packs are used to organize the files used in CodeQL analysis. They
77
contain queries, library files, query suites, and important metadata.
88

99
The `CodeQL repository <https://github.com/github/codeql>`__ contains QL packs for
10-
C/C++, C#, Java, JavaScript, and Python. The `CodeQL for Go
10+
C/C++, C#, Java, JavaScript, Python, and Ruby. The `CodeQL for Go
1111
<https://github.com/github/codeql-go/>`__ repository contains a QL pack for Go
1212
analysis. You can also make custom QL packs to contain your own queries and
1313
libraries.

docs/codeql/codeql-cli/creating-codeql-databases.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ Creating databases for non-compiled languages
8888
---------------------------------------------
8989

9090
The CodeQL CLI includes extractors to create databases for non-compiled
91-
languages---specifically, JavaScript (and TypeScript) and Python. These
92-
extractors are automatically invoked when you specify JavaScript or Python as
91+
languages---specifically, JavaScript (and TypeScript), Python, and Ruby. These
92+
extractors are automatically invoked when you specify JavaScript, Python, or Ruby as
9393
the ``--language`` option when executing ``database create``. When creating
9494
databases for these languages you must ensure that all additional dependencies
9595
are available.
9696

9797
.. pull-quote:: Important
9898

99-
When you run ``database create`` for JavaScript, TypeScript, and Python, you should not
99+
When you run ``database create`` for JavaScript, TypeScript, Python, and Ruby, you should not
100100
specify a ``--command`` option. Otherwise this overrides the normal
101101
extractor invocation, which will create an empty database. If you create
102102
databases for multiple languages and one of them is a compiled language,
@@ -129,14 +129,25 @@ When creating databases for Python you must ensure:
129129
packages that the codebase depends on.
130130
- You have installed the `virtualenv <https://pypi.org/project/virtualenv/>`__ pip module.
131131

132-
In the command line you must specify ``--language=python``. For example
132+
In the command line you must specify ``--language=python``. For example::
133133
::
134134

135135
codeql database create --language=python <output-folder>/python-database
136136

137-
executes the ``database create`` subcommand from the code's checkout root,
137+
This executes the ``database create`` subcommand from the code's checkout root,
138138
generating a new Python database at ``<output-folder>/python-database``.
139139

140+
Ruby
141+
~~~~
142+
143+
Creating databases for Ruby requires no additional dependencies.
144+
In the command line you must specify ``--language=ruby``. For example::
145+
146+
codeql database create --language=ruby --source-root <folder-to-extract> <output-folder>/ruby-database
147+
148+
Here, we have specified a ``--source-root`` path, which is the location where
149+
database creation is executed, but is not necessarily the checkout root of the
150+
codebase.
140151

141152
Creating databases for compiled languages
142153
-----------------------------------------

docs/codeql/codeql-cli/getting-started-with-the-codeql-cli.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ further options on the command line.
100100

101101
The `CodeQL repository <https://github.com/github/codeql>`__ contains
102102
the queries and libraries required for CodeQL analysis of C/C++, C#, Java,
103-
JavaScript/TypeScript, and Python.
103+
JavaScript/TypeScript, Python, and Ruby.
104104
Clone a copy of this repository into ``codeql-home``.
105105

106106
By default, the root of the cloned repository will be called ``codeql``.

docs/codeql/codeql-for-visual-studio-code/setting-up-codeql-in-visual-studio-code.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Using the starter workspace
7878
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7979
The starter workspace is a Git repository. It contains:
8080

81-
* The `repository of CodeQL libraries and queries <https://github.com/github/codeql>`__ for C/C++, C#, Java, JavaScript, and Python. This is included as a submodule, so it can be updated without affecting your custom queries.
81+
* The `repository of CodeQL libraries and queries <https://github.com/github/codeql>`__ for C/C++, C#, Java, JavaScript, Python, and Ruby. This is included as a submodule, so it can be updated without affecting your custom queries.
8282
* The `repository of CodeQL libraries and queries <https://github.com/github/codeql-go>`__ for Go. This is also included as a submodule.
8383
* A series of folders named ``codeql-custom-queries-<language>``. These are ready for you to start developing your own custom queries for each language, using the standard libraries. There are some example queries to get you started.
8484

docs/codeql/codeql-language-guides/codeql-for-ruby.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
1414
- :doc:`Basic query for Ruby code <basic-query-for-ruby-code>`: Learn to write and run a simple CodeQL query using LGTM.
1515

1616
- :doc:`CodeQL library for Ruby <codeql-library-for-ruby>`: When you're analyzing a Ruby program, you can make use of the large collection of classes in the CodeQL library for Ruby.
17+
18+
.. include:: ../reusables/ruby-beta-note.rst

docs/codeql/query-help/codeql-cwe-coverage.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ Note that the CWE coverage includes both "`supported queries <https://github.com
3333
java-cwe
3434
javascript-cwe
3535
python-cwe
36+
37+
.. include:: ../reusables/ruby-beta-note.rst

docs/codeql/query-help/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ View the query help for the queries included in the ``code-scanning``, ``securit
1010
- :doc:`CodeQL query help for JavaScript <javascript>`
1111
- :doc:`CodeQL query help for Python <python>`
1212

13-
1413
.. pull-quote:: Information
1514

1615
Each query help article includes:
@@ -23,6 +22,8 @@ View the query help for the queries included in the ``code-scanning``, ``securit
2322

2423
For a full list of the CWEs covered by these queries, see ":doc:`CodeQL CWE coverage <codeql-cwe-coverage>`."
2524

25+
.. include:: ../reusables/ruby-beta-note.rst
26+
2627
.. toctree::
2728
:hidden:
2829
:titlesonly:

docs/codeql/reusables/extractors.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
* - JavaScript/TypeScript
1616
- ``javascript``
1717
* - Python
18-
- ``python``
18+
- ``python``
19+
* - Ruby
20+
- ``ruby``
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. pull-quote:: Note
2+
3+
CodeQL analysis for Ruby is currently in beta. During the beta, analysis of Ruby code,
4+
and the accompanying documentation, will not be as comprehensive as for other languages.

docs/codeql/support/reusables/versions-compilers.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
Eclipse compiler for Java (ECJ) [5]_",``.java``
2323
JavaScript,ECMAScript 2021 or lower,Not applicable,"``.js``, ``.jsx``, ``.mjs``, ``.es``, ``.es6``, ``.htm``, ``.html``, ``.xhm``, ``.xhtml``, ``.vue``, ``.json``, ``.yaml``, ``.yml``, ``.raml``, ``.xml`` [6]_"
2424
Python,"2.7, 3.5, 3.6, 3.7, 3.8, 3.9",Not applicable,``.py``
25-
TypeScript [7]_,"2.6-4.4",Standard TypeScript compiler,"``.ts``, ``.tsx``"
25+
Ruby [7]_,"up to 3.02",Not applicable,"``.rb``, ``.erb``, ``.gemspec``, ``Gemfile``"
26+
TypeScript [8]_,"2.6-4.4",Standard TypeScript compiler,"``.ts``, ``.tsx``"
2627

2728
.. container:: footnote-group
2829

@@ -32,4 +33,5 @@
3233
.. [4] Builds that execute on Java 7 to 16 can be analyzed. The analysis understands Java 16 standard language features.
3334
.. [5] ECJ is supported when the build invokes it via the Maven Compiler plugin or the Takari Lifecycle plugin.
3435
.. [6] JSX and Flow code, YAML, JSON, HTML, and XML files may also be analyzed with JavaScript files.
35-
.. [7] TypeScript analysis is performed by running the JavaScript extractor with TypeScript enabled. This is the default for LGTM.
36+
.. [7] Requires glibc 2.17.
37+
.. [8] TypeScript analysis is performed by running the JavaScript extractor with TypeScript enabled. This is the default for LGTM.

0 commit comments

Comments
 (0)