nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: 100phlecs/tailwind_formatter
Pull request #34 (2023-10-12 00:20:31)

Sort all strings

100phlecs: LGTM, thanks for the PR 👍 

Patch:
diff --git a/lib/tailwind_formatter.ex b/lib/tailwind_formatter.ex
index 914a1ea..0c4bb52 100644
--- a/lib/tailwind_formatter.ex
+++ b/lib/tailwind_formatter.ex
@@ -46,16 +46,13 @@ defmodule TailwindFormatter do
     String.replace(contents, expr_class, sorted_classes)
   end
 
-  defp sort_expr({:<>, meta, children}), do: {:<>, meta, handle_concatenation(children)}
   defp sort_expr({:<<>>, meta, children}), do: {:<<>>, meta, handle_interpolation(children)}
-  defp sort_expr({:__block__, meta, [children]}), do: {:__block__, meta, [sort_expr(children)]}
+  defp sort_expr({a, b, c}), do: {sort_expr(a), sort_expr(b), sort_expr(c)}
+  defp sort_expr({a, b}), do: {sort_expr(a), sort_expr(b)}
+  defp sort_expr(list) when is_list(list), do: Enum.map(list, &sort_expr/1)
   defp sort_expr(text) when is_binary(text), do: sort(text)
   defp sort_expr(node), do: node
 
-  defp handle_concatenation(children) do
-    Enum.map(children, &sort_expr/1)
-  end
-
   defp handle_interpolation(children) do
     {classes_with_placeholders, {placeholder_map, _index}} =
       Enum.map_reduce(children, {%{}, 0}, fn


Test patch:
diff --git a/test/tailwind_formatter_test.exs b/test/tailwind_formatter_test.exs
index 76b3ab0..94bb6e1 100644
--- a/test/tailwind_formatter_test.exs
+++ b/test/tailwind_formatter_test.exs
@@ -456,13 +456,33 @@ defmodule TailwindFormatterTest do
     assert_formatter_output(input, expected)
   end
 
-  test "issue#32" do
+  test "handles class lists" do
     input = """
     <div class={["text-sm potato sm:lowercase uppercase"]}></div>
     """
 
     expected = """
-    <div class={["text-sm potato sm:lowercase uppercase"]}></div>
+    <div class={["potato text-sm uppercase sm:lowercase"]}></div>
+    """
+
+    assert_formatter_output(input, expected)
+
+    input = """
+    <div class={["text-sm potato sm:lowercase uppercase", "text-red-500 tomato rounded-lg"]}></div>
+    """
+
+    expected = """
+    <div class={["potato text-sm uppercase sm:lowercase", "tomato rounded-lg text-red-500"]}></div>
+    """
+
+    assert_formatter_output(input, expected)
+
+    input = """
+    <div class={["text-sm potato sm:lowercase uppercase", if(false, do: "text-red-500 tomato rounded-lg")]}></div>
+    """
+
+    expected = """
+    <div class={["potato text-sm uppercase sm:lowercase", if(false, do: "tomato rounded-lg text-red-500")]}></div>
     """
 
     assert_formatter_output(input, expected)
Repository: platers/obsidian-linter
Pull request #832 (2023-08-01 00:27:01)

Ignored Inline Code for `Remove Space Around Characters`
Relates to #826 

Changes Made:
- Added a test for ignoring inline code for removing space around characters
- Added the inline code type to the ignore logic for `Remove Space Around Characters`


Patch:
diff --git a/src/rules/remove-space-around-characters.ts b/src/rules/remove-space-around-characters.ts
index d37331e..4e3ce3b 100644
--- a/src/rules/remove-space-around-characters.ts
+++ b/src/rules/remove-space-around-characters.ts
@@ -19,7 +19,7 @@ export default class RemoveSpaceAroundCharacters extends RuleBuilder<RemoveSpace
       nameKey: 'rules.remove-space-around-characters.name',
       descriptionKey: 'rules.remove-space-around-characters.description',
       type: RuleType.SPACING,
-      ruleIgnoreTypes: [IgnoreTypes.code, IgnoreTypes.math, IgnoreTypes.yaml, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.tag],
+      ruleIgnoreTypes: [IgnoreTypes.code, IgnoreTypes.inlineCode, IgnoreTypes.math, IgnoreTypes.yaml, IgnoreTypes.link, IgnoreTypes.wikiLink, IgnoreTypes.tag],
     });
   }
   get OptionsClass(): new () => RemoveSpaceAroundCharactersOptions {


Test patch:
diff --git a/__tests__/remove-space-around-characters.test.ts b/__tests__/remove-space-around-characters.test.ts
index 0b9f721..fc85621 100644
--- a/__tests__/remove-space-around-characters.test.ts
+++ b/__tests__/remove-space-around-characters.test.ts
@@ -5,8 +5,7 @@ import {ruleTest} from './common';
 ruleTest({
   RuleBuilderClass: RemoveSpaceAroundCharacters,
   testCases: [
-    {
-      // accounts for https://github.com/platers/obsidian-linter/issues/344
+    { // accounts for https://github.com/platers/obsidian-linter/issues/344
       testName: 'Make sure that lists with a dollar sign in them actually get escaped correctly',
       before: dedent`
         # Title
@@ -69,5 +68,17 @@ ruleTest({
         otherSymbols: ':;',
       },
     },
+    { // relates to https://github.com/platers/obsidian-linter/issues/826
+      testName: 'Make sure that inline code is left alone',
+      before: dedent`
+        \`Spaces around custom symbols : are ; left alone\`
+      `,
+      after: dedent`
+        \`Spaces around custom symbols : are ; left alone\`
+      `,
+      options: {
+        otherSymbols: ':;',
+      },
+    },
   ],
 });
Repository: platers/obsidian-linter
Pull request #1306 (2025-05-03 11:53:39)

fix: correct regex pattern for title matching in yaml-title rule
The yaml-title rule adds a title key to the frontmatter or replaces it if it already exists.
I noticed that if other keys start with the title key (e.g., titleTemplate, one of the VitePress's frontmatter config), they might be incorrectly replaced — especially if they appear before title.
So I updated the regex to match the exact title key and avoid this issue.
Thanks for reviewing.


Patch:
diff --git a/src/rules/yaml-title.ts b/src/rules/yaml-title.ts
index a4884f4..f8fd9e4 100644
--- a/src/rules/yaml-title.ts
+++ b/src/rules/yaml-title.ts
@@ -51,7 +51,7 @@ export default class YamlTitle extends RuleBuilder<YamlTitleOptions> {
     title = escapeStringIfNecessaryAndPossible(title, options.defaultEscapeCharacter);
 
     return formatYAML(text, (text) => {
-      const title_match_str = `\n${options.titleKey}.*\n`;
+      const title_match_str = `\n${options.titleKey}:.*\n`;
       const title_match = new RegExp(title_match_str);
       if (title_match.test(text)) {
         text = text.replace(


Test patch:
diff --git a/__tests__/yaml-title.test.ts b/__tests__/yaml-title.test.ts
index beac16e..473e476 100644
--- a/__tests__/yaml-title.test.ts
+++ b/__tests__/yaml-title.test.ts
@@ -357,5 +357,22 @@ ruleTest({
         # [test \#4](github.com/platers/obsidian-linter)
       `,
     },
+    {
+      testName: 'Only matches and replaces the correct title key, not similar keys',
+      before: dedent`
+        ---
+        title2: ShouldNotChange
+        title: ShouldChange
+        ---
+        # Hello world
+      `,
+      after: dedent`
+        ---
+        title2: ShouldNotChange
+        title: Hello world
+        ---
+        # Hello world
+      `,
+    },
   ],
 });