diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4a13a7ce --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{go,mod}] +indent_style = tab + +[*.{yml,yaml,js,html,css,svg}] +indent_size = 2 + +[*.{py,sh,bash,zsh,fish}] +indent_size = 4 diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..0196ba62 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,4 @@ +# Code formatting fixes +1edfbb5a86f4f3e3d00e34ea7c2e034fee6a217f +7b8d457a991b6cc0c47e4386f0881cad1183aaee +e89b95ccc44c73ceaaacb1fa2393f13b962bfcc2 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3974142b..6d6cd785 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -21,7 +21,7 @@ on: description: "Where to deploy to" required: true type: environment - + release_tag: description: "Tag of the GitHub release (example: v0.0.1)" required: true @@ -51,7 +51,7 @@ jobs: role-to-assume: ${{ secrets.AWS_ROLE }} role-session-name: deploy-${{ inputs.environment }}-${{ github.run_id }}-${{ github.run_attempt }} aws-region: ${{ vars.AWS_REGION }} - + - name: Check role run: | aws sts get-caller-identity @@ -61,7 +61,7 @@ jobs: gh release download ${{ inputs.release_tag }} --repo ${{ github.repository }} env: GH_TOKEN: ${{ github.token }} - + - name: Upload artifacts run: | aws s3 cp . s3://dbc-distribution/${{ inputs.release_tag }} --recursive diff --git a/.github/workflows/publish_install_script.yml b/.github/workflows/publish_install_script.yml index f618acc6..63297335 100644 --- a/.github/workflows/publish_install_script.yml +++ b/.github/workflows/publish_install_script.yml @@ -44,7 +44,7 @@ jobs: role-to-assume: ${{ secrets.AWS_ROLE }} role-session-name: deploy-production-${{ github.run_id }}-${{ github.run_attempt }} aws-region: ${{ vars.AWS_REGION }} - + - name: Check role run: | aws sts get-caller-identity diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31ac8db0..8d05d282 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: - name: Import signing GPG key env: COLUMNAR_GPG_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} - run: | + run: | echo "$COLUMNAR_GPG_KEY" | gpg --batch --import KEY_ID=$(gpg -K | sed -n '/^\s/s/\s*//p') printf "trust\n5\ny\nquit\n" | gpg --batch --no-tty --command-fd 0 --edit-key "$KEY_ID" @@ -83,17 +83,17 @@ jobs: - name: Run GoReleaser Snapshot uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 - id: gorelease-snapshot + id: gorelease-snapshot with: distribution: goreleaser-pro version: "~> v2" args: release -p 20 --clean --snapshot env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} - - name: Upload Snapshot Artifacts + - name: Upload Snapshot Artifacts uses: actions/upload-artifact@v4 with: name: snapshot-artifacts @@ -138,7 +138,7 @@ jobs: - name: Import signing GPG key env: COLUMNAR_GPG_KEY: ${{ secrets.SIGNING_PRIVATE_KEY }} - run: | + run: | echo "$COLUMNAR_GPG_KEY" | gpg --batch --import KEY_ID=$(gpg -K | sed -n '/^\s/s/\s*//p') printf "trust\n5\ny\nquit\n" | gpg --batch --no-tty --command-fd 0 --edit-key "$KEY_ID" @@ -180,7 +180,7 @@ jobs: - name: Install anchore/quill run: | curl -sSfL https://get.anchore.io/quill | sudo sh -s -- -b /usr/local/bin - + # setup digicert signing - uses: digicert/ssm-code-signing@fb61e357690ad6aaa11c372000c37fb74d35c000 # v1.1.1 id: digicert @@ -205,7 +205,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 - id: gorelease + id: gorelease with: distribution: goreleaser-pro version: "~> v2" @@ -222,7 +222,7 @@ jobs: MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }} DBC_TAP_GITHUB_PAT: ${{ secrets.DBC_TAP_GITHUB_PAT }} - - name: Publish to PyPI + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # 1.12.4 with: packages-dir: dist/python/ diff --git a/.gitignore b/.gitignore index 80607edf..9f6ddb38 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,4 @@ cdn-dev .cache .venv -.claude \ No newline at end of file +.claude diff --git a/.goreleaser.yaml b/.goreleaser.yaml index a1b7251d..e7599e37 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -40,7 +40,7 @@ builds: goos: - linux - windows - - darwin + - darwin goarch: - amd64 - arm64 @@ -131,7 +131,7 @@ dockers: build_flag_templates: - "--platform=linux/amd64" - image_templates: - - "columnar/dbc:{{ .Tag }}-amd64" + - "columnar/dbc:{{ .Tag }}-amd64" - "columnar/dbc:v{{ .Major }}-amd64" - "columnar/dbc:v{{ .Major }}.{{ .Minor }}-amd64" - "columnar/dbc:latest-amd64" @@ -149,7 +149,7 @@ dockers: build_flag_templates: - "--platform=linux/arm64/v8" - image_templates: - - "columnar/dbc:{{ .Tag }}-arm64v8" + - "columnar/dbc:{{ .Tag }}-arm64v8" - "columnar/dbc:v{{ .Major }}-arm64v8" - "columnar/dbc:v{{ .Major }}.{{ .Minor }}-arm64v8" - "columnar/dbc:latest-arm64v8" @@ -191,9 +191,9 @@ docker_manifests: # secret_name: "DOCKER_TOKEN" # disable: '{{ or (not .IsRelease) (ne .Prerelease "") }}' # images: -# - "columnar/dbc:{{ .Version }}" -# - "columnar/dbc:{{ .Tag }}" -# - "columnar/dbc:v{{ .Major }}" +# - "columnar/dbc:{{ .Version }}" +# - "columnar/dbc:{{ .Tag }}" +# - "columnar/dbc:v{{ .Major }}" # - "columnar/dbc:v{{ .Major }}.{{ .Minor }}" # - "columnar/dbc:latest" # description: Official Docker images for dbc, the CLI for installing ADBC drivers. @@ -209,7 +209,7 @@ nfpms: vendor: Columnar Technologies Inc. homepage: "https://columnar.tech/dbc" license: Apache-2.0 - + description: >- A CLI utility for managing ADBC drivers @@ -223,7 +223,7 @@ nfpms: dst: /etc/bash_completion.d/dbc - src: cmd/dbc/completions/dbc.zsh - dst: /usr/share/zsh/vendor-completions/_dbc + dst: /usr/share/zsh/vendor-completions/_dbc - src: cmd/dbc/completions/dbc.fish dst: /usr/share/fish/vendor_completions.d/dbc.fish @@ -304,13 +304,13 @@ snapshot: homebrew_casks: - name: dbc alternative_names: - - dbc@{{ .Version }} + - dbc@{{ .Version }} - dbc@{{ .Major }}.{{ .Minor }} ids: - archives url: template: "https://github.com/columnar-tech/dbc/releases/download/{{ .Tag }}/{{ .ArtifactName }}" - verified: "github.com/columnar-tech/dbc/" + verified: "github.com/columnar-tech/dbc/" cookies: license: "accept-backup" commit_msg_template: "Brew cask update for {{ .ProjectName }} version {{ .Tag }}" diff --git a/ci/scripts/run_integration.sh b/ci/scripts/run_integration.sh index 077886f1..4e39c960 100755 --- a/ci/scripts/run_integration.sh +++ b/ci/scripts/run_integration.sh @@ -5,9 +5,9 @@ set -eux python -m venv .venv if [ -f ".venv/bin/activate" ]; then - . ".venv/bin/activate" + . ".venv/bin/activate" else - . ".venv/Scripts/activate" + . ".venv/Scripts/activate" fi pip install adbc_driver_manager diff --git a/cmd/dbc/completions/dbc.zsh b/cmd/dbc/completions/dbc.zsh index 95a20355..78294ca7 100644 --- a/cmd/dbc/completions/dbc.zsh +++ b/cmd/dbc/completions/dbc.zsh @@ -9,7 +9,7 @@ function _dbc { _arguments -C \ "1: :->subcommand" \ "*::arg:->args" - + case $state in subcommand) _values "dbc command" \ @@ -60,7 +60,7 @@ function _dbc { esac } -function _dbc_install_completions { +function _dbc_install_completions { _arguments \ '(--help)-h[Help]' \ '(-h)--help[Help]' \ @@ -90,7 +90,7 @@ function _dbc_add_completions { '(-h)--help[Help]' \ '(-p)--path[driver list to add to]: :_files -g \*.toml' \ '(--path)-p[driver list to add to]: :_files -g \*.toml' \ - ':driver name: ' + ':driver name: ' } function _dbc_sync_completions { diff --git a/resources/dbc.wxs b/resources/dbc.wxs index 7f6cc45f..89e977fb 100644 --- a/resources/dbc.wxs +++ b/resources/dbc.wxs @@ -18,10 +18,10 @@ limitations under the License. {{ if eq .MsiArch "x64" }} - + {{ else }} - + {{ end }} @@ -89,4 +89,4 @@ limitations under the License. - \ No newline at end of file + diff --git a/scripts/create_wheels.py b/scripts/create_wheels.py index 7b434415..6d785b14 100644 --- a/scripts/create_wheels.py +++ b/scripts/create_wheels.py @@ -194,7 +194,7 @@ def write_wheel(out_dir, *, name, version, tag, metadata, description, contents) { **contents, f"{dist_info}/entry_points.txt": make_message([], - '[console_scripts]\ndbc = dbc.__main__:dummy'), + '[console_scripts]\ndbc = dbc.__main__:dummy'), f"{dist_info}/METADATA": make_message( [ ("Metadata-Version", "2.4"), @@ -294,7 +294,7 @@ def dummy(): """Dummy function for an entrypoint. dbc is executed as a side effe ("Project-URL", "source, https://github.com/columnar-tech/dbc"), ("Classifier", "Intended Audience :: Developers"), ("Classifier", "Topic :: Software Development"), - ("Classifier", "Topic :: Scientific/Engineering"), + ("Classifier", "Topic :: Scientific/Engineering"), ], description=description, contents=contents, diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 9c38c0e5..d6a28c90 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -247,7 +247,7 @@ function Invoke-Installer($artifacts, $platforms) { # The actual path we're going to install to $dest_dir = $null - + # Before actually consulting the configured install strategy, see # if we're overriding it. if (($force_install_dir)) { @@ -256,11 +256,11 @@ function Invoke-Installer($artifacts, $platforms) { $dest_dir = Join-Path $force_install_dir "bin" } "flat" { - $dest_dir = $force_install_dir + $dest_dir = $force_install_dir } Default { throw "Error: unrecognized installation layout: $install_layout" - } + } } } if (-not $dest_dir) { @@ -433,4 +433,3 @@ try { Write-Information $_ exit 1 } - diff --git a/scripts/install.sh b/scripts/install.sh index 1b6ea414..6a6ae854 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -145,7 +145,7 @@ download_binary_and_run_installer() { ;; --verbose) PRINT_VERBOSE=1 - ;; + ;; *) OPTIND=1 if [ "${arg%%--*}" = "" ]; then @@ -185,7 +185,7 @@ download_binary_and_run_installer() { # look up what archives support this platform local _artifact_name _artifact_name="$(select_archive_for_arch "$_true_arch")" || return 1 - + # download the archive local _url="$ARTIFACT_DOWNLOAD_URL/$_artifact_name" local _dir @@ -200,12 +200,12 @@ download_binary_and_run_installer() { ensure mkdir -p "$_dir" if ! downloader "$_url" "$_file"; then - say "failed to download $_url" - say "this may be a standard network error, but it may also indicate" - say "that there's no release of $APP_NAME for your platform ($_true_arch)." - say "Please open an issue at https://github.com/columnar-tech/dbc/issues" - say "to request a build for your platform!" - exit 1 + say "failed to download $_url" + say "this may be a standard network error, but it may also indicate" + say "that there's no release of $APP_NAME for your platform ($_true_arch)." + say "Please open an issue at https://github.com/columnar-tech/dbc/issues" + say "to request a build for your platform!" + exit 1 fi # unpack the archive @@ -254,7 +254,7 @@ select_archive_for_arch() { # try each archive, checking runtime conditions like libc versions # accepting the first one that matches, as it's the best match - case "$_true_arch" in + case "$_true_arch" in "aarch64-apple-darwin") _archive="dbc-darwin-arm64-${APP_VERSION}.tar.gz" if [ -n "$_archive" ]; then @@ -985,7 +985,7 @@ install() { # To do this we need these values: # The actual path we're going to install to - local _install_dir + local _install_dir # Path to the an shell script that adds install_dir to PATH local _env_script_path # Potentially-late-bound version of install_dir to write env_script @@ -1003,7 +1003,7 @@ install() { # to the older generic one if [ -n "${DBC_INSTALL_DIR:-}" ]; then _force_install_dir="$DBC_INSTALL_DIR" - _install_layout="flat" + _install_layout="flat" elif [ -n "$UNMANAGED_INSTALL" ]; then _force_install_dir="$UNMANAGED_INSTALL" _install_layout="flat" @@ -1014,19 +1014,19 @@ install() { if [ -n "${_force_install_dir:-}" ]; then case "$_install_layout" in "hierarchical") - _install_dir="$_force_install_dir/bin" + _install_dir="$_force_install_dir/bin" _env_script_path="$_force_install_dir/env" _install_dir_expr="$(replace_home "$_force_install_dir/bin")" _env_script_path_expr="$(replace_home "$_force_install_dir/env")" ;; "cargo-home") - _install_dir="$_force_install_dir/bin" + _install_dir="$_force_install_dir/bin" _env_script_path="$_force_install_dir/env" _install_dir_expr="$(replace_home "$_force_install_dir/bin")" _env_script_path_expr="$(replace_home "$_force_install_dir/env")" ;; "flat") - _install_dir="$_force_install_dir" + _install_dir="$_force_install_dir" _env_script_path="$_force_install_dir/env" _install_dir_expr="$(replace_home "$_force_install_dir")" _env_script_path_expr="$(replace_home "$_force_install_dir/env")" @@ -1040,7 +1040,7 @@ install() { _install_layout="flat" # Install to $XDG_BIN_HOME if [ -n "${XDG_BIN_HOME:-}" ]; then - _install_dir="$XDG_BIN_HOME" + _install_dir="$XDG_BIN_HOME" _env_script_path="$XDG_BIN_HOME/env" _install_dir_expr="$(replace_home "$_install_dir")" _env_script_path_expr="$(replace_home "$_env_script_path")" @@ -1050,7 +1050,7 @@ install() { _install_layout="flat" # Install to $XDG_DATA_HOME/../bin if [ -n "${XDG_DATA_HOME:-}" ]; then - _install_dir="$XDG_DATA_HOME/../bin" + _install_dir="$XDG_DATA_HOME/../bin" _env_script_path="$XDG_DATA_HOME/../bin/env" _install_dir_expr="$(replace_home "$_install_dir")" _env_script_path_expr="$(replace_home "$_env_script_path")" @@ -1060,7 +1060,7 @@ install() { _install_layout="flat" # Install to $HOME/.local/bin if [ -n "${INFERRED_HOME:-}" ]; then - _install_dir="$INFERRED_HOME/.local/bin" + _install_dir="$INFERRED_HOME/.local/bin" _env_script_path="$INFERRED_HOME/.local/bin/env" _install_dir_expr="$INFERRED_HOME_EXPRESSION/.local/bin" _env_script_path_expr="$INFERRED_HOME_EXPRESSION/.local/bin/env" @@ -1078,11 +1078,11 @@ install() { _fish_env_script_path_expr="${_env_script_path_expr}.fish" say "Installing to $_install_dir:" - ensure mkdir -p "$_install_dir" + ensure mkdir -p "$_install_dir" # copy all the binaries to the install dir local _src_dir="$1" - local _bins="$2" + local _bins="$2" local _arch="$3" for _bin_name in $_bins; do local _bin="$_src_dir/$_bin_name" @@ -1098,9 +1098,9 @@ install() { say "Successfully installed dbc!" # Avoid modifying the users PATH if they are managing their PATH manually - case :$PATH: - in *:$_install_dir:*) NO_MODIFY_PATH=1 ;; - *) ;; + case :$PATH: in + *:$_install_dir:*) NO_MODIFY_PATH=1 ;; + *) ;; esac if [ "0" = "$NO_MODIFY_PATH" ]; then @@ -1255,7 +1255,7 @@ add_install_dir_to_path() { # # We search for both kinds of line here just to do the right thing in more cases. if ! grep -F "$_robust_line" "$_target" > /dev/null 2>/dev/null && \ - ! grep -F "$_pretty_line" "$_target" > /dev/null 2>/dev/null + ! grep -F "$_pretty_line" "$_target" > /dev/null 2>/dev/null then # If the script now exists, add the line to source it to the rcfile # (This will also create the rcfile if it doesn't exist) @@ -1307,7 +1307,7 @@ shotgun_install_dir_to_path() { done # Fall through to previous "create + write to first file in list" behavior - if [ "$_found" = false ]; then + if [ "$_found" = false ]; then add_install_dir_to_path "$_install_dir_expr" "$_env_script_path" "$_env_script_path_expr" "$_rcfiles" "$_shell" fi fi @@ -1351,10 +1351,10 @@ downloader() { # https://github.com/boukendesho/curl-snap/issues/1 _snap_curl=0 if command -v curl > /dev/null 2>&1; then - _curl_path=$(command -v curl) - if echo "$_curl_path" | grep "/snap/" > /dev/null 2>&1; then - _snap_curl=1 - fi + _curl_path=$(command -v curl) + if echo "$_curl_path" | grep "/snap/" > /dev/null 2>&1; then + _snap_curl=1 + fi fi # Check if we have a working (non-snap) curl @@ -1366,11 +1366,11 @@ downloader() { # If we can't fall back from broken snap curl to wget, report the broken snap curl elif [ "$_snap_curl" = "1" ] then - say "curl installed with snap cannot be used to install $APP_NAME" - say "due to missing permissions. Please uninstall it and" - say "reinstall curl with a different package manager (e.g., apt)." - say "See https://github.com/boukendesho/curl-snap/issues/1" - exit 1 + say "curl installed with snap cannot be used to install $APP_NAME" + say "due to missing permissions. Please uninstall it and" + say "reinstall curl with a different package manager (e.g., apt)." + say "See https://github.com/boukendesho/curl-snap/issues/1" + exit 1 else _dld='curl or wget' # to be used in error message of need_cmd fi