diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..3772ba7 --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,7 @@ +# This file is managed by Copier; DO NOT EDIT OR REMOVE. +_commit: v0.1.4 +_src_path: git@github.com:quantco/copier-template-pre-commit-mirrors +description: Fixes sql lint errors with `SQLFluff` +entry: sqlfluff fix --force --show-lint-violations --processes 0 +tool: sqlfluff +url: https://github.com/sqlfluff/sqlfluff diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a2a06ab..5a74cb9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ updates: - package-ecosystem: github-actions directory: / schedule: - interval: weekly + interval: monthly reviewers: - quantco/ci groups: diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml index 30614d8..920451b 100644 --- a/.github/workflows/autoupdate.yml +++ b/.github/workflows/autoupdate.yml @@ -1,8 +1,9 @@ name: Autoupdate + on: workflow_dispatch: schedule: - - cron: "0 */6 * * *" + - cron: "0 0 * * 0" defaults: run: @@ -16,11 +17,10 @@ jobs: steps: - name: Checkout branch uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - name: Set up Conda env - uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 + uses: mamba-org/setup-micromamba@8767fb704bd78032e9392f0386bf46950bdd1194 with: + environment-file: environment.yml environment-name: check-env - name: Find latest version id: versions @@ -31,8 +31,8 @@ jobs: new_version=$(micromamba list -n check-env "$pkgname" --json | jq -r '.[0].version') if [[ "$new_version" != "$old_version" ]]; then sed -i "s/$old_version/$new_version/g" environment.yml - echo "pkgname=$pkgname" >> "$GITHUB_OUTPUT" - echo "new-version=$new_version" >> "$GITHUB_OUTPUT" + echo "pkgname=$pkgname" >> $GITHUB_OUTPUT + echo "new-version=$new_version" >> $GITHUB_OUTPUT fi - uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 if: steps.versions.outputs.pkgname diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd881a1..a2d7155 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: with: ref: ${{ github.head_ref }} - name: Set up Conda env - uses: mamba-org/provision-with-micromamba@3c96c0c27676490c63c18bc81f5c51895ac3e0e6 + uses: mamba-org/setup-micromamba@8767fb704bd78032e9392f0386bf46950bdd1194 with: + environment-file: environment.yml environment-name: test-env diff --git a/.github/workflows/keep-alive.yml b/.github/workflows/keep-alive.yml index b6d789e..d36d27e 100644 --- a/.github/workflows/keep-alive.yml +++ b/.github/workflows/keep-alive.yml @@ -1,8 +1,7 @@ name: Keep on: - # pull_request: schedule: - - cron: "0 6 * * SUN" # Once weekly on Sunday @ 0600 UTC + - cron: 0 6 * * SUN jobs: keep-alive: @@ -10,9 +9,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: gautamkrishnar/keepalive-workflow@60b13c92aeda855e493b83aaf482c25da7e0043b + - uses: gautamkrishnar/keepalive-workflow@5b3128727d02fe1a892d0a2987517c9ec8ca7425 with: - commit_message: "Ah ah ah, stayin' alive" + commit_message: Ah ah ah, stayin' alive committer_username: ForrestQuant - committer_email: "forrestquant@users.noreply.github.com" - time_elapsed: 50 # days + committer_email: forrestquant@users.noreply.github.com + time_elapsed: 50 # days diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml index e7ca244..b60154d 100644 --- a/.pre-commit-hooks.yaml +++ b/.pre-commit-hooks.yaml @@ -1,18 +1,16 @@ - id: sqlfluff-conda name: sqlfluff-conda + description: 'Fixes sql lint errors with `SQLFluff`' # Needs to use "--force" to disable confirmation # By default all the rules are applied entry: sqlfluff fix --force --show-lint-violations --processes 0 language: conda - description: "Fixes sql lint errors with `SQLFluff`" types: [sql] require_serial: true - additional_dependencies: [] - id: sqlfluff-conda-lint name: sqlfluff-conda entry: sqlfluff lint --processes 0 language: conda - description: "Lints sql files with `SQLFluff`" + description: 'Lints sql files with `SQLFluff`' types: [sql] require_serial: true - additional_dependencies: [] diff --git a/LICENSE b/LICENSE index 0c63cba..1f66540 100644 --- a/LICENSE +++ b/LICENSE @@ -1,29 +1,11 @@ -BSD 3-Clause License +Copyright 2024 QuantCo, Inc. -Copyright (c) 2022, QuantCo -All rights reserved. +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 08e3434..be1fc69 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -sqlfluff(-conda) mirror -=================== +# sqlfluff mirror Mirror of sqlfluff for pre-commit with conda as a language. -* For pre-commit: see https://github.com/pre-commit/pre-commit -* For sqlfluff: see https://github.com/sqlfluff/sqlfluff +For pre-commit: see [here](https://github.com/pre-commit/pre-commit) -### Using sqlfluff with pre-commit and conda: +For sqlfluff: see [here](https://github.com/sqlfluff/sqlfluff) + +## Using sqlfluff with pre-commit and conda: Add this to your `.pre-commit-config.yaml` ```yaml - - repo: https://github.com/Quantco/pre-commit-mirrors-sqlfluff + - repo: https://github.com/quantco/pre-commit-mirrors-sqlfluff rev: '' # Use the sha / tag you want to point at hooks: - id: sqlfluff-conda diff --git a/environment.yml b/environment.yml index 0474384..e1c0b52 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,5 @@ channels: - conda-forge + - nodefaults dependencies: - sqlfluff=2.3.5