Skip to content

Add ignore js flag to format subcommand#2227

Open
andres-lowrie wants to merge 1 commit into
dataform-co:mainfrom
andres-lowrie:format-ignore-js-2
Open

Add ignore js flag to format subcommand#2227
andres-lowrie wants to merge 1 commit into
dataform-co:mainfrom
andres-lowrie:format-ignore-js-2

Conversation

@andres-lowrie

Copy link
Copy Markdown
Contributor

Updated for latest changes (from #1349)

Allows users to only format .sqlx files in case they use different formatters for js files.

@andres-lowrie
andres-lowrie requested a review from a team as a code owner July 18, 2026 20:39
@andres-lowrie
andres-lowrie requested review from zaptot and removed request for a team July 18, 2026 20:39
@google-cla

google-cla Bot commented Jul 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@apilaskowski apilaskowski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets also add missing tests.

  1. dataform format --help includes --ignore-js-files.
  2. running dataform format --ignore-js-files formats .sqlx files without modifying .js files.

Comment thread cli/index.ts
Comment thread cli/index.ts
Comment thread cli/index.ts
@kolina

kolina commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

/gcbrun

@andres-lowrie

Copy link
Copy Markdown
Contributor Author

Lets also add missing tests.

1. dataform format --help includes --ignore-js-files.

2. running dataform format --ignore-js-files formats .sqlx files without modifying .js files.

hey so I'm not having any luck using bazel to show me the failing tests, for example if I add the following to cli/index_help_test.ts

   test("shows help for 'format' command", async () => {
    const result = await getProcessResult(execFile(nodePath, [cliEntryPointPath, "help", "format"]));
    expect(result.exitCode).equals(0);
    const output = result.stdout;
    expect(output).to.include("Format the dataform project's files.");
    expect(output).to.include("--check");
    expect(output).to.include("Check if files are formatted correctly without modifying them.");
    expect(output).to.include("--actions");`
    expect(output).to.include("XXXXXXYYYYZZZZ");
    //                          ^
    //                          |
    //                          +--- should fail since this won't be included in the output
  });

and then I do

`bazel` test ... --test_tag_filters=-integration //cli

I get back a whole bunch of build failures but in particular I get back these lines

//cli:index_compile_test                                              NO STATUS
//cli:index_help_test                                                 NO STATUS
//cli:index_init_test                                                 NO STATUS
//cli:index_project_test                                              NO STATUS
//cli:index_run_e2e_test                                              NO STATUS

I would expect //cli:index_help_test to fail and the others to pass

😅 I don't know anything about bazel so I'm just grepping and praying, reading the BUILD files in confusion and hoping for the best here

the contributing.md has bazel test //cli:index_test but that comes back with

ERROR: no such target '//cli:index_test': target 'index_test' not declared in package 'cli' 

so I'm guessing bazel stuff changed but the docs didn't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants