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

base_commit & patch how to use? #201

Closed
xlisp opened this issue Aug 13, 2024 · 4 comments
Closed

base_commit & patch how to use? #201

xlisp opened this issue Aug 13, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@xlisp
Copy link

xlisp commented Aug 13, 2024

Describe the issue

The definition of base_commit & patch is vague. I git apply the patch content to checkout to base_commit, but found that the apply failed. What does this design mean? Then I manually set up env and found that this dataset types-pkg-resources does not exist. How can I use and test the patch with this dataset?

{'repo': 'sqlfluff/sqlfluff',
 'instance_id': 'sqlfluff__sqlfluff-4764',
 'base_commit': 'a820c139ccbe6d1865d73c4a459945cd69899f8f',
 'patch': 'diff --git a/src/sqlfluff/cli/commands.py b/src/sqlfluff/cli/commands.py\n--- a/src/sqlfluff/cli/commands.py\n+++ b/src/sqlfluff/cli/commands.py\n@@ -44,6 +44,7 @@\n     dialect_selector,\n     dialect_readout,\n )\n+from sqlfluff.core.linter import LintingResult\n from sqlfluff.core.config import progress_bar_configuration\n \n from sqlfluff.core.enums import FormatType, Color\n@@ -691,12 +692,16 @@ def lint(\n         sys.exit(EXIT_SUCCESS)\n \n \n-def do_fixes(lnt, result, formatter=None, **kwargs):\n+def do_fixes(\n+    result: LintingResult, formatter: Optional[OutputStreamFormatter] = None, **kwargs\n+):\n     """Actually do the fixes."""\n-    click.echo("Persisting Changes...")\n+    if formatter and formatter.verbosity >= 0:\n+        click.echo("Persisting Changes...")\n     res = result.persist_changes(formatter=formatter, **kwargs)\n     if all(res.values()):\n-        click.echo("Done. Please check your files to confirm.")\n+        if formatter and formatter.verbosity >= 0:\n+            click.echo("Done. Please check your files to confirm.")\n         return True\n     # If some failed then return false\n     click.echo(\n@@ -708,7 +713,7 @@ def do_fixes(lnt, result, formatter=None, **kwargs):\n     return False  # pragma: no cover\n \n \n-def _stdin_fix(linter, formatter, fix_even_unparsable):\n+def _stdin_fix(linter: Linter, formatter, fix_even_unparsable):\n     """Handle fixing from stdin."""\n     exit_code = EXIT_SUCCESS\n     stdin = sys.stdin.read()\n@@ -751,7 +756,7 @@ def _stdin_fix(linter, formatter, fix_even_unparsable):\n \n \n def _paths_fix(\n-    linter,\n+    linter: Linter,\n     formatter,\n     paths,\n     processes,\n@@ -765,11 +770,12 @@ def _paths_fix(\n ):\n     """Handle fixing from paths."""\n     # Lint the paths (not with the fix argument at this stage), outputting as we go.\n-    click.echo("==== finding fixable violations ====")\n+    if formatter.verbosity >= 0:\n+        click.echo("==== finding fixable violations ====")\n     exit_code = EXIT_SUCCESS\n \n     with PathAndUserErrorHandler(formatter):\n-        result = linter.lint_paths(\n+        result: LintingResult = linter.lint_paths(\n             paths,\n             fix=True,\n             ignore_non_existent_files=False,\n@@ -781,20 +787,18 @@ def _paths_fix(\n \n     # NB: We filter to linting violations here, because they\'re\n     # the only ones which can be potentially fixed.\n-    if result.num_violations(types=SQLLintError, fixable=True) > 0:\n-        click.echo("==== fixing violations ====")\n-        click.echo(\n-            f"{result.num_violations(types=SQLLintError, fixable=True)} fixable "\n-            "linting violations found"\n-        )\n+    num_fixable = result.num_violations(types=SQLLintError, fixable=True)\n+    if num_fixable > 0:\n+        if formatter.verbosity >= 0:\n+            click.echo("==== fixing violations ====")\n+        click.echo(f"{num_fixable} " "fixable linting violations found")\n         if force:\n-            if warn_force:\n+            if warn_force and formatter.verbosity >= 0:\n                 click.echo(\n                     f"{formatter.colorize(\'FORCE MODE\', Color.red)}: "\n                     "Attempting fixes..."\n                 )\n             success = do_fixes(\n-                linter,\n                 result,\n                 formatter,\n                 types=SQLLintError,\n@@ -809,9 +813,9 @@ def _paths_fix(\n             c = click.getchar().lower()\n             click.echo("...")\n             if c in ("y", "\\r", "\\n"):\n-                click.echo("Attempting fixes...")\n+                if formatter.verbosity >= 0:\n+                    click.echo("Attempting fixes...")\n                 success = do_fixes(\n-                    linter,\n                     result,\n                     formatter,\n                     types=SQLLintError,\n@@ -829,8 +833,9 @@ def _paths_fix(\n                 click.echo("Aborting...")\n                 exit_code = EXIT_FAIL\n     else:\n-        click.echo("==== no fixable linting violations found ====")\n-        formatter.completion_message()\n+        if formatter.verbosity >= 0:\n+            click.echo("==== no fixable linting violations found ====")\n+            formatter.completion_message()\n \n     error_types = [\n         (\n@@ -841,7 +846,7 @@ def _paths_fix(\n     ]\n     for num_violations_kwargs, message_format, error_level in error_types:\n         num_violations = result.num_violations(**num_violations_kwargs)\n-        if num_violations > 0:\n+        if num_violations > 0 and formatter.verbosity >= 0:\n             click.echo(message_format.format(num_violations))\n             exit_code = max(exit_code, error_level)\n \n@@ -880,10 +885,20 @@ def _paths_fix(\n     "--force",\n     is_flag=True,\n     help=(\n-        "skip the confirmation prompt and go straight to applying "\n+        "Skip the confirmation prompt and go straight to applying "\n         "fixes. **Use this with caution.**"\n     ),\n )\n+@click.option(\n+    "-q",\n+    "--quiet",\n+    is_flag=True,\n+    help=(\n+        "Reduces the amount of output to stdout to a minimal level. "\n+        "This is effectively the opposite of -v. NOTE: It will only "\n+        "take effect if -f/--force is also set."\n+    ),\n+)\n @click.option(\n     "-x",\n     "--fixed-suffix",\n@@ -913,6 +928,7 @@ def fix(\n     force: bool,\n     paths: Tuple[str],\n     bench: bool = False,\n+    quiet: bool = False,\n     fixed_suffix: str = "",\n     logger: Optional[logging.Logger] = None,\n     processes: Optional[int] = None,\n@@ -932,6 +948,13 @@ def fix(\n     """\n     # some quick checks\n     fixing_stdin = ("-",) == paths\n+    if quiet:\n+        if kwargs["verbose"]:\n+            click.echo(\n+                "ERROR: The --quiet flag can only be used if --verbose is not set.",\n+            )\n+            sys.exit(EXIT_ERROR)\n+        kwargs["verbose"] = -1\n \n     config = get_config(\n         extra_config_path, ignore_local_config, require_dialect=False, **kwargs\ndiff --git a/src/sqlfluff/cli/formatters.py b/src/sqlfluff/cli/formatters.py\n--- a/src/sqlfluff/cli/formatters.py\n+++ b/src/sqlfluff/cli/formatters.py\n@@ -94,7 +94,7 @@ def __init__(\n     ):\n         self._output_stream = output_stream\n         self.plain_output = self.should_produce_plain_output(nocolor)\n-        self._verbosity = verbosity\n+        self.verbosity = verbosity\n         self._filter_empty = filter_empty\n         self.output_line_length = output_line_length\n \n@@ -116,13 +116,13 @@ def _format_config(self, linter: Linter) -> str:\n         """Format the config of a `Linter`."""\n         text_buffer = StringIO()\n         # Only show version information if verbosity is high enough\n-        if self._verbosity > 0:\n+        if self.verbosity > 0:\n             text_buffer.write("==== sqlfluff ====\\n")\n             config_content = [\n                 ("sqlfluff", get_package_version()),\n                 ("python", get_python_version()),\n                 ("implementation", get_python_implementation()),\n-                ("verbosity", self._verbosity),\n+                ("verbosity", self.verbosity),\n             ]\n             if linter.dialect:\n                 config_content.append(("dialect", linter.dialect.name))\n@@ -138,7 +138,7 @@ def _format_config(self, linter: Linter) -> str:\n                         col_width=41,\n                     )\n                 )\n-            if self._verbosity > 1:\n+            if self.verbosity > 1:\n                 text_buffer.write("\\n== Raw Config:\\n")\n                 text_buffer.write(self.format_config_vals(linter.config.iter_vals()))\n         return text_buffer.getvalue()\n@@ -150,7 +150,7 @@ def dispatch_config(self, linter: Linter) -> None:\n     def dispatch_persist_filename(self, filename, result):\n         """Dispatch filenames during a persist operation."""\n         # Only show the skip records at higher levels of verbosity\n-        if self._verbosity >= 2 or result != "SKIP":\n+        if self.verbosity >= 2 or result != "SKIP":\n             self._dispatch(self.format_filename(filename=filename, success=result))\n \n     def _format_path(self, path: str) -> str:\n@@ -159,14 +159,14 @@ def _format_path(self, path: str) -> str:\n \n     def dispatch_path(self, path: str) -> None:\n         """Dispatch paths for display."""\n-        if self._verbosity > 0:\n+        if self.verbosity > 0:\n             self._dispatch(self._format_path(path))\n \n     def dispatch_template_header(\n         self, fname: str, linter_config: FluffConfig, file_config: FluffConfig\n     ) -> None:\n         """Dispatch the header displayed before templating."""\n-        if self._verbosity > 1:\n+        if self.verbosity > 1:\n             self._dispatch(self.format_filename(filename=fname, success="TEMPLATING"))\n             # This is where we output config diffs if they exist.\n             if file_config:\n@@ -182,12 +182,12 @@ def dispatch_template_header(\n \n     def dispatch_parse_header(self, fname: str) -> None:\n         """Dispatch the header displayed before parsing."""\n-        if self._verbosity > 1:\n+        if self.verbosity > 1:\n             self._dispatch(self.format_filename(filename=fname, success="PARSING"))\n \n     def dispatch_lint_header(self, fname: str, rules: List[str]) -> None:\n         """Dispatch the header displayed before linting."""\n-        if self._verbosity > 1:\n+        if self.verbosity > 1:\n             self._dispatch(\n                 self.format_filename(\n                     filename=fname, success=f"LINTING ({\', \'.join(rules)})"\n@@ -202,7 +202,7 @@ def dispatch_compilation_header(self, templater, message):\n \n     def dispatch_processing_header(self, processes: int) -> None:\n         """Dispatch the header displayed before linting."""\n-        if self._verbosity > 0:\n+        if self.verbosity > 0:\n             self._dispatch(  # pragma: no cover\n                 f"{self.colorize(\'effective configured processes: \', Color.lightgrey)} "\n                 f"{processes}"\n@@ -228,7 +228,7 @@ def _format_file_violations(\n         show = fails + warns > 0\n \n         # Only print the filename if it\'s either a failure or verbosity > 1\n-        if self._verbosity > 0 or show:\n+        if self.verbosity > 0 or show:\n             text_buffer.write(self.format_filename(fname, success=fails == 0))\n             text_buffer.write("\\n")\n \n@@ -253,6 +253,8 @@ def dispatch_file_violations(\n         self, fname: str, linted_file: LintedFile, only_fixable: bool\n     ) -> None:\n         """Dispatch any violations found in a file."""\n+        if self.verbosity < 0:\n+            return\n         s = self._format_file_violations(\n             fname,\n             linted_file.get_violations(\n@@ -392,10 +394,13 @@ def format_filename(\n         if isinstance(success, str):\n             status_string = success\n         else:\n-            status_string = self.colorize(\n-                success_text if success else "FAIL",\n-                Color.green if success else Color.red,\n-            )\n+            status_string = success_text if success else "FAIL"\n+\n+        if status_string in ("PASS", "FIXED", success_text):\n+            status_string = self.colorize(status_string, Color.green)\n+        elif status_string in ("FAIL", "ERROR"):\n+            status_string = self.colorize(status_string, Color.red)\n+\n         return f"== [{self.colorize(filename, Color.lightgrey)}] {status_string}"\n \n     def format_violation(\ndiff --git a/src/sqlfluff/core/linter/linted_dir.py b/src/sqlfluff/core/linter/linted_dir.py\n--- a/src/sqlfluff/core/linter/linted_dir.py\n+++ b/src/sqlfluff/core/linter/linted_dir.py\n@@ -117,7 +117,11 @@ def persist_changes(\n         for file in self.files:\n             if file.num_violations(fixable=True, **kwargs) > 0:\n                 buffer[file.path] = file.persist_tree(suffix=fixed_file_suffix)\n-                result = buffer[file.path]\n+                result: Union[bool, str]\n+                if buffer[file.path] is True:\n+                    result = "FIXED"\n+                else:  # pragma: no cover\n+                    result = buffer[file.path]\n             else:  # pragma: no cover TODO?\n                 buffer[file.path] = True\n                 result = "SKIP"\n',
 'test_patch': 'diff --git a/test/cli/commands_test.py b/test/cli/commands_test.py\n--- a/test/cli/commands_test.py\n+++ b/test/cli/commands_test.py\n@@ -557,6 +557,18 @@ def test__cli__command_lint_parse(command):\n             ),\n             1,\n         ),\n+        # Test that setting --quiet with --verbose raises an error.\n+        (\n+            (\n+                fix,\n+                [\n+                    "--quiet",\n+                    "--verbose",\n+                    "test/fixtures/cli/fail_many.sql",\n+                ],\n+            ),\n+            2,\n+        ),\n     ],\n )\n def test__cli__command_lint_parse_with_retcode(command, ret_code):\n@@ -1891,7 +1903,7 @@ def test_cli_fix_disabled_progress_bar_deprecated_option(\n \n \n def test__cli__fix_multiple_errors_no_show_errors():\n-    """Basic checking of lint functionality."""\n+    """Test the fix output."""\n     result = invoke_assert_code(\n         ret_code=1,\n         args=[\n@@ -1910,8 +1922,57 @@ def test__cli__fix_multiple_errors_no_show_errors():\n     assert result.output.replace("\\\\", "/").startswith(multiple_expected_output)\n \n \n+def test__cli__fix_multiple_errors_quiet_force():\n+    """Test the fix --quiet option with --force."""\n+    result = invoke_assert_code(\n+        ret_code=0,\n+        args=[\n+            fix,\n+            [\n+                "--disable-progress-bar",\n+                "test/fixtures/linter/multiple_sql_errors.sql",\n+                "--force",\n+                "--quiet",\n+                "-x",\n+                "_fix",\n+            ],\n+        ],\n+    )\n+    normalised_output = result.output.replace("\\\\", "/")\n+    assert normalised_output.startswith(\n+        """1 fixable linting violations found\n+== [test/fixtures/linter/multiple_sql_errors.sql] FIXED"""\n+    )\n+\n+\n+def test__cli__fix_multiple_errors_quiet_no_force():\n+    """Test the fix --quiet option without --force."""\n+    result = invoke_assert_code(\n+        ret_code=0,\n+        args=[\n+            fix,\n+            [\n+                "--disable-progress-bar",\n+                "test/fixtures/linter/multiple_sql_errors.sql",\n+                "--quiet",\n+                "-x",\n+                "_fix",\n+            ],\n+            # Test with the confirmation step.\n+            "y",\n+        ],\n+    )\n+    normalised_output = result.output.replace("\\\\", "/")\n+    assert normalised_output.startswith(\n+        """1 fixable linting violations found\n+Are you sure you wish to attempt to fix these? [Y/n] ...\n+== [test/fixtures/linter/multiple_sql_errors.sql] FIXED\n+All Finished"""\n+    )\n+\n+\n def test__cli__fix_multiple_errors_show_errors():\n-    """Basic checking of lint functionality."""\n+    """Test the fix --show-lint-violations option."""\n     result = invoke_assert_code(\n         ret_code=1,\n         args=[\n',
 'problem_statement': 'Enable quiet mode/no-verbose in CLI for use in pre-commit hook\nThere seems to be only an option to increase the level of verbosity when using SQLFluff [CLI](https://docs.sqlfluff.com/en/stable/cli.html), not to limit it further.\r\n\r\nIt would be great to have an option to further limit the amount of prints when running `sqlfluff fix`, especially in combination with deployment using a pre-commit hook. For example, only print the return status and the number of fixes applied, similar to how it is when using `black` in a pre-commit hook:\r\n![image](https://user-images.githubusercontent.com/10177212/140480676-dc98d00b-4383-44f2-bb90-3301a6eedec2.png)\r\n\r\nThis hides the potentially long list of fixes that are being applied to the SQL files, which can get quite verbose.\n',
 'hints_text': '',
 'created_at': '2023-04-16T14:24:42Z',
 'version': '1.4',
 'FAIL_TO_PASS': '["test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_force", "test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_no_force"]',
 'PASS_TO_PASS': '["test/cli/commands_test.py::test__cli__command_directed", "test/cli/commands_test.py::test__cli__command_dialect", "test/cli/commands_test.py::test__cli__command_no_dialect", "test/cli/commands_test.py::test__cli__command_parse_error_dialect_explicit_warning", "test/cli/commands_test.py::test__cli__command_parse_error_dialect_implicit_warning", "test/cli/commands_test.py::test__cli__command_dialect_legacy", "test/cli/commands_test.py::test__cli__command_extra_config_fail", "test/cli/commands_test.py::test__cli__command_lint_stdin[command0]", "test/cli/commands_test.py::test__cli__command_lint_stdin[command1]", "test/cli/commands_test.py::test__cli__command_lint_stdin[command2]", "test/cli/commands_test.py::test__cli__command_lint_stdin[command3]", "test/cli/commands_test.py::test__cli__command_render_stdin", "test/cli/commands_test.py::test__cli__command_lint_parse[command0]", "test/cli/commands_test.py::test__cli__command_lint_parse[command1]", "test/cli/commands_test.py::test__cli__command_lint_parse[command2]", "test/cli/commands_test.py::test__cli__command_lint_parse[command3]", "test/cli/commands_test.py::test__cli__command_lint_parse[command4]", "test/cli/commands_test.py::test__cli__command_lint_parse[command5]", "test/cli/commands_test.py::test__cli__command_lint_parse[command6]", "test/cli/commands_test.py::test__cli__command_lint_parse[command7]", "test/cli/commands_test.py::test__cli__command_lint_parse[command8]", "test/cli/commands_test.py::test__cli__command_lint_parse[command9]", "test/cli/commands_test.py::test__cli__command_lint_parse[command10]", "test/cli/commands_test.py::test__cli__command_lint_parse[command11]", "test/cli/commands_test.py::test__cli__command_lint_parse[command12]", "test/cli/commands_test.py::test__cli__command_lint_parse[command13]", "test/cli/commands_test.py::test__cli__command_lint_parse[command14]", "test/cli/commands_test.py::test__cli__command_lint_parse[command15]", "test/cli/commands_test.py::test__cli__command_lint_parse[command16]", "test/cli/commands_test.py::test__cli__command_lint_parse[command17]", "test/cli/commands_test.py::test__cli__command_lint_parse[command18]", "test/cli/commands_test.py::test__cli__command_lint_parse[command19]", "test/cli/commands_test.py::test__cli__command_lint_parse[command20]", "test/cli/commands_test.py::test__cli__command_lint_parse[command21]", "test/cli/commands_test.py::test__cli__command_lint_parse[command22]", "test/cli/commands_test.py::test__cli__command_lint_parse[command23]", "test/cli/commands_test.py::test__cli__command_lint_parse[command24]", "test/cli/commands_test.py::test__cli__command_lint_parse[command25]", "test/cli/commands_test.py::test__cli__command_lint_parse[command26]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command0-1]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command1-1]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command2-1]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command3-0]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command4-0]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command5-2]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command6-1]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command7-1]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command8-1]", "test/cli/commands_test.py::test__cli__command_lint_parse_with_retcode[command9-2]", "test/cli/commands_test.py::test__cli__command_lint_warning_explicit_file_ignored", "test/cli/commands_test.py::test__cli__command_lint_skip_ignore_files", "test/cli/commands_test.py::test__cli__command_lint_ignore_local_config", "test/cli/commands_test.py::test__cli__command_lint_warning", "test/cli/commands_test.py::test__cli__command_versioning", "test/cli/commands_test.py::test__cli__command_version", "test/cli/commands_test.py::test__cli__command_rules", "test/cli/commands_test.py::test__cli__command_dialects", "test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql0]", "test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/whitespace_errors.sql]", "test/cli/commands_test.py::test__cli__command__fix[LT01-test/fixtures/linter/indentation_errors.sql1]", "test/cli/commands_test.py::test__cli__command__fix[LT02-test/fixtures/linter/indentation_error_hard.sql]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[1_lint_error_1_unsuppressed_parse_error]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[1_lint_error_1_unsuppressed_templating_error]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[1_lint_error_1_suppressed_parse_error]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[0_lint_errors_1_unsuppressed_parse_error]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[0_lint_errors_1_suppressed_parse_error]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[1_lint_error_1_unsuppressed_parse_error_FIX_EVEN_UNPARSABLE]", "test/cli/commands_test.py::test__cli__fix_error_handling_behavior[2_files_with_lint_errors_1_unsuppressed_parse_error]", "test/cli/commands_test.py::test_cli_fix_even_unparsable[command-line-False]", "test/cli/commands_test.py::test_cli_fix_even_unparsable[command-line-True]", "test/cli/commands_test.py::test_cli_fix_even_unparsable[config-file-False]", "test/cli/commands_test.py::test_cli_fix_even_unparsable[config-file-True]", "test/cli/commands_test.py::test__cli__fix_loop_limit_behavior[--", "test/cli/commands_test.py::test__cli__command_fix_stdin[select", "test/cli/commands_test.py::test__cli__command_fix_stdin[", "test/cli/commands_test.py::test__cli__command_format_stdin[select", "test/cli/commands_test.py::test__cli__command_format_stdin[", "test/cli/commands_test.py::test__cli__command_fix_stdin_logging_to_stderr", "test/cli/commands_test.py::test__cli__command_fix_stdin_safety", "test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[create", "test/cli/commands_test.py::test__cli__command_fix_stdin_error_exit_code[select", "test/cli/commands_test.py::test__cli__command__fix_no_force[LT01-test/fixtures/linter/indentation_errors.sql-y-0-0]", "test/cli/commands_test.py::test__cli__command__fix_no_force[LT01-test/fixtures/linter/indentation_errors.sql-n-1-1]", "test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[None-yaml]", "test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[None-json]", "test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[outfile-yaml]", "test/cli/commands_test.py::test__cli__command_parse_serialize_from_stdin[outfile-json]", "test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[select", "test/cli/commands_test.py::test__cli__command_lint_serialize_from_stdin[SElect", "test/cli/commands_test.py::test__cli__command_fail_nice_not_found[command0]", "test/cli/commands_test.py::test__cli__command_fail_nice_not_found[command1]", "test/cli/commands_test.py::test__cli__command_lint_nocolor", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-human]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-yaml]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-json]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-github-annotation]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-github-annotation-native]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[None-none]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-human]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-yaml]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-json]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-github-annotation]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-github-annotation-native]", "test/cli/commands_test.py::test__cli__command_lint_serialize_multiple_files[outfile-none]", "test/cli/commands_test.py::test__cli__command_lint_serialize_github_annotation", "test/cli/commands_test.py::test__cli__command_lint_serialize_github_annotation_native", "test/cli/commands_test.py::test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation]", "test/cli/commands_test.py::test__cli__command_lint_serialize_annotation_level_error_failure_equivalent[github-annotation-native]", "test/cli/commands_test.py::test___main___help", "test/cli/commands_test.py::test_encoding[utf-8-ascii]", "test/cli/commands_test.py::test_encoding[utf-8-sig-UTF-8-SIG]", "test/cli/commands_test.py::test_encoding[utf-32-UTF-32]", "test/cli/commands_test.py::test_cli_encoding[utf-8-command-line-False]", "test/cli/commands_test.py::test_cli_encoding[utf-8-SIG-command-line-True]", "test/cli/commands_test.py::test_cli_encoding[utf-8-config-file-False]", "test/cli/commands_test.py::test_cli_encoding[utf-8-SIG-config-file-True]", "test/cli/commands_test.py::test_cli_no_disable_noqa_flag", "test/cli/commands_test.py::test_cli_disable_noqa_flag", "test/cli/commands_test.py::test_cli_get_default_config", "test/cli/commands_test.py::TestProgressBars::test_cli_lint_disabled_progress_bar", "test/cli/commands_test.py::TestProgressBars::test_cli_lint_disabled_progress_bar_deprecated_option", "test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar", "test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar_multiple_paths", "test/cli/commands_test.py::TestProgressBars::test_cli_lint_enabled_progress_bar_multiple_files", "test/cli/commands_test.py::TestProgressBars::test_cli_fix_disabled_progress_bar", "test/cli/commands_test.py::TestProgressBars::test_cli_fix_disabled_progress_bar_deprecated_option", "test/cli/commands_test.py::test__cli__fix_multiple_errors_no_show_errors", "test/cli/commands_test.py::test__cli__fix_multiple_errors_show_errors", "test/cli/commands_test.py::test__cli__multiple_files__fix_multiple_errors_show_errors", "test/cli/commands_test.py::test__cli__render_fail", "test/cli/commands_test.py::test__cli__render_pass"]',
 'environment_setup_commit': 'd19de0ecd16d298f9e3bfb91da122734c40c01e5'}

Suggest an improvement to documentation

No response

@xlisp xlisp added the documentation Improvements or additions to documentation label Aug 13, 2024
@xlisp
Copy link
Author

xlisp commented Aug 13, 2024

Then I checkout to this base_commit, run FAIL_TO_PASS, is not all fail, run PASS_TO_PASS is not all pass, why?

@klieret
Copy link
Member

klieret commented Aug 13, 2024

Regarding types-pkg-resources: See #199

@xlisp
Copy link
Author

xlisp commented Aug 13, 2024

This FAIL_TO_PASS ["test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_force", "test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_no_force"] in the git checkout to base_commit 'a820c139ccbe6d1865d73c4a459945cd69899f8f' will fail ? @klieret

Why i can not foud the test in base_commit 'a820c139ccbe6d1865d73c4a459945cd69899f8f' ? I don't understand the design of this data.

(sqlfluff) sqlfluff  a820c139c @ pytest test/cli/commands_test.py::test__cli__fix_multiple
========================================================== test session starts ==========================================================
platform darwin -- Python 3.11.9, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/emacspy/EmacsPyPro/sqlfluff
configfile: pytest.ini
plugins: cov-5.0.0, hypothesis-6.110.2, xdist-3.6.1
collected 0 items

========================================================= no tests ran in 0.06s =========================================================
ERROR: not found: /Users/emacspy/EmacsPyPro/sqlfluff/test/cli/commands_test.py::test__cli__fix_multiple
(no match in any of [<Module commands_test.py>])

(sqlfluff)  sqlfluff  a820c139c @ pytest test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_no_force
========================================================== test session starts ==========================================================
platform darwin -- Python 3.11.9, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/emacspy/EmacsPyPro/sqlfluff
configfile: pytest.ini
plugins: cov-5.0.0, hypothesis-6.110.2, xdist-3.6.1
collected 0 items

========================================================= no tests ran in 0.06s =========================================================
ERROR: not found: /Users/emacspy/EmacsPyPro/sqlfluff/test/cli/commands_test.py::test__cli__fix_multiple_errors_quiet_no_force
(no match in any of [<Module commands_test.py>])

(sqlfluff)  sqlfluff  a820c139c @ git branch
* (HEAD detached at a820c139c)
  main
  steve-first-swe
(sqlfluff)  sqlfluff  a820c139c @
  • I try some PASS_TO_PASS to test, it can pass:
(sqlfluff)  sqlfluff  a820c139c @ pytest test/cli/commands_test.py::test__cli__command_directed
========================================================== test session starts ==========================================================
platform darwin -- Python 3.11.9, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/emacspy/EmacsPyPro/sqlfluff
configfile: pytest.ini
plugins: cov-5.0.0, hypothesis-6.110.2, xdist-3.6.1
collected 1 item

test/cli/commands_test.py .                                                                                                       [100%]

=========================================================== 1 passed in 0.56s ===========================================================
(sqlfluff)  sqlfluff  a820c139c @ pytest test/cli/commands_test.py::test__cli__command_dialect
========================================================== test session starts ==========================================================
platform darwin -- Python 3.11.9, pytest-8.3.2, pluggy-1.5.0
rootdir: /Users/emacspy/EmacsPyPro/sqlfluff
configfile: pytest.ini
plugins: cov-5.0.0, hypothesis-6.110.2, xdist-3.6.1
collected 1 item

test/cli/commands_test.py .                                                                                                       [100%]

=========================================================== 1 passed in 0.06s ===========================================================
(sqlfluff)  sqlfluff  a820c139c @

@xlisp xlisp closed this as completed Aug 14, 2024
@klieret
Copy link
Member

klieret commented Aug 16, 2024

Hi. Not sure if you already answered the question yourself, because you closed it. But some of the tests are added by the gold patch and so are meant to fail before the gold patch is applied (i.e., on the base patch). This is explained in detail in the swe-B paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants