Skip to content

Commit

Permalink
Prepare for merge to sqlfluff origin branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbie Ostermann committed Jul 11, 2022
1 parent 35106a4 commit 8f19a8a
Show file tree
Hide file tree
Showing 19 changed files with 685 additions and 541 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ package-lock.json
*.vsix
.DS_Store
/vscode.d.ts
/vscode.proposed.d.ts
/vscode.proposed.d.ts
8 changes: 3 additions & 5 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint"]
}
18 changes: 9 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Place your settings in this file to overwrite default and user settings.
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off"
}
129 changes: 129 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@

# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible 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.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders 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, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement via email to
`admins`@`sqlfluff.com`. All complaints will be reviewed and investigated promptly
and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# vscode-sqlfluff - Contributing

:star2: **First** - thanks for being interested in improving vscode-sqlfluff! :smiley:

:star2: **Second** - please read and familiarise yourself with both the content of this guide and also our [code of conduct](CODE_OF_CONDUCT.md).

:star2: **Third** - the best way to get started contributing, is to use the tool in anger and then to submit bugs and features through github.

:star2: **Fourth** - making sure that our documentation is up to date and useful for new users is really important. If you're a new user, you're in precisely the best position to do this. Pull requests are always welcome with documentationimprovements.

:star2: **Fifth** - if you're so inclined - pull requests on the codebase are always welcome. Just fork the repo and create your branch from `master`. Please document your contributions in the `CHANGELOG.md`.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# vscode-sqlfluff

<p align="center">
<a href="https://marketplace.visualstudio.com/items?itemName=RobertOstermann.vscode-sqlfluff-extended"><img src="https://vsmarketplacebadge.apphb.com/version-short/RobertOstermann.vscode-sqlfluff-extended.svg" alt="VS Marketplace Version"></a>
<a href="https://marketplace.visualstudio.com/items?itemName=RobertOstermann.vscode-sqlfluff-extended"><img src="https://vsmarketplacebadge.apphb.com/installs-short/RobertOstermann.vscode-sqlfluff-extended.svg" alt="VS Marketplace Installs"></a>
<a href="https://marketplace.visualstudio.com/items?itemName=RobertOstermann.vscode-sqlfluff-extended"><img src="https://vsmarketplacebadge.apphb.com/rating-short/RobertOstermann.vscode-sqlfluff-extended.svg" alt="VS Marketplace Rating"></a>
</p>
![.github/workflows/ci.yml](https://github.com/dorzey/vscode-sqlfluff/workflows/.github/workflows/ci.yml/badge.svg)

A linter and auto-formatter for [SQLFluff](https://github.com/alanmcruickshank/sqlfluff), a popular linting tool for SQL and dbt.

Expand Down
38 changes: 19 additions & 19 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@ import * as vscode from "vscode";
import { EXCLUDE_RULE, SQLFLuffDocumentFormattingEditProvider, SQLFluffLinterProvider, SQLFluffQuickFix } from "./features/sqlFluffLinter";

export const activate = (context: vscode.ExtensionContext) => {
new SQLFluffLinterProvider().activate(context.subscriptions);
new SQLFluffLinterProvider().activate(context.subscriptions);

vscode.languages.registerDocumentFormattingEditProvider("sql", new SQLFLuffDocumentFormattingEditProvider().activate());
vscode.languages.registerDocumentFormattingEditProvider("sql-bigquery", new SQLFLuffDocumentFormattingEditProvider().activate());
vscode.languages.registerDocumentFormattingEditProvider("jinja-sql", new SQLFLuffDocumentFormattingEditProvider().activate());
vscode.languages.registerDocumentFormattingEditProvider("sql", new SQLFLuffDocumentFormattingEditProvider().activate());
vscode.languages.registerDocumentFormattingEditProvider("sql-bigquery", new SQLFLuffDocumentFormattingEditProvider().activate());
vscode.languages.registerDocumentFormattingEditProvider("jinja-sql", new SQLFLuffDocumentFormattingEditProvider().activate());

context.subscriptions.push(
vscode.languages.registerCodeActionsProvider("sql", new SQLFluffQuickFix(), {
providedCodeActionKinds: SQLFluffQuickFix.providedCodeActionKind
})
);
context.subscriptions.push(
vscode.languages.registerCodeActionsProvider("sql", new SQLFluffQuickFix(), {
providedCodeActionKinds: SQLFluffQuickFix.providedCodeActionKind
})
);

context.subscriptions.push(vscode.commands.registerCommand(EXCLUDE_RULE, toggleRule));
context.subscriptions.push(vscode.commands.registerCommand(EXCLUDE_RULE, toggleRule));
};

// eslint-disable-next-line @typescript-eslint/no-empty-function
export const deactivate: any = () => { };

function toggleRule(rule: string) {
const configuration = vscode.workspace.getConfiguration("sqlfluff");
const excludeRulesArray: string[] = configuration.get("excludeRules");
const configuration = vscode.workspace.getConfiguration("sqlfluff");
const excludeRulesArray: string[] = configuration.get("excludeRules");

if (!excludeRulesArray.includes(rule)) {
excludeRulesArray.push(rule);
}
if (!excludeRulesArray.includes(rule)) {
excludeRulesArray.push(rule);
}

excludeRulesArray.sort((x, y) => {
return parseInt(x.substring(1)) - parseInt(y.substring(1));
});
excludeRulesArray.sort((x, y) => {
return parseInt(x.substring(1)) - parseInt(y.substring(1));
});

return configuration.update("excludeRules", excludeRulesArray, vscode.ConfigurationTarget.Global);
return configuration.update("excludeRules", excludeRulesArray, vscode.ConfigurationTarget.Global);
}

2 changes: 1 addition & 1 deletion src/features/formatter/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class Process {

/**
* Creates a child process to execute a command.
*
*
* @param command - The command to run.
* @param args - A list of string arguments.
* @param options - The working directory and environment variables.
Expand Down
Loading

0 comments on commit 8f19a8a

Please sign in to comment.