nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: harrisiirak/cron-parser
Pull request #366 (2025-02-19 13:27:55)

Parse field for day of week should allow 0 or SUN values
Hi,

Currently expressions like: `0 0 3 * * SUN` are crashing as SUN is parsed as 0 and when field parser checks for replacer existence, instead of checking explicitly for undefined values to throw an error it is checking for any no truthy expression. 0 is a valid value, but not a truthy. Just checking for explicit undefined values should solve the problem. 



ruizmarc: Done :) 

Patch:
diff --git a/src/CronExpressionParser.ts b/src/CronExpressionParser.ts
index 0e65d8d..c775ee6 100644
--- a/src/CronExpressionParser.ts
+++ b/src/CronExpressionParser.ts
@@ -181,7 +181,7 @@ export class CronExpressionParser {
       value = value.replace(/[a-z]{3}/gi, (match) => {
         match = match.toLowerCase();
         const replacer = Months[match as keyof typeof Months] || DayOfWeek[match as keyof typeof DayOfWeek];
-        if (!replacer) {
+        if (replacer === undefined) {
           throw new Error(`Validation error, cannot resolve alias "${match}"`);
         }
         return replacer.toString();


Test patch:
diff --git a/tests/CronExpressionParser.test.ts b/tests/CronExpressionParser.test.ts
index aea0375..1cb3848 100644
--- a/tests/CronExpressionParser.test.ts
+++ b/tests/CronExpressionParser.test.ts
@@ -489,6 +489,17 @@ describe('CronExpressionParser', () => {
     expect(next.getMinutes()).toEqual(40);
   });
 
+  test('using day of week string', () => {
+    const interval = CronExpressionParser.parse('15 10 * * SUN');
+    const intervals = interval.take(8);
+    for (const next of intervals) {
+      const day = next.getDay();
+      expect(day === 0).toBeTruthy();
+      expect(next.getHours()).toEqual(10);
+      expect(next.getMinutes()).toEqual(15);
+    }
+  });
+
   test('using days of week strings', () => {
     const interval = CronExpressionParser.parse('15 10 * * MON-TUE');
     const intervals = interval.take(8);
Repository: solid/community-server
Pull request #78 (2020-08-28 08:18:00)

Move base normalization to RuntimeConfig
Some small cleanup work to normalize `base` in `RuntimeConfig`, and allow variants to be retrieved.


Patch:
diff --git a/package.json b/package.json
index a03f235ae..afed488d0 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,5 @@
 {
   "name": "@solid/community-server",
-  "private": true,
   "version": "0.0.1",
   "main": "index.js",
   "license": "MIT",
diff --git a/src/init/RuntimeConfig.ts b/src/init/RuntimeConfig.ts
index d0d4d572c..517a0f36c 100644
--- a/src/init/RuntimeConfig.ts
+++ b/src/init/RuntimeConfig.ts
@@ -1,3 +1,5 @@
+import { ensureTrailingSlash } from '../util/Util';
+
 /**
  * This class holds all configuration options that can be defined by the user via the command line.
  *
@@ -14,10 +16,13 @@ export class RuntimeConfig implements RuntimeConfigData {
 
   public reset(data: RuntimeConfigData): void {
     this.pport = data.port ?? 3000;
-    this.pbase = data.base ?? `http://localhost:${this.port}/`;
+    this.pbase = ensureTrailingSlash(data.base ?? `http://localhost:${this.port}/`);
     this.prootFilepath = data.rootFilepath ?? process.cwd();
   }
 
+  /**
+   * The returned URL is ensured to have a trailing slash.
+   */
   public get base(): string {
     return this.pbase;
   }
diff --git a/src/storage/UrlContainerManager.ts b/src/storage/UrlContainerManager.ts
index c6e491c1c..a364b8004 100644
--- a/src/storage/UrlContainerManager.ts
+++ b/src/storage/UrlContainerManager.ts
@@ -15,7 +15,7 @@ export class UrlContainerManager implements ContainerManager {
 
   public async getContainer(id: ResourceIdentifier): Promise<ResourceIdentifier> {
     const path = this.canonicalUrl(id.path);
-    if (this.canonicalUrl(this.runtimeConfig.base) === path) {
+    if (this.runtimeConfig.base === path) {
       throw new Error('Root does not have a container.');
     }
 
@@ -30,6 +30,6 @@ export class UrlContainerManager implements ContainerManager {
   }
 
   private canonicalUrl(path: string): string {
-    return ensureTrailingSlash(new URL(path).toString());
+    return ensureTrailingSlash(path.toString());
   }
 }


Test patch:
diff --git a/test/unit/init/RuntimeConfig.test.ts b/test/unit/init/RuntimeConfig.test.ts
index 36a609674..23a65ab44 100644
--- a/test/unit/init/RuntimeConfig.test.ts
+++ b/test/unit/init/RuntimeConfig.test.ts
@@ -40,4 +40,9 @@ describe('RuntimeConfig', (): void => {
     expect(config.port).toEqual(1234);
     expect(config.base).toEqual('http://example.org/');
   });
+
+  it('ensures trailing slash in base.', async(): Promise<void> => {
+    const config = new RuntimeConfig({ base: 'http://example.org' });
+    expect(config.base).toEqual('http://example.org/');
+  });
 });
Repository: ember-intl/ember-intl
Pull request #731 (2018-12-18 15:25:39)

Don't report ICU linting errors if not needed
# Use case
Don't report ICU arguments lint errors if a translation is missing and is not obligatory.

It resolves the following issue: https://github.com/ember-intl/ember-intl/issues/730 

PoslinskiNet: @jasonmit any thoughts on this after feedback commit 😃?
jasonmit: @PoslinskiNet looks good, I'll version a patch release today :)

Patch:
diff --git a/lib/broccoli/translation-reducer/index.js b/lib/broccoli/translation-reducer/index.js
index 3d39f061..cd12ec92 100644
--- a/lib/broccoli/translation-reducer/index.js
+++ b/lib/broccoli/translation-reducer/index.js
@@ -129,14 +129,20 @@ class TranslationReducer extends CachingWriter {
     // create flattened list of all unique translation keys
     const allTranslationKeys = new Set(Array.prototype.concat(...localeKeys.map(([, keys]) => keys)));
 
+    const { requiresTranslation, fallbackLocale } = this.options;
+
     allTranslationKeys.forEach(key => {
-      const notInLocales = findMissingTranslations(key, localeKeys, this.options.requiresTranslation);
+      const notInLocales = findMissingTranslations(key, localeKeys, requiresTranslation);
 
       if (notInLocales.length) {
         result.missingTranslations.push([key, notInLocales]);
       }
 
-      const missingICUArgs = findMissingICUArguments(key, allIcuArguments, locales, icuArguments);
+      let missingICUArgs = findMissingICUArguments(key, allIcuArguments, locales, icuArguments);
+
+      if (fallbackLocale) {
+        missingICUArgs = missingICUArgs.filter(([locale]) => fallbackLocale === locale);
+      }
 
       if (missingICUArgs.length) {
         result.icuMismatch.push([key, missingICUArgs]);


Test patch:
diff --git a/tests-node/unit/broccoli/translation-reducer/index-test.js b/tests-node/unit/broccoli/translation-reducer/index-test.js
index ba0a04b8..00fa6e2e 100644
--- a/tests-node/unit/broccoli/translation-reducer/index-test.js
+++ b/tests-node/unit/broccoli/translation-reducer/index-test.js
@@ -203,6 +203,19 @@ describe('translation-reducer', function() {
       ]);
     });
 
+    it('lintTranslations returns list of icu argument mismatch without those that are required', function() {
+      let subject = new TranslationReducer(this.input.path(), { fallbackLocale: 'en' });
+
+      delete this.icuFixture['de'].foo;
+
+      let { icuMismatch } = subject.lintTranslations(this.icuFixture);
+
+      expect(icuMismatch).to.deep.equal([
+        ['missingArg', [['en', ['numPhotos']]]],
+        ['deep.nested.ok', [['en', ['reason']]]]
+      ]);
+    });
+
     it('_handleMissingTranslations logs translation if verbose', function() {
       let logs = [];
       let subject = new TranslationReducer(this.input.path());