-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CodeQL workflow for GitHub code scanning #467
Conversation
This patch should also remove |
a2f3097
to
c1cfcc5
Compare
After integrating those other patches beforehand, this patch will apply successfully. |
- py/empty-except - py/mixed-returns - py/unused-local-variable
They don't work anymore, and it looks like there is no pendant for CodeQL.
Source: https://github.com/crate/crate-python/pull/467/checks?check_run_id=9647694567 No new or fixed alertsWarning: The base analysis for some categories could not be found. All their alerts have been reported as new. No new or fixed alertsAnalysesCode scanning compared
Warning: The base analysis for some categories could not be found. All their alerts have been reported as new. View all branch alerts. Code scanning compared refs/heads/master with refs/pull/467/merge (commit e1d63cc) and `` (commit 4e3706e). |
`zope.testrunner.run` already invokes `sys.exit`. No need to do it here.
.github/codeql.yml
Outdated
# TODO: May be improved. | ||
# https://codeql.github.com/codeql-query-help/python/py-unused-local-variable/ | ||
- exclude: | ||
id: py/unused-local-variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this easy to fix? I'd prefer not to exclude such warnings as unused variables may pollute our code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've removed suppressing this rule. Can I ask you to inspect [1] now? I don't see any way how to suppress those occurrances in any other sensible way. However, suppressing py/unused-local-variable
completely is also not sensible.
So, let's just dismiss those items like [2] as False positive interactively on the UI?
I think the code itself is sane.
crate-python/src/crate/client/sqlalchemy/tests/create_table_test.py
Lines 44 to 70 in 253a670
def test_create_table_with_basic_types(self): | |
class User(self.Base): | |
__tablename__ = 'users' | |
string_col = sa.Column(sa.String, primary_key=True) | |
unicode_col = sa.Column(sa.Unicode) | |
text_col = sa.Column(sa.Text) | |
int_col = sa.Column(sa.Integer) | |
long_col1 = sa.Column(sa.BigInteger) | |
long_col2 = sa.Column(sa.NUMERIC) | |
bool_col = sa.Column(sa.Boolean) | |
short_col = sa.Column(sa.SmallInteger) | |
datetime_col = sa.Column(sa.DateTime) | |
date_col = sa.Column(sa.Date) | |
float_col = sa.Column(sa.Float) | |
double_col = sa.Column(sa.DECIMAL) | |
self.Base.metadata.create_all() | |
fake_cursor.execute.assert_called_with( | |
('\nCREATE TABLE users (\n\tstring_col STRING, ' | |
'\n\tunicode_col STRING, \n\ttext_col STRING, \n\tint_col INT, ' | |
'\n\tlong_col1 LONG, \n\tlong_col2 LONG, ' | |
'\n\tbool_col BOOLEAN, ' | |
'\n\tshort_col SHORT, ' | |
'\n\tdatetime_col TIMESTAMP, \n\tdate_col TIMESTAMP, ' | |
'\n\tfloat_col FLOAT, \n\tdouble_col DOUBLE, ' | |
'\n\tPRIMARY KEY (string_col)\n)\n\n'), | |
()) |
[1] https://github.com/crate/crate-python/pull/467/checks?check_run_id=9668687460
[2] https://github.com/crate/crate-python/security/code-scanning/44
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed with crate-workbench/codeql-evaluations#4, reported to CodeQL with github/codeql#11407.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At github/codeql#11407 (comment), it has been acknowledged as a false positive. It has been recommended to dismiss those kinds of notices manually. I will do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Hi
crate/crate-python
!This is a one-off automatically generated pull request from LGTM.com 🤖. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!
With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.
This pull request enables code scanning by adding an auto-generated
codeql.yml
workflow file for GitHub Actions to your repository — take a look! We tested it before opening this pull request, so all should be working ✔️. In fact, you might already have seen some alerts appear on this pull request!Where needed and if possible, we’ve adjusted the configuration to the needs of your particular repository. But of course, you should feel free to tweak it further! Check this page for detailed documentation.
Questions? Check out the FAQ below!
FAQ
Click here to expand the FAQ section
How often will the code scanning analysis run?
By default, code scanning will trigger a scan with the CodeQL engine on the following events:
What will this cost?
Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.
What types of problems does CodeQL find?
The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the
security-and-quality
query suite for you.How do I upgrade my CodeQL engine?
No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.
The analysis doesn’t seem to be working
If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.
How do I disable LGTM.com?
If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).
Which source code hosting platforms does code scanning support?
GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.
How do I know this PR is legitimate?
This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!
I have another question / how do I get in touch?
Please join the discussion here to ask further questions and send us suggestions!