Skip to content
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

Fix some bug risks and code quality issues #118

Merged
merged 1 commit into from Jan 15, 2020

Conversation

@sanketsaurav
Copy link
Contributor

sanketsaurav commented Jan 15, 2020

Changes:

  • Use set comprehension instead of calling set() on an iterable in src/sqlfluff/rules/std.py and test/linter_test.py
  • Use .values() to iterate over the values of a dictionary in src/sqlfluff/templaters.py
  • Use identity test, is, for comparing types in src/sqlfluff/parser/segments_base.py
  • Simplify if expression in src/sqlfluff/cli/commands.py

This PR also adds.deepsource.toml to run static analysis continuously on the repo with DeepSource. Upon enabling DeepSource, static analysis will be run on every PR to detect 500+ types of issues in the changes — including bug risks, anti-patterns, security vulnerabilities, etc.

DeepSource is free to use for open-source projects, and is used by teams at NASA, Uber, Slack among many others, and open-source projects like ThoughtWorks/Gauge, Masonite Framework, etc.

To enable DeepSource analysis after merging this PR, please follow these steps:

  1. Sign up on DeepSource with your GitHub account and grant access to this repo.
  2. Activate analysis on this repo here.

You can also look at the docs for more details. Do let me know if I can be of any help!

Cheers,

Sanket
Founder, DeepSource

Changes:
 - Use set comprehension instead of calling `set()` on an iterable in `src/sqlfluff/rules/std.py` and `test/linter_test.py`
 - Use `.values()` to iterate over the values of a dictionary in `src/sqlfluff/templaters.py`
 - Use identity test, `is`, for comparing types in `src/sqlfluff/parser/segments_base.py`
 - Simplify `if` expression in `src/sqlfluff/cli/commands.py`

Also added a `.deepsource.toml` configuration file to run continuous static analysis on the repository with DeepSource.
@sanketsaurav
Copy link
Contributor Author

sanketsaurav commented Jan 15, 2020

@alanmcruickshank I ran analysis on my own fork of sqlfluff. You can see the issues here.

@codecov
Copy link

codecov bot commented Jan 15, 2020

Codecov Report

Merging #118 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #118   +/-   ##
=======================================
  Coverage   90.34%   90.34%           
=======================================
  Files          22       22           
  Lines        2963     2963           
=======================================
  Hits         2677     2677           
  Misses        286      286
Flag Coverage Δ
#py35 90.16% <100%> (ø) ⬆️
#py36 90.19% <100%> (ø) ⬆️
#py37 90.19% <100%> (ø) ⬆️
#py38 90.06% <100%> (ø) ⬆️
Impacted Files Coverage Δ
src/sqlfluff/cli/commands.py 85.8% <100%> (ø) ⬆️
src/sqlfluff/parser/segments_base.py 85.78% <100%> (ø) ⬆️
src/sqlfluff/templaters.py 100% <100%> (ø) ⬆️
src/sqlfluff/rules/std.py 91.82% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e7373d...a666abd. Read the comment docs.

@alanmcruickshank
Copy link
Owner

alanmcruickshank commented Jan 15, 2020

thanks for this @sanketsaurav! I'll check it out.

@alanmcruickshank alanmcruickshank merged commit 5d5c1a9 into alanmcruickshank:master Jan 15, 2020
8 checks passed
8 checks passed
ci/circleci: doclinting Your tests passed on CircleCI!
Details
ci/circleci: linting Your tests passed on CircleCI!
Details
ci/circleci: py35 Your tests passed on CircleCI!
Details
ci/circleci: py36 Your tests passed on CircleCI!
Details
ci/circleci: py37 Your tests passed on CircleCI!
Details
ci/circleci: py38 Your tests passed on CircleCI!
Details
codecov/patch 100% of diff hit (target 90.34%)
Details
codecov/project 90.34% (+0%) compared to 6e7373d
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.