PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: lucasbento/create-graphql (js)
Issue:  Cannot read property 'toString' of undefined on Loader
we should check if `id` is valid on Loader.load

```jsx
static async load(viewer, id) {
    if (!id) return null;

    const data = await User.UserLoader.load(id.toString());

    return User.viewerCanSee(viewer, data) ? new User(data) : null;
  }
```
Pull request description: Check if id is valid on Loader.load
Fixes #44.

Patch:
diff --git a/packages/generator/src/loader/templates/Loader.js.template b/packages/generator/src/loader/templates/Loader.js.template
index 3579f45..d5f2ba5 100644
--- a/packages/generator/src/loader/templates/Loader.js.template
+++ b/packages/generator/src/loader/templates/Loader.js.template
@@ -36,6 +36,10 @@ export default class <%= name %> {
   }
 
   static async load(viewer, id) {
+    if (!id) {
+      return null;
+    }
+
     const data = await <%= name %>.<%= rawName %>Loader.load(id.toString());
 
     return <%= name %>.viewerCanSee(viewer, data) ? new <%= name %>(data) : null;
diff --git a/packages/generator/src/loader/templates/LoaderWithSchema.js.template b/packages/generator/src/loader/templates/LoaderWithSchema.js.template
index 5620351..c0fc5b0 100644
--- a/packages/generator/src/loader/templates/LoaderWithSchema.js.template
+++ b/packages/generator/src/loader/templates/LoaderWithSchema.js.template
@@ -42,6 +42,10 @@ export default class <%= name %> {
   }
 
   static async load(viewer, id) {
+    if (!id) {
+      return null;
+    }
+
     const data = await <%= name %>.<%= rawName %>Loader.load(id.toString());
 
     return <%= name %>.viewerCanSee(viewer, data) ? new <%= name %>(data) : null;


Test patch:
diff --git a/packages/generator/src/loader/__tests__/__snapshots__/LoaderGenerator.spec.js.snap b/packages/generator/src/loader/__tests__/__snapshots__/LoaderGenerator.spec.js.snap
index 21bf128..0306ee0 100644
--- a/packages/generator/src/loader/__tests__/__snapshots__/LoaderGenerator.spec.js.snap
+++ b/packages/generator/src/loader/__tests__/__snapshots__/LoaderGenerator.spec.js.snap
@@ -38,6 +38,10 @@ export default class Example {
   }
 
   static async load(viewer, id) {
+    if (!id) {
+      return null;
+    }
+
     const data = await Example.ExampleLoader.load(id.toString());
 
     return Example.viewerCanSee(viewer, data) ? new Example(data) : null;
@@ -112,6 +116,10 @@ export default class Post {
   }
 
   static async load(viewer, id) {
+    if (!id) {
+      return null;
+    }
+
     const data = await Post.PostLoader.load(id.toString());
 
     return Post.viewerCanSee(viewer, data) ? new Post(data) : null;
@@ -183,6 +191,10 @@ export default class User {
   }
 
   static async load(viewer, id) {
+    if (!id) {
+      return null;
+    }
+
     const data = await User.UserLoader.load(id.toString());
 
     return User.viewerCanSee(viewer, data) ? new User(data) : null;
Repository: sql-formatter-org/sql-formatter (ts)
Issue: [FORMATTING] GBQ @@error.message not supported
```
BEGIN
select 1/0;
EXCEPTION WHEN ERROR THEN
SELECT @@error.message;
END;
```
Unable to format SQL: Error: Parse error: Unexpected "@@error.me" at line 4 column 8

This code is for BigQuery.
Pull request description: Support BigQuery system variables
Fixes #567

Patch:
diff --git a/src/languages/bigquery/bigquery.formatter.ts b/src/languages/bigquery/bigquery.formatter.ts
index bd69ae7f..aef53d84 100644
--- a/src/languages/bigquery/bigquery.formatter.ts
+++ b/src/languages/bigquery/bigquery.formatter.ts
@@ -178,6 +178,7 @@ export const bigquery: DialectOptions = {
     identTypes: ['``'],
     identChars: { dashes: true },
     paramTypes: { positional: true, named: ['@'], quoted: ['@'] },
+    variableTypes: [{ regex: String.raw`@@\w+` }],
     lineCommentTypes: ['--', '#'],
     operators: ['&', '|', '^', '~', '>>', '<<', '||'],
     postProcess,


Test patch:
diff --git a/test/bigquery.test.ts b/test/bigquery.test.ts
index 857181df..461a69b7 100644
--- a/test/bigquery.test.ts
+++ b/test/bigquery.test.ts
@@ -76,6 +76,14 @@ describe('BigQueryFormatter', () => {
     `);
   });
 
+  it('supports @@variables', () => {
+    expect(format('SELECT @@error.message, @@time_zone')).toBe(dedent`
+      SELECT
+        @@error.message,
+        @@time_zone
+    `);
+  });
+
   // BigQuery-specific string types
   it('supports strings with rb prefixes', () => {
     expect(format(`SELECT rb"huh", br'bulu bulu', BR'la la' FROM foo`)).toBe(dedent`
Repository: raphlinus/pulldown-cmark (rust)
Issue: [fuzz test] link labels should be trimmed
```markdown
[
a]: https://example.com

[a]
```

The link label should match the link, but doesn't in pulldown-cmark.
Pull request description: Trim spaces off start and end of link reference
Fixes #793

This is specifically called out by [the spec]:

> One label matches another just in case their normalized forms are equal. To normalize a label, strip off the opening and closing brackets, perform the Unicode case fold, **strip leading and trailing spaces, tabs, and line endings**, and collapse consecutive internal spaces, tabs, and line endings to a single space. If there are multiple matching reference link definitions, the one that comes first in the document is used. (It is desirable in such cases to emit a warning.)

[the spec]: https://spec.commonmark.org/0.30/#matches

Patch:
diff --git a/specs/regression.txt b/specs/regression.txt
index 81664e6..9b67e58 100644
--- a/specs/regression.txt
+++ b/specs/regression.txt
@@ -2006,4 +2006,19 @@ ISSUE 791
 <a href="https://example.com" title="[foo]">foo</a>
 </li>
 </ul>
-````````````````````````````````
\ No newline at end of file
+````````````````````````````````
+
+
+ISSUE 793
+
+```````````````````````````````` example
+[
+a]: https://example.com
+
+[b
+]: https://example.com
+
+[a] [b]
+.
+<p><a href="https://example.com">a</a> <a href="https://example.com">b</a></p>
+````````````````````````````````
diff --git a/src/linklabel.rs b/src/linklabel.rs
index 83f0ecc..655bdc7 100644
--- a/src/linklabel.rs
+++ b/src/linklabel.rs
@@ -108,9 +108,16 @@ pub(crate) fn scan_link_label_rest<'t>(
         None
     } else {
         let cow = if mark == 0 {
-            text[..ix].into()
+            let asciiws = &[' ', '\r', '\n', '\t'][..];
+            text[..ix].trim_matches(asciiws).into()
         } else {
             label.push_str(&text[mark..ix]);
+            while matches!(label.as_bytes().last(), Some(&b' ' | &b'\r' | &b'\n' | &b'\t')) {
+                label.pop();
+            }
+            while matches!(label.as_bytes().first(), Some(&b' ' | &b'\r' | &b'\n' | &b'\t')) {
+                label.remove(0);
+            }
             label.into()
         };
         Some((ix + 1, cow))


Test patch:
diff --git a/tests/suite/regression.rs b/tests/suite/regression.rs
index 6db31bb..66fb308 100644
--- a/tests/suite/regression.rs
+++ b/tests/suite/regression.rs
@@ -2369,5 +2369,21 @@ fn regression_test_147() {
 </li>
 </ul>
 "##;
+    test_markdown_html(original, expected, false, false, false);
+}
+
+#[test]
+fn regression_test_148() {
+      let original = r##"[
+a]: https://example.com
+
+[b
+]: https://example.com
+
+[a] [b]
+"##;
+    let expected = r##"<p><a href="https://example.com">a</a> <a href="https://example.com">b</a></p>
+"##;
+
     test_markdown_html(original, expected, false, false, false);
 }
\ No newline at end of file
Repository: platers/obsidian-linter (ts)
Issue: Incorrect `file-name-heading` behaviour
Problem: linting inserts a file title incorrectly.

Steps to reproduce:

1. Create a note with the following content

    ```
    Text 1
    
    ---
    
    Text 2
    
    ```

2. Apply `file-name-heading`  linting rule
3. Expected result

    ```
    # Title
    
    Text 1
    
    ---
    
    Text 2
    
    ```

4. Actual (incorrect) result

    ```
    
    Text 1
    
    ---
    # Title
    
    Text 2
    
    ```

I believe this case should be added as an exception for documents with no YAML variables.
Pull request description: fix yaml detection in file name heading
Fixes #47 

Patch:
diff --git a/src/rules.ts b/src/rules.ts
index 4d5a521..27fb900 100644
--- a/src/rules.ts
+++ b/src/rules.ts
@@ -474,7 +474,7 @@ export const rules: Rule[] = [
         const fileName = options['metadata: file name'];
         // insert H1 heading after front matter
         let yaml_end = text.indexOf('\n---');
-        yaml_end = yaml_end == -1 ? 0 : yaml_end + 5;
+        yaml_end = yaml_end == -1 || !text.startsWith('---\n') ? 0 : yaml_end + 5;
         return insert(text, yaml_end, `# ${fileName}\n`);
       },
       [


Test patch:
diff --git a/src/test.ts b/src/test.ts
index c3b0051..573f02a 100644
--- a/src/test.ts
+++ b/src/test.ts
@@ -131,6 +131,26 @@ describe('Rules tests', () => {
       expect(rulesDict['capitalize-headings'].apply(before, {titleCase: 'true'})).toBe(after);
     });
   });
+  describe('File Name Heading', () => {
+    it('Handles stray dashes', () => {
+      const before = dedent`
+      Text 1
+
+      ---
+      
+      Text 2
+        `;
+      const after = dedent`
+      # File Name
+      Text 1
+      
+      ---
+      
+      Text 2
+        `;
+      expect(rulesDict['file-name-heading'].apply(before, {'metadata: file name': 'File Name'})).toBe(after);
+    });
+  });
 });
 
 describe('Option parsing', () => {