CodeQL for VS Code starter: Initial commit.
This commit is contained in:
Коммит
b5133280e3
|
@ -0,0 +1,8 @@
|
|||
[submodule "ql"]
|
||||
path = ql
|
||||
url = https://github.com/Semmle/ql.git
|
||||
branch = lgtm.com
|
||||
[submodule "codeql-go"]
|
||||
path = codeql-go
|
||||
url = ../../github/codeql-go.git
|
||||
branch = lgtm.com
|
|
@ -0,0 +1,76 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to make participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at opensource@github.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
|
@ -0,0 +1,31 @@
|
|||
## Contributing
|
||||
|
||||
[fork]: https://github.com/github/vscode-codeql-starter/fork
|
||||
[pr]: https://github.com/github/vscode-codeql-starter/compare
|
||||
[style]: https://primer.style
|
||||
[code-of-conduct]: CODE_OF_CONDUCT.md
|
||||
|
||||
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
||||
|
||||
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.md).
|
||||
|
||||
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
|
||||
|
||||
## Submitting a pull request
|
||||
|
||||
0. [Fork][fork] and clone the repository
|
||||
0. Make your change
|
||||
0. Push to your fork and [submit a pull request][pr]
|
||||
0. Pat yourself on the back and wait for your pull request to be reviewed and merged.
|
||||
|
||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||
|
||||
- Follow the [style guide][style].
|
||||
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
|
||||
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
||||
|
||||
## Resources
|
||||
|
||||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
||||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
||||
- [GitHub Help](https://help.github.com)
|
|
@ -0,0 +1,20 @@
|
|||
Copyright (c) 2019 GitHub, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -0,0 +1,31 @@
|
|||
# vscode-codeql-starter
|
||||
|
||||
A starter workspace to use with the [CodeQL extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=github.vscode-codeql). For more information, see the [`vscode-codeql` repo](https://github.com/github/vscode-codeql/).
|
||||
|
||||
## Instructions
|
||||
|
||||
1. Install [Visual Studio Code](https://code.visualstudio.com).
|
||||
1. Install the [CodeQL extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=github.vscode-codeql).
|
||||
1. Clone this repository to your computer.
|
||||
- Make sure to include the submodules, either by `git clone --recursive` or by `git submodule update --init --remote` after clone.
|
||||
- Use `git submodule update --remote` regularly to keep the submodules up to date.
|
||||
1. In VS Code, click File > Open Workspace. Select the file `vscode-codeql-starter.code-workspace` in your checkout of this repository.
|
||||
1. You will see several folders open in the left sidebar:
|
||||
- The `ql` folder contains the [open-source CodeQL standard libraries](https://github.com/Semmle/ql/tree/lgtm.com) for C/C++, C#, Java, JavaScript, and Python. It tracks the `lgtm.com` branch. You can run the standard queries from here, and browse the libraries.
|
||||
- The `codeql-go` folder contains the [open-source CodeQL standard libraries](https://github.com/github/codeql-go/tree/lgtm.com) for Go. It tracks the `lgtm.com` branch. You can run the standard queries from here, and browse the libraries.
|
||||
- The folders named `codeql-custom-queries-<language>` are ready for you to start developing your own custom queries for each language, while using the standard libraries. There are some example queries to get you started.
|
||||
1. Follow the [documentation for the CodeQL extension](https://help.semmle.com/codeql/codeql-for-vscode.html) to learn how to set up the extension, add a database and run queries against it. Have fun!
|
||||
|
||||
## Contributing
|
||||
|
||||
This project welcomes contributions. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
|
||||
|
||||
## Reporting issues
|
||||
|
||||
Issues and suggestions should be reported in the [`vscode-codeql` repo](https://github.com/github/vscode-codeql/issues/new).
|
||||
|
||||
## License
|
||||
|
||||
This project is [licensed](LICENSE.md) under the MIT License.
|
||||
|
||||
The CodeQL extension for Visual Studio Code is [licensed](https://github.com/github/vscode-codeql/blob/master/extensions/ql-vscode/LICENSE.md) under the MIT License. The version of CodeQL used by the CodeQL extension is subject to the [CodeQL Research Terms & Conditions](https://securitylab.github.com/tools/codeql/license).
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @name Empty block
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id cpp/example/empty-block
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
from Block b
|
||||
where b.getNumStmt() = 0
|
||||
select b, "This is an empty block."
|
|
@ -0,0 +1,3 @@
|
|||
name: codeql-custom-queries-cpp
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-cpp
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @name Empty block
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id csharp/example/empty-block
|
||||
*/
|
||||
|
||||
import csharp
|
||||
|
||||
from BlockStmt b
|
||||
where b.getNumberOfStmts() = 0
|
||||
select b, "This is an empty block."
|
|
@ -0,0 +1,3 @@
|
|||
name: codeql-custom-queries-csharp
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-csharp
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @name Empty block
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id go/example/empty-block
|
||||
*/
|
||||
|
||||
import go
|
||||
|
||||
from BlockStmt b
|
||||
where b.getNumStmt() = 0
|
||||
select b, "This is an empty block."
|
|
@ -0,0 +1,3 @@
|
|||
name: codeql-custom-queries-go
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-go
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @name Empty block
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id java/example/empty-block
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
from Block b
|
||||
where b.getNumStmt() = 0
|
||||
select b, "This is an empty block."
|
|
@ -0,0 +1,3 @@
|
|||
name: codeql-custom-queries-java
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-java
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @name Empty block
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id javascript/example/empty-block
|
||||
*/
|
||||
|
||||
import javascript
|
||||
|
||||
from Block b
|
||||
where b.getNumStmt() = 0
|
||||
select b, "This is an empty block."
|
|
@ -0,0 +1,3 @@
|
|||
name: codeql-custom-queries-javascript
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-javascript
|
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* @name Empty scope
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id python/example/empty-scope
|
||||
*/
|
||||
|
||||
import python
|
||||
|
||||
from Scope s
|
||||
where count(s.getAStmt()) = 0
|
||||
select s, "This is an empty scope."
|
|
@ -0,0 +1,3 @@
|
|||
name: codeql-custom-queries-python
|
||||
version: 0.0.0
|
||||
libraryPathDependencies: codeql-python
|
|
@ -0,0 +1 @@
|
|||
Subproject commit d14eb855fc88e086b587f6c9695b59eb230c79e7
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 717490b6708ea28d8e724beedf4c6a47628282d2
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "codeql-custom-queries-cpp"
|
||||
},
|
||||
{
|
||||
"path": "codeql-custom-queries-csharp"
|
||||
},
|
||||
{
|
||||
"path": "codeql-custom-queries-go"
|
||||
},
|
||||
{
|
||||
"path": "codeql-custom-queries-java"
|
||||
},
|
||||
{
|
||||
"path": "codeql-custom-queries-javascript"
|
||||
},
|
||||
{
|
||||
"path": "codeql-custom-queries-python"
|
||||
},
|
||||
{
|
||||
"path": "codeql-go"
|
||||
},
|
||||
{
|
||||
"path": "ql"
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"ql.distribution.includePrerelease": true,
|
||||
"ql.distribution.owner": "github",
|
||||
"ql.distribution.repository": "codeql-cli-binaries"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче