Dataset Viewer
Auto-converted to Parquet Duplicate
before_code
stringlengths
83
9.98k
reviewer_comment
stringlengths
50
25.5k
language
stringclasses
37 values
diff_context
stringlengths
21
28.7k
after_code
stringlengths
102
9.96k
repo_name
stringclasses
406 values
file_path
stringlengths
6
186
comment_type
stringclasses
5 values
quality_score
float32
0.5
1
} setCustomCenter(customCenterX, customCenterY) { this._customCenterX = customCenterX; this._customCenterY = customCenterY; this.invalidateHitboxes(); } getRendererObject() { return null; } getWidth() { return this._customWidth; } getHeight() { return this._customHeight; } ...
```suggestion this._customHeight = height; ```
JavaScript
@@ -62,6 +62,14 @@ return this._customHeight; } + setWidth(width) { + this._customWidth = width; + } + + setHeight(height) { + return this._customHeight = height;
} setCustomCenter(customCenterX, customCenterY) { this._customCenterX = customCenterX; this._customCenterY = customCenterY; this.invalidateHitboxes(); } getRendererObject() { return null; } getWidth() { return this._customWidth; } getHeight() { return this._customHeight; } ...
4ian/GDevelop
GDJS/tests/tests/Extensions/testspriteruntimeobject.js
suggestion
0.571
case 'RotateCamera': case 'ZoomCamera': case 'FixCamera': case 'CentreCamera': return ['smooth-camera-movement']; case 'ChangeTimeScale': return ['pause-menu']; case 'EcrireFichierExp': case 'EcrireFichierTxt': case 'LireFichierExp': case 'LireFichierTxt': case 'ReadN...
```suggestion return ['intermediate-toggle-states-with-variable']; ```
JavaScript
@@ -124,6 +126,8 @@ export const getInstructionTutorialIds = (type: string): Array<string> => { case 'ToggleObjectVariableAsBoolean': case 'ToggleGlobalVariableAsBoolean': case 'ToggleSceneVariableAsBoolean': + case 'SetBooleanObjectVariable': + case 'SetBooleanVariable': return ['iIntermedi...
case 'RotateCamera': case 'ZoomCamera': case 'FixCamera': case 'CentreCamera': return ['smooth-camera-movement']; case 'ChangeTimeScale': return ['pause-menu']; case 'EcrireFichierExp': case 'EcrireFichierTxt': case 'LireFichierExp': case 'LireFichierTxt': case 'ReadN...
4ian/GDevelop
newIDE/app/src/Utils/GDevelopServices/Tutorial.js
suggestion
0.571
// @flow export default function getObjectByName( globalObjectsContainer: gdObjectsContainer | null, objectsContainer?: ?gdObjectsContainer, objectName: string ): ?gdObject { if (objectsContainer && objectsContainer.hasObjectNamed(objectName)) return objectsContainer.getObject(objectName); else if ( ...
`ObjectsContainersList` should be used instead. You can pass a `ProjectScopedContainersAccessor` to your component.
JavaScript
@@ -15,3 +15,18 @@ export default function getObjectByName( return null; } + +export const hasObjectWithName = ( + globalObjectsContainer: gdObjectsContainer | null, + objectsContainer?: ?gdObjectsContainer, + objectName: string +): boolean => {
// @flow export default function getObjectByName( globalObjectsContainer: gdObjectsContainer | null, objectsContainer?: ?gdObjectsContainer, objectName: string ): ?gdObject { if (objectsContainer && objectsContainer.hasObjectNamed(objectName)) return objectsContainer.getObject(objectName); else if ( ...
4ian/GDevelop
newIDE/app/src/Utils/GetObjectByName.js
suggestion
0.571
> <QuickPublish project={testProject.project} gameAndBuildsManager={fakeEmptyGameAndBuildsManager} isSavingProject={false} isRequiredToSaveAsNewCloudProject={() => // Indicates that the project is already saved, there will be // no need to sa...
I feel like this comment should be next to the props type in QuickPublish. I was not sure what it meant before reading this comment
JavaScript
@@ -119,6 +124,39 @@ export const AuthenticatedWithTooManyCloudProjects = () => { </Template> ); }; + +export const AuthenticatedWithCloudProjectsMaximumReachedButSavedAlready = () => { + return ( + <Template> + <AuthenticatedUserContext.Provider + value={{ + ...fakeAuthenticatedUserWi...
onClose={action('onClose')} onContinueQuickCustomization={action('onContinueQuickCustomization')} onTryAnotherGame={action('onTryAnotherGame')} /> </AuthenticatedUserContext.Provider> </Template> ); }; export const AuthenticatedWithCloudProjectsMaximumReachedButSavedAl...
4ian/GDevelop
newIDE/app/src/stories/componentStories/QuickCustomization/QuickPublish.stories.js
suggestion
0.571
if (!selectedItem) return; if (selectedItem.content.isDescendantOf(item.content)) { selectObjectFolderOrObjectWithContext(null); } }, [selectObjectFolderOrObjectWithContext, selectedItems] ); // Force List component to be mounted again if project or objectsContaine...
Removing the column, you removed the margin, you should maybe remove the `noMargin` in the child Column
JavaScript
@@ -1363,28 +1393,16 @@ const ObjectsList = React.forwardRef<Props, ObjectsListInterface>( return ( <Background maxWidth> - <Column>
* does not stay selected and not visible to the user. */ const onCollapseItem = React.useCallback( (item: TreeViewItem) => { if (!selectedItems || selectedItems.length !== 1) return; const selectedItem = selectedItems[0]; if (!selectedItem) return; if (selectedItem.co...
4ian/GDevelop
newIDE/app/src/ObjectsList/index.js
suggestion
0.571
this._loadedTextures.clear(); const threeTextures: THREE.Texture[] = []; this._loadedThreeTextures.values(threeTextures); this._loadedThreeTextures.clear(); for (const threeTexture of threeTextures) { threeTexture.dispose(); } const threeMaterials: THREE.Material[] = ...
Will this work? ``` for (const pixiTexture of this._diskTextures.values()) { if (pixiTexture.destroyed) { continue; } pixiTexture.destroy(); } this._diskTextures.clear(); ``` Minus new array creation.
TypeScript
@@ -463,6 +463,54 @@ namespace gdjs { } return particleTexture; } + + dispose(): void { + this._loadedTextures.clear(); + + const threeTextures: THREE.Texture[] = []; + this._loadedThreeTextures.values(threeTextures); + this._loadedThreeTextures.clear(); + for (const three...
* To be called when the game is disposed. * Clear caches of loaded textures and materials. */ dispose(): void { this._loadedTextures.clear(); const threeTextures: THREE.Texture[] = []; this._loadedThreeTextures.values(threeTextures); this._loadedThreeTextures.clear(); f...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/pixi-image-manager.ts
suggestion
0.786
/** * @brief Return the scene variables of the current scene or the current * extension. It allows legacy "scenevar" parameters to accept extension * variables. */ const gd::VariablesContainer &GetLegacySceneVariables() const { return legacySceneVariables; }; const gd::PropertiesContainersList ...
These are not references/pointers but values, meaning that ProjectScopedContainers moved from "I'm just a set of lists pointing to things in your project" to "I actually hold stuff, and you will have a bad time if you destroyed me and kept references to things".
C/C++
@@ -236,6 +230,8 @@ class ProjectScopedContainers { private: gd::ObjectsContainersList objectsContainersList; gd::VariablesContainersList variablesContainersList; + gd::VariablesContainer legacyGlobalVariables; + gd::VariablesContainer legacySceneVariables;
/** * @brief Return the scene variables of the current scene or the current * extension. It allows legacy "scenevar" parameters to accept extension * variables. */ const gd::VariablesContainer *GetLegacySceneVariables() const { return legacySceneVariables; }; const gd::PropertiesContainersList ...
4ian/GDevelop
Core/GDCore/Project/ProjectScopedContainers.h
suggestion
0.5
// We could pass it a string, but lets do it right this.removeJoint(parseInt(jId, 10)); } } } } // Remove the joint this.world.DestroyJoint(joint); delete this.joints[jointId]; } } } gdjs.registerRuntimeSc...
In the future, a `destroy()` method on the shared data would be I think safer (in the sense: it's part of the class, so there is less chance you forget to update it when needed) and we we should probably made the "shared data" something first class that is handled by the runtime scene (rather than something that is man...
TypeScript
@@ -300,14 +309,11 @@ namespace gdjs { } } gdjs.registerRuntimeSceneUnloadedCallback(function (runtimeScene) { - if ( - // @ts-ignore - runtimeScene.physics2SharedData && - // @ts-ignore - runtimeScene.physics2SharedData.world - ) { - // @ts-ignore - Box2D.destroy(runtimeS...
if ( this.joints[jId].GetType() === Box2D.e_gearJoint && (Box2D.getPointer( (this.joints[jId] as Box2D.b2GearJoint).GetJoint1() ) === Box2D.getPointer(joint) || Box2D.getPointer( (this.joints[jId] as Bo...
4ian/GDevelop
Extensions/Physics2Behavior/physics2runtimebehavior.ts
suggestion
0.786
} catch (error) { console.error('Error while login:', error); throw error; } } async loginOrSignupWithProvider({ provider, signal, }: {| provider: IdentityProvider, signal?: AbortSignal, |}) { if (signal && signal.aborted) { return Promise.reject( new UserC...
this seemed duplicated in this file and the browser one. This was always causing an error in the console because the signal always aborts (we trigger it when we close the dialog) I don't think this deserves to raise an error as it's the expected path?
JavaScript
@@ -61,11 +61,6 @@ class LocalLoginProvider implements LoginProvider, FirebaseBasedLoginProvider { if (signal) { signal.addEventListener('abort', () => { terminateWebSocket(); - reject(
} catch (error) { console.error('Error while login:', error); throw error; } } async loginOrSignupWithProvider({ provider, signal, }: {| provider: IdentityProvider, signal?: AbortSignal, |}) { if (signal && signal.aborted) { return Promise.reject( new UserC...
4ian/GDevelop
newIDE/app/src/LoginProvider/LocalLoginProvider.js
refactor
0.643
}, }); } } this.setState({ createAccountInProgress: false, loginInProgress: false, authenticatedUser: { ...this.state.authenticatedUser, creatingOrLoggingInAccount: false, }, }); this._automaticallyUpdateUserProfile = true; }; _cancelL...
I don't like doing this here. It looks like we're trying to "finish a process". But the process is already there: <img width="776" alt="image" src="https://github.com/user-attachments/assets/6fe5b8b4-8d4c-4124-b83a-34f6d90bbd83"> There is already a catch (ensuring that an exception will never stop the end to run)...
JavaScript
@@ -996,11 +996,19 @@ export default class AuthenticatedUserProvider extends React.Component< this._automaticallyUpdateUserProfile = true; }; - _cancelLogin = () => { + _cancelLoginOrSignUp = () => { if (this._abortController) { this._abortController.abort(); this._abortController = null;...
}, }); } } this.setState({ createAccountInProgress: false, loginInProgress: false, authenticatedUser: { ...this.state.authenticatedUser, creatingOrLoggingInAccount: false, }, }); this._automaticallyUpdateUserProfile = true; }; _cancelL...
4ian/GDevelop
newIDE/app/src/Profile/AuthenticatedUserProvider.js
suggestion
0.643
preferences.getIsMenuBarHiddenInPreview, preferences.getIsAlwaysOnTopInPreview, preferences.values.openDiagnosticReportAutomatically, currentlyRunningInAppTutorial, getAuthenticatedPlayerForPreview, quickCustomizationDialogOpenedFromGameId, onCaptureFinished, createCaptur...
Consider not adding yet-another-way-to-launch-preview and instead: - Make the logic related to the timing inside the existing function. - delayTimeInSeconds can also be in the function - forcing a screenshot, bypassing the check for timing, is "just" a "forceScreenshot: true". But this is only used for quick customi...
JavaScript
@@ -1723,13 +1724,31 @@ const MainFrame = (props: Props) => { const launchNewPreview = React.useCallback( async options => { const numberOfWindows = options ? options.numberOfWindows : 1; - launchPreview({ networkPreview: false, numberOfWindows }); + await launchPreview({ networkPreview: false,...
preferences.getIsMenuBarHiddenInPreview, preferences.getIsAlwaysOnTopInPreview, preferences.values.openDiagnosticReportAutomatically, currentlyRunningInAppTutorial, getAuthenticatedPlayerForPreview, quickCustomizationDialogOpenedFromGameId, onCaptureFinished, createCaptur...
4ian/GDevelop
newIDE/app/src/MainFrame/index.js
suggestion
0.5
for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", Ge...
to make it a bit shorter ```suggestion SetDefaultCameraBehavior(element.GetStringAttribute("defaultCameraBehavior", "top-left-anchored-if-never-moved")); ```
C++
@@ -80,6 +84,7 @@ void Layer::UnserializeFrom(const SerializerElement& element) { SetName(element.GetStringAttribute("name", "", "Name")); SetRenderingType(element.GetStringAttribute("renderingType", "")); SetCameraType(element.GetStringAttribute("cameraType", "perspective")); + SetDefaultCameraBehavior(el...
for (std::size_t c = 0; c < GetCameraCount(); ++c) { SerializerElement& cameraElement = camerasElement.AddChild("camera"); cameraElement.SetAttribute("defaultSize", GetCamera(c).UseDefaultSize()); cameraElement.SetAttribute("width", GetCamera(c).GetWidth()); cameraElement.SetAttribute("height", Ge...
4ian/GDevelop
Core/GDCore/Project/Layer.cpp
suggestion
0.786
// Handle scale mode. if (this._game.getScaleMode() === 'nearest') { gameCanvas.style['image-rendering'] = '-moz-crisp-edges'; gameCanvas.style['image-rendering'] = '-webkit-optimize-contrast'; gameCanvas.style['image-rendering'] = '-webkit-crisp-edges'; gameCanvas.style['im...
There is a lot of copy from the `createStandardCanvas` function. Could you rework `createStandardCanvas` so that it's using `useCanvas` under the hood? Also, the name is probably not showing this is an important operation enough, that just can't be redone a second time. So I think it should be called `initializeForC...
TypeScript
@@ -189,6 +189,120 @@ namespace gdjs { gameCanvas.focus(); } + useCanvas(gameCanvas: HTMLCanvasElement): void {
// Prevent magnifying glass on iOS with a long press. // Note that there are related bugs on iOS 15 (see https://bugs.webkit.org/show_bug.cgi?id=231161) // but it seems not to affect us as the `domElementsContainer` has `pointerEvents` set to `none`. domElementsContainer.style['-webkit-user-sel...
4ian/GDevelop
GDJS/Runtime/pixi-renderers/runtimegame-pixi-renderer.ts
suggestion
0.643
} else { outputObjectsContainer.InsertNewObject( project, parameter.GetExtraInfo(), objectName, outputObjectsContainer.GetObjectsCount()); } // Memorize the last object name. By convention, parameters that require // an object (mainly, "ob...
I wonder if the name can be confusing because a free function could have an object parameter without object type and the following behavior parameters be some capabilities (default behavior). It also won't be "all" the behaviors of the actual objects. I guess it's kind of the required behavior for objects passed in pa...
C++
@@ -71,7 +75,7 @@ void ParameterMetadataTools::ParametersToObjectsContainer( const gd::String& behaviorType = parameter.GetExtraInfo(); gd::Object& object = outputObjectsContainer.GetObject(lastObjectName); - allObjectBehaviorNames[lastObjectName].insert(behaviorName); + allObj...
// are all present (and no more than required by the object type). // Non default behaviors coming from parameters will be added or removed later. project.EnsureObjectDefaultBehaviors(outputObjectsContainer.GetObject(objectName)); } else { // Create a new object (and its default be...
4ian/GDevelop
Core/GDCore/Extensions/Metadata/ParameterMetadataTools.cpp
suggestion
1
parameters.removeParameter('MySpriteObject2'); expect(parameters.getParametersCount()).toBe(7); objectsContainer = new gd.ObjectsContainer(gd.ObjectsContainer.Function); gd.ParameterMetadataTools.parametersToObjectsContainer( project, parameters, objectsContainer ...
Maybe `ObjectMetadata::AddDefaultBehavior` can be used to simulate a change of capability in a custom object.
JavaScript
@@ -4295,19 +4295,37 @@ describe('libGD.js', function () { expect(objectsContainer.hasObjectNamed('MyObjectWithoutType')).toBe(true); expect(objectsContainer.hasObjectNamed('MySpriteObject')).toBe(true); - const objectWithoutType = objectsContainer.getObject('MyObjectWithoutType'); - expect(ob...
parameters.removeParameter('MySpriteObject2'); expect(parameters.getParametersCount()).toBe(7); objectsContainer = new gd.ObjectsContainer(); gd.ParameterMetadataTools.parametersToObjectsContainer( project, parameters, objectsContainer ); // Check that obje...
4ian/GDevelop
GDevelop.js/__tests__/Core.js
suggestion
0.571
std::set<gd::String> objectNamesInContainer = outputObjectsContainer.GetAllObjectNames(); for (const auto& objectName : objectNamesInContainer) { if (allObjectNames.find(objectName) == allObjectNames.end()) { outputObjectsContainer.RemoveObject(objectName); } } // Remove behaviors of object...
Actually, I think it's legit to add behavior parameters to require capabilities on an object without any specified type.
C++
@@ -108,8 +112,14 @@ void ParameterMetadataTools::ParametersToObjectsContainer( } auto& object = outputObjectsContainer.GetObject(objectName); + const auto& allBehaviorNames = allObjectNonDefaultBehaviorNames[objectName]; for (const auto& behaviorName : object.GetAllBehaviorNames()) { - const a...
} } // Remove objects that are not in the parameters anymore. std::set<gd::String> objectNamesInContainer = outputObjectsContainer.GetAllObjectNames(); for (const auto& objectName : objectNamesInContainer) { if (allObjectNames.find(objectName) == allObjectNames.end()) { outputObjectsContain...
4ian/GDevelop
Core/GDCore/Extensions/Metadata/ParameterMetadataTools.cpp
suggestion
0.5
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay'; const electron = optionalRequire('electron'); const path = optionalRequire('path'); export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) => isMobile ? undefined : Math.min(245, Math.max(130, window.innerWidth / 4)); export ...
I'd rather say `Your project must be stored on your computer` rather than surely, it feels more english
JavaScript
@@ -50,13 +51,37 @@ import PreferencesContext from '../MainFrame/Preferences/PreferencesContext'; import { textEllipsisStyle } from '../UI/TextEllipsis'; import FileWithLines from '../UI/CustomSvgIcons/FileWithLines'; import TextButton from '../UI/TextButton'; -import { Tooltip } from '@material-ui/core'; +import { ...
import { getRelativeOrAbsoluteDisplayDate } from '../Utils/DateDisplay'; const electron = optionalRequire('electron'); const path = optionalRequire('path'); export const getThumbnailWidth = ({ isMobile }: {| isMobile: boolean |}) => isMobile ? undefined : Math.min(245, Math.max(130, window.innerWidth / 4)); export ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameDashboardCard.js
suggestion
0.5
onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInnerAreaFollowingParentSize(checked); onChange(); ...
```suggestion label={<Trans>Private (can only be used inside the extension)</Trans>} ```
JavaScript
@@ -141,6 +141,15 @@ export default function EventsBasedObjectEditor({ }} /> )} + <Checkbox + label={<Trans>Private</Trans>}
eventsBasedObject.markAsTextContainer(checked); onChange(); }} /> <Checkbox label={<Trans>Expand inner area with parent</Trans>} checked={eventsBasedObject.isInnerAreaFollowingParentSize()} onCheck={(e, checked) => { eventsBasedObject.markAsInner...
4ian/GDevelop
newIDE/app/src/EventsBasedObjectEditor/index.js
suggestion
0.643
type: 'separator', }, { label: i18n._(t`Copy`), click: () => this.copy(), accelerator: 'CmdOrCtrl+C', }, { label: i18n._(t`Cut`), click: () => this.cut(), accelerator: 'CmdOrCtrl+X', }, { label: i18n._(t`Paste`), ...
```suggestion <Trans>This object won't be visible in the scene editor.</Trans> ```
JavaScript
@@ -193,7 +206,21 @@ export class EventsBasedObjectTreeViewItemContent } renderRightComponent(i18n: I18nType): ?React.Node { - return null; + return this.eventsBasedObject.isPrivate() ? ( + <Tooltip + title={ + <Trans>This object won't be visible in the events editor.</Trans>
type: 'separator', }, { label: i18n._(t`Copy`), click: () => this.copy(), accelerator: 'CmdOrCtrl+C', }, { label: i18n._(t`Cut`), click: () => this.cut(), accelerator: 'CmdOrCtrl+X', }, { label: i18n._(t`Paste`), ...
4ian/GDevelop
newIDE/app/src/EventsFunctionsList/EventsBasedObjectTreeViewItemContent.js
suggestion
0.571
onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) ...
The editor should ensure it never happens. If we only allow to define "AnimationName" properties in the "Behavior properties" tab here (and not in "Scene properties"): ![image](https://github.com/user-attachments/assets/099c544f-9d8d-4b86-b78e-0494f1d43319) There should always be an object when a behavior propeti...
JavaScript
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] }
onUpdateProperty(instance, name, newValue); }, getLabel, getDescription, }; } else if (valueType === 'textarea') { return { name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) ...
4ian/GDevelop
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
suggestion
0.5
name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, ...
You can use the `mapFor` fonction to shorten the code a bit. The empty string should be added to the list.
JavaScript
@@ -220,7 +220,40 @@ const createField = ( getLabel, getDescription, }; - } else { + } else if(valueType ==='animationname') + { + function getChoices() + { + if(!object) + { return [{value:"Object is not valid !", label:"Object is not valid !"}] } + + let animationArray =...
name, valueType: 'textarea', getValue: (instance: Instance): string => { return getProperties(instance) .get(name) .getValue(); }, setValue: (instance: Instance, newValue: string) => { onUpdateProperty(instance, name, newValue); }, getLabel, ...
4ian/GDevelop
newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js
suggestion
0.571
forceUpdate(); onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth ...
I wonder if it should be below the "Choice" type as it's a bit more specific. ```suggestion <SelectOption key="property-type-animationname" value="AnimationName" ...
JavaScript
@@ -729,6 +729,11 @@ export default function EventsBasedBehaviorPropertiesEditor({ value="Boolean" label={t`Boolean (checkbox)`} /> + <SelectOption + ...
forceUpdate(); onPropertiesUpdated && onPropertiesUpdated(); }} fullWidth ...
4ian/GDevelop
newIDE/app/src/EventsBasedBehaviorEditor/EventsBasedBehaviorPropertiesEditor.js
suggestion
1
.setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('maxLength') ...
I think that the order is important here. I see that the text uses the order `left, center right`, so we might as well use the same here
JavaScript
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Bor...
.setGroup(_('Border appearance')); objectProperties .getOrCreate('padding') .setValue((objectContent.padding || 0).toString()) .setType('number') .setLabel(_('Padding')) .setGroup(_('Font')); objectProperties .getOrCreate('maxLength') .setValu...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.571
) ) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), ...
```suggestion _('Input is submitted'), ``` I think it's better not mentioning any platform specific detail in the name
JavaScript
@@ -572,6 +609,22 @@ module.exports = { .getCodeExtraInformation() .setFunctionName('isFocused'); + object + .addScopedCondition( + 'IsInputSubmitted', + _('Input is Submitted (Enter pressed'),
'number', gd.ParameterOptions.makeNewOptions().setDescription( _('Opacity (0-255)') ) ) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Ch...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.786
.setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), _('_PARAM0_ is focused'), '', 'res/conditions/surObjet24.png', ...
```suggestion _('_PARAM0_ value was submitted'), ```
JavaScript
@@ -572,6 +609,22 @@ module.exports = { .getCodeExtraInformation() .setFunctionName('isFocused'); + object + .addScopedCondition( + 'IsInputSubmitted', + _('Input is Submitted (Enter pressed'), + _( + 'Check if the input is submitted, which usually happens when the ...
) .setFunctionName('setOpacity') .setGetter('getOpacity') .setHidden(); object .addScopedCondition( 'Focused', _('Focused'), _( 'Check if the text input is focused (the cursor is in the field and player can type text in).' ), _('_PARAM...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.571
}; const formatRgbAndOpacityToCssRgba = ( rgbColor: [float, float, float], opacity: float ) => { return ( 'rgba(' + rgbColor[0] + ',' + rgbColor[1] + ',' + rgbColor[2] + ',' + opacity / 255 + ')' ); }; class TextInputRuntimeObjectPixiRend...
```suggestion private _isSubmitted: boolean; ```
TypeScript
@@ -31,6 +37,8 @@ namespace gdjs { private _input: HTMLInputElement | HTMLTextAreaElement | null = null; private _instanceContainer: gdjs.RuntimeInstanceContainer; private _runtimeGame: gdjs.RuntimeGame; + private _form: HTMLFormElement | null = null; + private _isSubmited: boolean;
return ( 'rgba(' + rgbColor[0] + ',' + rgbColor[1] + ',' + rgbColor[2] + ',' + opacity / 255 + ')' ); }; class TextInputRuntimeObjectPixiRenderer { private _object: gdjs.TextInputRuntimeObject; private _input: HTMLInputElement | HTMLTextAreaElem...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.571
} getText() { return this._string; } setText(newString: string) { if (newString === this._string) return; this._string = newString; this._renderer.updateString(); } /** * Called by the renderer when the value of the input shown on the screen * was changed (b...
```suggestion onRendererFormSubmitted() { ```
TypeScript
@@ -348,6 +379,10 @@ namespace gdjs { onRendererInputValueChanged(inputValue: string) { this._string = inputValue; } + + onRendererFormSubmitted(inputValue: boolean) {
* @deprecated use `getText` instead */ getString() { return this.getText(); } /** * Replace the text inside the text input. * @deprecated use `setText` instead */ setString(text: string) { this.setText(text); } getText() { return this._string; } ...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject.ts
suggestion
0.571
this._input.style.borderColor = formatRgbAndOpacityToCssRgba( this._object._getRawBorderColor(), this._object.getBorderOpacity() ); } updateBorderWidth() { if (!this._input) return; this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDi...
to avoid having the `?`, you could do this: ```js const input = this._input; if (!input) return; // From then on, you can use `input` without TS complaining ```
TypeScript
@@ -297,14 +317,36 @@ namespace gdjs { this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDisabled() { - if (!this._input) return; + if (!this._form) return; - this._input.disabled = this._object.isDisabled(); + this._form.disabled = this._object.isDisab...
); } updateBorderColorAndOpacity() { if (!this._input) return; this._input.style.borderColor = formatRgbAndOpacityToCssRgba( this._object._getRawBorderColor(), this._object.getBorderOpacity() ); } updateBorderWidth() { if (!this._input) return; this...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.786
: 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel...
I added a comment on the PR, I think you should add in the description that this property will not be used if the input type is a number.
JavaScript
@@ -200,6 +209,30 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Fon...
: 255 ).toString() ) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.571
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getP...
I think you could use `(this._object.getOpacity() / 255).toFixed(3)` instead. The result of the division could be `0.59200000000005`, and I'm not sure if CSS has some limitations about that.
TypeScript
@@ -246,8 +271,8 @@ namespace gdjs { } updateOpacity() { - if (!this._input) return; - this._input.style.opacity = '' + this._object.getOpacity() / 255; + if (!this._form) return; + this._form.style.opacity = '' + this._object.getOpacity() / 255;
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getP...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.571
updateReadOnly() { if (!this._form) return; this._form.readOnly = this._object.isReadOnly(); } updateMaxLength() { const input = this._input; if (!input) return; if (this._object.getMaxLength() <= 0) { input.removeAttribute('maxLength'); return; } ...
Is the `|| 'left'` necessary? I think we can be confident that the object only stores correct values
TypeScript
@@ -297,14 +322,37 @@ namespace gdjs { this._input.style.borderWidth = this._object.getBorderWidth() + 'px'; } updateDisabled() { - if (!this._input) return; + if (!this._form) return; - this._input.disabled = this._object.isDisabled(); + this._form.disabled = this._object.isDisab...
updateReadOnly() { if (!this._form) return; this._form.readOnly = this._object.isReadOnly(); } updateMaxLength() { const input = this._input; if (!input) return; if (this._object.getMaxLength() <= 0) { input.removeAttribute('maxLength'); return; } ...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.5
) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) .setGroup(_('Border ...
```suggestion 'The maximum length of the input value (this property will be ignored if the input type is a number).' ```
JavaScript
@@ -200,6 +209,34 @@ module.exports = { .setLabel(_('Width')) .setGroup(_('Border appearance')); + objectProperties + .getOrCreate('padding') + .setValue((objectContent.padding || 0).toString()) + .setType('number') + .setLabel(_('Padding')) + .setGroup(_('Fon...
) .setType('number') .setLabel(_('Opacity')) .setGroup(_('Border appearance')); objectProperties .getOrCreate('borderWidth') .setValue((objectContent.borderWidth || 0).toString()) .setType('number') .setLabel(_('Width')) .setGroup(_('Border ...
4ian/GDevelop
Extensions/TextInput/JsExtension.js
suggestion
0.857
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getPl...
```suggestion (this._object.getOpacity() / 255).toFixed(3); ``` toFixed returns as string already
TypeScript
@@ -246,8 +271,9 @@ namespace gdjs { } updateOpacity() { - if (!this._input) return; - this._input.style.opacity = '' + this._object.getOpacity() / 255; + if (!this._form) return; + this._form.style.opacity = + '' + (this._object.getOpacity() / 255).toFixed(3);
// Display after the object is positioned. this._form.style.display = 'initial'; } updateString() { if (!this._input) return; this._input.value = this._object.getString(); } updatePlaceholder() { if (!this._input) return; this._input.placeholder = this._object.getPl...
4ian/GDevelop
Extensions/TextInput/textinputruntimeobject-pixi-renderer.ts
suggestion
0.714
import { LineStackLayout } from '../../UI/Layout'; import GlobalVariableIcon from '../../UI/CustomSvgIcons/GlobalVariable'; import SceneVariableIcon from '../../UI/CustomSvgIcons/SceneVariable'; import ObjectVariableIcon from '../../UI/CustomSvgIcons/ObjectVariable'; import LocalVariableIcon from '../../UI/CustomSvgIco...
Let's call this: ```suggestion getVariableSourceFromIdentifierName: ( identifierName: string, projectScopedContainers: gdProjectScopedContainers ) => VariablesContainer_SourceType, ``` to emphasis that we don't know if it's a variable name, a property name or a parameter name, and it could be a m...
JavaScript
@@ -55,6 +54,10 @@ type Props = { ...ParameterFieldProps, isObjectVariable: boolean, variablesContainers: Array<gdVariablesContainer>, + getVariableSourceFromVariableName: ( + variableRootName: string, + projectScopedContainers: gdProjectScopedContainers + ) => VariablesContainer_SourceType,
import { LineStackLayout } from '../../UI/Layout'; import GlobalVariableIcon from '../../UI/CustomSvgIcons/GlobalVariable'; import SceneVariableIcon from '../../UI/CustomSvgIcons/SceneVariable'; import ObjectVariableIcon from '../../UI/CustomSvgIcons/ObjectVariable'; import LocalVariableIcon from '../../UI/CustomSvgIco...
4ian/GDevelop
newIDE/app/src/EventsSheet/ParameterFields/VariableField.js
suggestion
1
otherProjectFile.fileMetadata.fileIdentifier ); }); } return false; }; const getDashboardItemsToDisplay = ({ project, currentFileMetadata, allDashboardItems, searchText, searchClient, currentPage, orderBy, }: {| project: ?gdProject, currentFileMetadata: ?FileMetadata, allDas...
I don't know if this array should be copied with a destructuring operation because it can be sorted below, affecting both `itemsToDisplay` and `allDashboardItems` I think
JavaScript
@@ -146,13 +146,7 @@ const getDashboardItemsToDisplay = ({ orderBy: GamesDashboardOrderBy, |}): ?Array<DashboardItem> => { if (!allDashboardItems) return null; - let itemsToDisplay: DashboardItem[] = allDashboardItems.filter( - item => - // First, filter out unsaved games, unless they are the opened pro...
otherProjectFile.fileMetadata.fileIdentifier ); }); } return false; }; const getDashboardItemsToDisplay = ({ project, currentFileMetadata, allDashboardItems, searchText, searchClient, currentPage, orderBy, }: {| project: ?gdProject, currentFileMetadata: ?FileMetadata, allDas...
4ian/GDevelop
newIDE/app/src/GameDashboard/GamesList.js
suggestion
0.571
/** Base parameters for {@link gdjs.Cube3DRuntimeObject} */ export interface Cube3DObjectData extends Object3DData { /** The base parameters of the Cube3D object */ content: Object3DDataContent & { enableTextureTransparency: boolean; facesOrientation: 'Y' | 'Z'; frontFaceResourceName: stri...
You should be able to go back to where content comes from. Long story short, it comes from the project serialized in JSON, meaning that the possible types of this object can only be `null`, `string` or `number`, or an array of those, or a child JSON. So it cannot be a `THREE.Color`. You can find examples in the textIn...
TypeScript
@@ -24,10 +24,10 @@ namespace gdjs { rightFaceVisible: boolean; topFaceVisible: boolean; bottomFaceVisible: boolean; + color: THREE.Color;
/** Base parameters for {@link gdjs.Cube3DRuntimeObject} */ export interface Cube3DObjectData extends Object3DData { /** The base parameters of the Cube3D object */ content: Object3DDataContent & { enableTextureTransparency: boolean; facesOrientation: 'Y' | 'Z'; frontFaceResourceName: stri...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObject.ts
suggestion
0.786
return this.isFaceAtIndexVisible(faceIndex); } /** @internal */ isFaceAtIndexVisible(faceIndex): boolean { return (this._visibleFacesBitmask & (1 << faceIndex)) !== 0; } /** @internal */ shouldRepeatTextureOnFaceAtIndex(faceIndex): boolean { return (this._textureRepeatFacesB...
This method is part of a public interface. We don't want to rely THREE objects for inputs. You can check `setFillColor` int he codebase to see how it's done in other objects.
TypeScript
@@ -203,10 +206,13 @@ namespace gdjs { if (this._faceResourceNames[faceIndex] === resourceName) { return; } - this._faceResourceNames[faceIndex] = resourceName; this._renderer.updateFace(faceIndex); } + setCubeColor(color: THREE.Color): void {
if (faceIndex === undefined) { return false; } return this.isFaceAtIndexVisible(faceIndex); } /** @internal */ isFaceAtIndexVisible(faceIndex): boolean { return (this._visibleFacesBitmask & (1 << faceIndex)) !== 0; } /** @internal */ shouldRepeatTextureOnFaceAt...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObject.ts
suggestion
0.5
} return runtimeObject .getInstanceContainer() .getGame() .getImageManager() .getThreeMaterial(runtimeObject.getFaceAtIndexResourceName(faceIndex), { useTransparentTexture: runtimeObject.shouldUseTransparentTexture(), forceBasicMaterial: runtimeObject._materialT...
Good idea to use a loop! In JS, there's a more elegant way to do this, with a `map`. So you could write: ```js const materials = new Array(6).fill(0).map((_, index) => { return material; }) ```
TypeScript
@@ -75,14 +80,37 @@ namespace gdjs { ) { const geometry = new THREE.BoxGeometry(1, 1, 1); // TODO (3D) - feature: support color instead of texture? - const materials = [ - getFaceMaterial(runtimeObject, materialIndexToFaceIndex[0]), - getFaceMaterial(runtimeObject, materialIndexToF...
.getThreeMaterial(runtimeObject.getFaceAtIndexResourceName(faceIndex), { useTransparentTexture: runtimeObject.shouldUseTransparentTexture(), forceBasicMaterial: runtimeObject._materialType === gdjs.Cube3DRuntimeObject.MaterialType.Basic, }); }; class Cube3DRuntimeObj...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObjectPixiRenderer.ts
suggestion
0.857
}; class Cube3DRuntimeObjectPixiRenderer extends gdjs.RuntimeObject3DRenderer { private _cube3DRuntimeObject: gdjs.Cube3DRuntimeObject; private _boxMesh: THREE.Mesh; constructor( runtimeObject: gdjs.Cube3DRuntimeObject, instanceContainer: gdjs.RuntimeInstanceContainer ) { const g...
This seems unnecessary to me. I feel like you could just do: ```js const material = ... materials.push(material) ``` since `getFaceMaterial` already returns a `MeshBasicMaterial` if no resource
TypeScript
@@ -75,14 +80,36 @@ namespace gdjs { ) { const geometry = new THREE.BoxGeometry(1, 1, 1); // TODO (3D) - feature: support color instead of texture? - const materials = [ - getFaceMaterial(runtimeObject, materialIndexToFaceIndex[0]), - getFaceMaterial(runtimeObject, materialIndexToF...
constructor( runtimeObject: gdjs.Cube3DRuntimeObject, instanceContainer: gdjs.RuntimeInstanceContainer ) { const geometry = new THREE.BoxGeometry(1, 1, 1); const materials: THREE.Material[] = new Array(6) .fill(0) .map((_, index) => getFaceMaterial(runtimeObje...
4ian/GDevelop
Extensions/3D/Cube3DRuntimeObjectPixiRenderer.ts
suggestion
0.857
// Delete actions. // Don't allow removing project if opened, as it would not result in any change in the list. // (because an opened project is always displayed) if (isCurrentProjectOpened || projectsList.length > 1) { // No delete action possible. } else {...
I would change the text because here you can have a case: `You're deleting a game that has: ... - is published` I would suggest: `You're deleting a game which: - has x views... - is published...`
JavaScript
@@ -513,9 +518,34 @@ const GameDashboardCard = ({ // Extract word translation to ensure it is not wrongly translated in the sentence. const translatedConfirmText = i18n._(t`delete`); + const hasPlayerMessage = countOfSessionsLastWeek + ? t`${countOfSes...
// (because an opened project is always displayed) if (isCurrentProjectOpened || projectsList.length > 1) { // No delete action possible. } else { if (actions.length > 0) { actions.push({ type: 'separator', }); ...
4ian/GDevelop
newIDE/app/src/GameDashboard/GameDashboardCard.js
suggestion
0.643
.setFunctionName('isAnimationPaused'); // Deprecated object .addCondition( 'HasAnimationEnded', _('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ i...
I think in english it's a single word usually: ```suggestion _('Set crossfade duration'), _('Set the crossfade duration when switching to a new animation.'), 'Set crossfade duration of _PARAM0_ to _PARAM1_', ```
JavaScript
@@ -800,6 +800,20 @@ module.exports = { .markAsSimple() .setHidden() .setFunctionName('hasAnimationEnded'); + + object + .addScopedAction( + 'SetCrossfadeDuration', + _('Set cross fade duration'), + _('Set the duration of the cross fading between two ani...
.setFunctionName('isAnimationPaused'); // Deprecated object .addCondition( 'HasAnimationEnded', _('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ i...
4ian/GDevelop
Extensions/3D/JsExtension.js
suggestion
0.786
_('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ is finished'), _('Animations and images'), 'res/conditions/animation24.png', 'res/conditions/animation.png...
```suggestion .addParameter('number', _('Crossfade duration'), '', false) ```
JavaScript
@@ -800,6 +800,20 @@ module.exports = { .markAsSimple() .setHidden() .setFunctionName('hasAnimationEnded'); + + object + .addScopedAction( + 'SetCrossfadeDuration', + _('Set cross fade duration'), + _('Set the duration of the cross fading between two ani...
_('Animation finished'), _( 'Check if the animation being played by the Sprite object is finished.' ), _('The animation of _PARAM0_ is finished'), _('Animations and images'), 'res/conditions/animation24.png', 'res/conditions/animation.png...
4ian/GDevelop
Extensions/3D/JsExtension.js
suggestion
0.571
/** GDevelop - Particle System Extension Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com) This project is released under the MIT License. */ #include "Model3DObjectConfiguration.h" #include "GDCore/CommonTools.h" #include "GDCore/IDE/Project/ArbitraryResourceWorker.h" #include "GDCore/Project/InitialI...
Nitpicking, here and everywhere: `crossfadeDuration` (your PR contains a mix of crossFade and crossfade). Let's use crossfade everywhere it's possible.
C++
@@ -23,7 +23,7 @@ Model3DObjectConfiguration::Model3DObjectConfiguration() : width(100), height(100), depth(100), rotationX(0), rotationY(0), rotationZ(0), modelResourceName(""), materialType("StandardWithoutMetalness"), originLocation("ModelOrigin"), centerLocation("ModelOrigin"), - keepAspectR...
/** GDevelop - Particle System Extension Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com) This project is released under the MIT License. */ #include "Model3DObjectConfiguration.h" #include "GDCore/CommonTools.h" #include "GDCore/IDE/Project/ArbitraryResourceWorker.h" #include "GDCore/Project/InitialI...
4ian/GDevelop
Extensions/3D/Model3DObjectConfiguration.cpp
suggestion
0.571
let rewardedVideoLoading = false; // Becomes true when the video is loading. let rewardedVideoReady = false; // Becomes true when the video is loaded and ready to be shown. let rewardedVideoShowing = false; // Becomes true when the video is showing. let rewardedVideoRewardReceived = false; // Becomes tr...
I wonder if it's a good idea to delay this by 2 seconds, and offer: - an action to cancel automatic consent dialog/tracking authorization display. - an action to do it manually. So that if I want to postpone this (because it's better if my player plays a bit or click a button in the menu, so I have the opportunity...
TypeScript
@@ -108,22 +109,53 @@ namespace gdjs { let rewardedVideoRewardReceived = false; // Becomes true when the video is closed and the reward is received. let rewardedVideoErrored = false; // Becomes true when the video fails to load. - let npaValue = '0'; // TODO: expose an API to change this and also an auto...
let rewardedVideoLoading = false; // Becomes true when the video is loading. let rewardedVideoReady = false; // Becomes true when the video is loaded and ready to be shown. let rewardedVideoShowing = false; // Becomes true when the video is showing. let rewardedVideoRewardReceived = false; // Becomes tr...
4ian/GDevelop
Extensions/AdMob/admobtools.ts
security
0.5
'SetTestMode', _('Enable test mode'), _( 'Activate or deactivate the test mode ("development" mode).\n' + 'When activated, tests ads will be served instead of real ones.\n' + '\n' + 'It is important to enable test ads during development so that you c...
```suggestion 'Prevent AdMob from initializing automatically. You will need to call the "Initialize AdMob" action instead.\n' + ```
JavaScript
@@ -93,6 +93,41 @@ module.exports = { .setIncludeFile('Extensions/AdMob/admobtools.js') .setFunctionName('gdjs.adMob.setTestMode'); + extension + .addAction( + 'PreventAdmobAutoInitialization', + _('Prevent Admob auto initialization'), + _( + 'Prevent Admob from ini...
'SetTestMode', _('Enable test mode'), _( 'Activate or deactivate the test mode ("development" mode).\n' + 'When activated, tests ads will be served instead of real ones.\n' + '\n' + 'It is important to enable test ads during development so that you c...
4ian/GDevelop
Extensions/AdMob/JsExtension.js
suggestion
0.786
End of preview. Expand in Data Studio

CodeReview-Bench

A benchmark for evaluating models on two code review tasks, curated from ronantakizawa/github-codereview.

Tasks

1. Code Editing

Given code and a reviewer comment, apply the requested change.

  • Input: before_code, reviewer_comment, language, diff_context
  • Target: after_code
from datasets import load_dataset

ds = load_dataset("ronantakizawa/codereview-bench", "code-editing")
example = ds["test"][0]

prompt = f"""Apply the following review comment to the code.

Review: {example['reviewer_comment']}

Code:
{example['before_code']}

Updated code:"""

2. Comment Generation

Given a code diff, generate the review comment a human reviewer would write.

  • Input: before_code, after_code, diff_context, language
  • Target: reviewer_comment
ds = load_dataset("ronantakizawa/codereview-bench", "comment-generation")
example = ds["test"][0]

prompt = f"""Review the following code change and provide feedback.

Before:
{example['before_code']}

After:
{example['after_code']}

Review comment:"""

Filtering Criteria

This benchmark is a quality-filtered subset of the full dataset:

Filter Threshold
Positive examples only is_negative = False
Quality score >= 0.5
Comment length >= 50 characters
Code context >= 10 lines (before and after)
Comment types bug, security, performance, refactor, suggestion

Excluded: nitpick, style, question, and negative examples.

Schema

Code Editing

Column Type Role
before_code string Input
reviewer_comment string Input
language string Input
diff_context string Input
after_code string Target
repo_name string Metadata
file_path string Metadata
comment_type string Metadata
quality_score float Metadata

Comment Generation

Column Type Role
before_code string Input
after_code string Input
diff_context string Input
language string Input
reviewer_comment string Target
repo_name string Metadata
file_path string Metadata
comment_type string Metadata
quality_score float Metadata

Evaluation

Code Editing

  • CodeBLEU: Measures structural and syntactic similarity of generated code
  • Exact match: Percentage of outputs matching the target exactly
  • Edit similarity: Normalized edit distance between generated and target code

Comment Generation

  • BERTScore: Semantic similarity between generated and reference comments
  • ROUGE-L: Longest common subsequence overlap
  • Human evaluation: Recommended for final assessment — automated metrics correlate poorly with review quality

Splits

Split Description
train Training data (90%)
test Held-out evaluation (5%)
validation Development/tuning (5%)

Splits are repo-deterministic — no repo appears in multiple splits.

Citation

@dataset{takizawa2026codereviewbench,
  title={CodeReview-Bench: A Benchmark for Review-Driven Code Changes},
  author={Takizawa, Ronan},
  year={2026},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/ronantakizawa/codereview-bench}
}
Downloads last month
67