repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -37,22 +37,13 @@ import { setupMainCanvas, setupUserCanvas, } from './canvas'; - +import { P5, Circle } from '../types'; +import { getCoordinateValues } from './utils/getCoordinateValues.ts'; app.setUpTimeLine = () => { - app.auction.auctions = []; - app.joinInterestGroup.joinings = []; - app.timeline.cir...
Curious to know the purpose of using `?.` when `auctions` object has `setupAuctions` defined.
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -102,40 +93,47 @@ app.play = (resumed = false, doNotPlay = false) => { app.pause = () => { // eslint-disable-next-line no-undef if (process.env.IS_RUNNING_STANDALONE) { - app.pauseButton.classList.add('hidden'); - app.playButton.classList.remove('hidden'); + app.pauseButton?.classList.add('hidden'); ...
What's the use of passing the optional `false` here ?
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -102,40 +93,47 @@ app.play = (resumed = false, doNotPlay = false) => { app.pause = () => { // eslint-disable-next-line no-undef if (process.env.IS_RUNNING_STANDALONE) { - app.pauseButton.classList.add('hidden'); - app.playButton.classList.remove('hidden'); + app.pauseButton?.classList.add('hidden'); ...
`expandOverride` is optional?
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -169,32 +167,37 @@ app.minifiedBubbleClickListener = (event, expandOverride) => { } }; -app.addToPromiseQueue = (indexToStartFrom) => { +app.addToPromiseQueue = (indexToStartFrom: number) => { let currentIndex = indexToStartFrom; + if (!app.promiseQueue) { + return; + } + while (currentIndex < con...
I am thinking when would be the case when these would not be defined.
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -515,54 +522,54 @@ app.handleControls = () => { app.minifiedBubbleContainer = document.getElementById( 'minified-bubble-container' ); - app.canvasParentElement = document.querySelector('#ps-canvas').parentElement; + app.canvasParentElement = document.querySelector('#ps-canvas')?.parentElement; // e...
`getElementById` may not be defined in `document` ? 🤔
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -37,22 +37,13 @@ import { setupMainCanvas, setupUserCanvas, } from './canvas'; - +import { P5, Circle } from '../types';
```suggestion import type { P5, Circle } from '../types'; ```
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,286 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion type import { AuctionStep, Coordinates, P5, Bubble, SketchProps } from '../types'; ```
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -16,19 +16,19 @@ /** * Internal Dependencies */ -import config from '../config.js'; -import app from '../app.js'; +import config from '../config'; +import app from '../app'; import { calculateCanvasDimensions } from '../utils'; +import { P5 } from '../../types';
```suggestion type import { P5 } from '../../types'; ```
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -14,25 +14,26 @@ * limitations under the License. */ /** - * Internal Dependencies + * External dependencies. */ -import config from '../config.js'; -import app from '../app.js'; -import { calculateCanvasDimensions } from '../utils'; +import throttle from 'just-throttle'; /** - * External dependencies. + *...
```suggestion type import { P5 } from '../../types'; ```
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -13,20 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * Internal Dependencies */ -import config from '../config.js'; -import app from '../app.js'; +import config from '../config'; +import app from '../app'; import { calculateCanva...
```suggestion type import { P5 } from '../../types'; ```
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -26,19 +26,37 @@ import { wipeAndRecreateInterestCanvas, } from '../utils'; import FlowExpander from './flowExpander'; - +import { Coordinates, CoordinateValue } from '../../types'; +import { getCoordinateValues } from '../utils/getCoordinateValues'; const LEFT_MARGIN = 70; // Margin from the left side of the ...
Shouldn't we define the return type well?
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -19,18 +19,39 @@ import app from '../app'; import config, { publisherData } from '../config'; import { isInsideCircle, scrollToCoordinates } from '../utils'; +import { Coordinates } from '../../types'; +import { getCoordinateValues } from '../utils/getCoordinateValues'; +type FlowExpanderProps = { + nextTipCoord...
Return type?
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mohdsayed
@@ -479,14 +479,14 @@ export const MULTI_SELLER_CONFIG = { <> <p> The publisher ad server is the central hub that controls and manages - the entire ad-serving process on a publisher's website or app. It also - does a couple of other tasks like delivering and optimizing ads, ...
? Please do a self code review.
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
amovar18
@@ -0,0 +1,138 @@ +/*
Can we move this a level inside, as in inside `protectedAudicence` folder? Since keeping this outside means we share the same types between all the EE currently, which we don't. Also, can we move the all the types here from app.ts.
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
amovar18
@@ -20,9 +20,9 @@ * @param {number} delay - The interval duration in milliseconds. * @returns {object} An object with an `id` property for managing the interval. */ -export const requestInterval = (fn, delay) => { +export const requestInterval = (fn: () => void, delay: number): object => {
I think this might be an artifact we can remove this if not needed.
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
amovar18
@@ -86,38 +89,45 @@ const mouseClickedInNonInteractiveModeCallback = (renderUserIcon) => { flow.clearBelowTimelineCircles(); if (circles[clickedIndex].type === 'advertiser') { + // @ts-ignore app.joinInterestGroup.joinings[clickedIndex][0].props.y1 += 20; } else { + // @ts-ignore app.auction....
```suggestion if (!p || !up) { ``` Would this work?
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
amovar18
@@ -66,12 +66,15 @@ const mouseClickedInNonInteractiveModeCallback = (renderUserIcon) => { app.nodeIndexRevisited = -1; wipeAndRecreateUserCanvas(); - circles.forEach((circle, index) => { + circles.forEach((__, index) => { + if (!p) {
```suggestion if (!p || !up) { ``` Would this work? So we can remove `up?.`
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mayan-000
@@ -81,8 +112,6 @@ const FlowExpander = async ({ nextTipCoordinates, typeOfBranches }) => { } }); scrollToCoordinates(endpoint.x, endpoint.y); -
This shouldn't be removed.
ps-analysis-tool
github_2023
typescript
940
GoogleChromeLabs
mayan-000
@@ -40,14 +62,22 @@ const FlowExpander = async ({ nextTipCoordinates, typeOfBranches }) => { } else { p.cursor('default'); } + return false; }; - const endpoint = await new Promise((resolve) => { - igp.mouseClicked = ({ offsetX, offsetY }) => { - nextTipCoordinates.forEach(({ x, y }, i...
I guess this will change the logic. If by mistake, please undo
ps-analysis-tool
github_2023
javascript
949
GoogleChromeLabs
amovar18
@@ -72,7 +72,7 @@ export const triangle = (size, x, y, direction = 'right', color = 'black') => { p.translate(x - spacing, y + spacing); } else if (direction === 'down') { p.translate(x, y + spacing); - } else { + } else if (direction === 'up') {
Was this necessary?
ps-analysis-tool
github_2023
typescript
941
GoogleChromeLabs
mohdsayed
@@ -71,30 +74,57 @@ const Tabs = ({ showBottomBorder = true, fontSizeClass }: TabsProps) => { > <div className={classNames( - 'flex gap-10 mx-4', + 'flex gap-8 mx-4', fontSizeClass ? fontSizeClass : 'text-sm' )} > - {titles.map((title, index) => (...
Do not use nested ternary operators
ps-analysis-tool
github_2023
javascript
924
GoogleChromeLabs
mohdsayed
@@ -104,6 +104,19 @@ auction.draw = (index) => { app.promiseQueue.push(async (cb) => { const { component, props, callBack, delay = 0 } = step; + if (props?.title) { + const deciderObject = { + title: props.title, + description: props.description, + ssp: props?.ssp + ...
Please avoid complex nested ternary operator 🙏
ps-analysis-tool
github_2023
javascript
924
GoogleChromeLabs
mohdsayed
@@ -104,6 +104,19 @@ auction.draw = (index) => { app.promiseQueue.push(async (cb) => { const { component, props, callBack, delay = 0 } = step; + if (props?.title) { + const deciderObject = {
```suggestion const stepController = { ```
ps-analysis-tool
github_2023
typescript
924
GoogleChromeLabs
mohdsayed
@@ -179,47 +179,59 @@ const AuctionTable = ({ maxHeight="90%" className="w-full flex flex-col" > - <div className="flex justify-between items-center p-2"> - <p>Started by: {auctionEvents?.[0]?.auctionConfig?.seller}</p> - <p> - {startDate - ? sta...
```suggestion Auction events have yet to be recorded. ```
ps-analysis-tool
github_2023
typescript
924
GoogleChromeLabs
mohdsayed
@@ -196,72 +208,172 @@ export const createAuctionEvents = ( seller: string, advertisers: string[], eventStartTime: number, - isTopLevelBid: boolean + isTopLevelBid: boolean, + currentStep: StepType | null, + previousEvents: singleAuctionEvent[] | null, + isMultiSeller = false ) => { const bidEvents = ...
We should avoid checking against text string, instead let's create some key value pair object variable/constant, so that if the text changes, we don't have to update here. This will also be a problem in translation later.
ps-analysis-tool
github_2023
typescript
894
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,85 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
?
ps-analysis-tool
github_2023
typescript
894
GoogleChromeLabs
mohdsayed
@@ -17,24 +17,117 @@ * External dependencies. */ import React from 'react'; +import { ChipsBar, FiltersSidebar, TopBar } from '@google-psat/design-system'; +import { Resizable } from 're-resizable'; +import { noop } from '@google-psat/common'; + /** * Internal dependencies. */ import { getStoryMarkup } from ...
Should this be `label`?
ps-analysis-tool
github_2023
typescript
894
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,138 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
?
ps-analysis-tool
github_2023
typescript
894
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,40 @@ +/* + * Copyright 2023 Google LLC
copy paste?
ps-analysis-tool
github_2023
typescript
876
GoogleChromeLabs
mohdsayed
@@ -104,12 +104,19 @@ const SidebarChild = ({ ? 'bg-royal-blue text-white dark:bg-medium-persian-blue dark:text-chinese-silver' : 'bg-gainsboro dark:bg-outer-space' : 'bg-lotion dark:bg-raisin-black' - } cursor-pointer ${sidebarItem.isBlurred ? 'opacity-50' : ''}`} + ...
```suggestion typeof sidebarItem.title === 'function' ? sidebarItem.title() : sidebarItem.title || '' ```
ps-analysis-tool
github_2023
others
876
GoogleChromeLabs
mohdsayed
@@ -61,6 +61,9 @@ "@types/p5": "^1.7.6", "@types/react-copy-to-clipboard": "^5.0.4", "devtools-protocol": "^0.0.1345247", - "html-inline-script-webpack-plugin": "^3.2.1" + "html-inline-script-webpack-plugin": "^3.2.1", + "puppeteer": "22.15.0", + "puppeteer-extra": "3.3.6", + "puppeteer-ex...
What's the purpose of adding these dependencies in this PR?
ps-analysis-tool
github_2023
javascript
874
GoogleChromeLabs
mohdsayed
@@ -135,7 +135,13 @@ const config = { isInteractiveMode: false, mouseX: 0, mouseY: 0, + nextNodeIndexTracker: 1, + prevNodeIndexTracker: 0, shouldRespondToClick: true, + startTrackingMouse: true, + isReset: false, + animationFrames: [], + wasAnythingDoneInInteractiveMode: false,
```suggestion interactiveModeActionPerformed: false, ```
ps-analysis-tool
github_2023
javascript
874
GoogleChromeLabs
mohdsayed
@@ -190,44 +216,46 @@ utils.setupInterestGroupCanvas = (p) => { overlayCanvas.parent('interest-canvas'); overlayCanvas.style('z-index', 2); p.textSize(config.canvas.fontSize); + // eslint-disable-next-line no-undef + if (process.env.NODE_ENV !== 'production') {
What does this do for dev mode?
ps-analysis-tool
github_2023
javascript
874
GoogleChromeLabs
mohdsayed
@@ -320,37 +446,43 @@ auction.draw = async (index) => { } for (const step of steps) { - if (window.cancelPromise || window.cancelPromiseForPreviousAndNext) { - return; - } + PromiseQueue.nextStepSkipIndex.push(PromiseQueue.queue.length - 1); + PromiseQueue.add(async () => { + const { compo...
As we have to check conditions and text can change in future, let's add keys to the object for comparison.
ps-analysis-tool
github_2023
javascript
865
GoogleChromeLabs
mohdsayed
@@ -35,39 +36,53 @@ const config = { type: 'advertiser', website: 'adv1.com', datetime: '2023-10-01 10:00', - igGroupsCount: 1, + igGroupsCount: 5, + interestGroups: ['shoes', 'heels', 'phones', 'laptops', 'blankets'], }, { type: 'advertiser', ...
Let's use some name instead of ID.
ps-analysis-tool
github_2023
others
865
GoogleChromeLabs
mohdsayed
@@ -47,12 +53,108 @@ width: 20px; height: 20px; } + #canvas-container { width: 100%; height: 100%; position: relative; } + #bubble-container { + position: absolute; + pointer-events: none; + ...
As the CSS is growing, we should soon move it to a css file.
ps-analysis-tool
github_2023
javascript
865
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,525 @@ +/*
Moving this to module as it encapsulates functional unit of the application, responsible for a specific feature.
ps-analysis-tool
github_2023
typescript
860
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,49 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
```suggestion onChange={(event) => setSliderStep(Number(event.target.value))} ```
ps-analysis-tool
github_2023
typescript
859
GoogleChromeLabs
mohdsayed
@@ -13,21 +13,94 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * External dependencies. */ -import React from 'react'; -import { LandingPage, PSInfoKey } from '@google-psat/design-system'; +import React, { useMemo, useState } from 'react'; ...
Internal Dependency
ps-analysis-tool
github_2023
typescript
859
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,118 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Shouldn't we clear timeout on component unmount?
ps-analysis-tool
github_2023
typescript
859
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,125 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion /** * External dependencies. */ import { SearchInput } from '@google-psat/design-system'; ```
ps-analysis-tool
github_2023
typescript
859
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,125 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion if (['ArrowDown', 'ArrowUp'].includes(event.key)) { ```
ps-analysis-tool
github_2023
javascript
859
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,246 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Is this going to be removed?
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
amovar18
@@ -0,0 +1,79 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Colours for these are present in the `tailwind.config.cjs`. Maybe we can change that colour's name to an actual colour and reuse them here?
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
amovar18
@@ -0,0 +1,125 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Lets add this colour as well in tailwind config and use the class.
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
mohdsayed
@@ -116,12 +120,15 @@ const Table = ({ hideFiltering={hideFiltering} setShowFilterSidebar={setShowFilterSidebar} extraInterface={extraInterfaceToTopBar} + hideSearch={hideSearch} /> - <ChipsBar - selectedFilters={selectedFilters} - resetFilters={resetFilters} ...
```suggestion {!hideFiltering && ( <ChipsBar selectedFilters={selectedFilters} resetFilters={resetFilters} toggleFilterSelection={toggleFilterSelection} /> )} ```
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,125 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Are we going to colorize it somehow?
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,50 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
Should this be wrapped in a `<label>`, so that clicking the text checks the checkbox.
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,55 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
External dependency
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,75 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by a...
```suggestion onRowClick={setSelectedRow} ```
ps-analysis-tool
github_2023
typescript
813
GoogleChromeLabs
mohdsayed
@@ -17,18 +17,102 @@ /** * External dependencies. */ -import React from 'react'; -import { LandingPage, PSInfoKey } from '@google-psat/design-system'; +import React, { useMemo, useState } from 'react'; +import { + InfoCard as InfoCardTemplate, + PSInfoKey, + QuickLinksList, + Tabs, + type PSInfoKeyType, + ty...
External
ps-analysis-tool
github_2023
typescript
830
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,113 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion return urls.map((url, index) => { ```
ps-analysis-tool
github_2023
typescript
830
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,113 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion const errorOutUrls = processedData[ind].erroredOutUrls[url]; const hasTimeOutError = ( errorOutUrls as SingleURLError[] ```
ps-analysis-tool
github_2023
typescript
830
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,158 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
What's the purpose of using `useMemo` here?
ps-analysis-tool
github_2023
typescript
830
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,158 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
`useMemo` ?
ps-analysis-tool
github_2023
typescript
830
GoogleChromeLabs
mohdsayed
@@ -271,23 +279,11 @@ program.parse(); ); } - const result = urlsToProcess.map((_url, ind) => { - const detectedMatchingSignatures: LibraryData = { - ...detectMatchingSignatures( - cookieAnalysisAndFetchedResourceData[ind].resources ?? [], - Object.fromEntries( - LIBRARIES.map(...
👍
ps-analysis-tool
github_2023
typescript
849
GoogleChromeLabs
gagan0123
@@ -107,27 +100,62 @@ const generateRootSummaryDataCSV = ( totalCookies += 1; }); - const summary = { - [I18n.getMessage('totalCookies')]: totalCookies, - [I18n.getMessage('totalFirstPartyCookies')]: totalFirstPartyCookies, - [I18n.getMessage('totalThirdPartyCookies')]: totalThirdPartyCookies, - ...
Why `URL Heading` instead of just `URL` ?
ps-analysis-tool
github_2023
typescript
849
GoogleChromeLabs
mayan-000
@@ -107,27 +100,62 @@ const generateRootSummaryDataCSV = ( totalCookies += 1; }); - const summary = { - [I18n.getMessage('totalCookies')]: totalCookies, - [I18n.getMessage('totalFirstPartyCookies')]: totalFirstPartyCookies, - [I18n.getMessage('totalThirdPartyCookies')]: totalThirdPartyCookies, - ...
Many of the heading texts have translations available.
ps-analysis-tool
github_2023
typescript
823
GoogleChromeLabs
mayan-000
@@ -105,50 +109,186 @@ export class BrowserManagement { headless: this.isHeadless, args, }); + this.debugLog('Browser initialized'); } + async clickOnButtonUsingCMPSelectors(page: Page): Promise<boolean> { + let clickedOnButton = false; + + try { + await Promise.all( + CM...
Will remove the management of clickedOnButton var. ```suggestion return bannerNodes?.some((node: Element) => { const buttonNodes = Array.from(node?.getElementsByTagName('button')); return buttonNodes?.some((cnode) => { if (!cnode?.textContent) { return false...
ps-analysis-tool
github_2023
typescript
823
GoogleChromeLabs
mayan-000
@@ -105,50 +109,186 @@ export class BrowserManagement { headless: this.isHeadless, args, }); + this.debugLog('Browser initialized'); } + async clickOnButtonUsingCMPSelectors(page: Page): Promise<boolean> { + let clickedOnButton = false; + + try { + await Promise.all( + CM...
some can be used instead of forEach.
ps-analysis-tool
github_2023
typescript
823
GoogleChromeLabs
mohdsayed
@@ -125,6 +126,11 @@ program (value) => localeValidator(value, '-l'), 'en' ) + .option( + '-b, --button-selectors <path>',
Would `--gdpr-config` make it more clear (and the shortcut `-g`) ?
ps-analysis-tool
github_2023
typescript
827
GoogleChromeLabs
mayan-000
@@ -0,0 +1,133 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
The translation is available for most names or descriptions, I18n can be used.
ps-analysis-tool
github_2023
typescript
827
GoogleChromeLabs
mayan-000
@@ -0,0 +1,133 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
Wrong key, it's ATTRIBUTION_REPORTING
ps-analysis-tool
github_2023
typescript
814
GoogleChromeLabs
mohdsayed
@@ -54,6 +58,10 @@ const saveReports = async ( 'report.html', sitemapUrl ); + console.log(extractReportData(result).landingPageCookies);
Want to keep it?
ps-analysis-tool
github_2023
typescript
814
GoogleChromeLabs
mohdsayed
@@ -14,15 +14,11 @@ * limitations under the License. */ -import { - calculateEffectiveExpiryDate, - type CompleteJson, - type CookieFrameStorageType, -} from '@google-psat/common'; - /** * Internal dependencies */ +import { CompleteJson, CookieFrameStorageType } from '../cookies.types';
Please use `type`
ps-analysis-tool
github_2023
typescript
814
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,135 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion return Object.entries(summary) .map(([key, value]) => `${key}, ${value}`) .join('\r\n'); ``` Will that return the same result?
ps-analysis-tool
github_2023
typescript
814
GoogleChromeLabs
mohdsayed
@@ -37,9 +37,12 @@ describe('generateReport', () => { message: 'Exempted Cookies', }, }); + globalThis.fetch = jest.fn().mockResolvedValue({ json: jest.fn().mockResolvedValue({}), }); + + //@ts-ignore
Let's keep adding reasons.
ps-analysis-tool
github_2023
typescript
488
GoogleChromeLabs
ayushnirwal
@@ -284,6 +290,7 @@ export const Provider = ({ children }: PropsWithChildren) => { cookieData?: TabCookies; tabToRead?: string; tabMode?: string; + didServiceWorkerSleep?: boolean;
For boolean flags, try to use names with prefix "is". "isSWSleep" in this case.
ps-analysis-tool
github_2023
typescript
488
GoogleChromeLabs
ayushnirwal
@@ -100,6 +104,8 @@ export const Provider = ({ children }: PropsWithChildren) => { const loadingTimeout = useRef<ReturnType<typeof setTimeout> | null>(null); const [tabToRead, setTabToRead] = useState<string | null>(null); const [contextInvalidated, setContextInvalidated] = useState<boolean>(false); + const [...
isSWInactive
ps-analysis-tool
github_2023
typescript
488
GoogleChromeLabs
ayushnirwal
@@ -134,7 +146,19 @@ chrome.webRequest.onResponseStarted.addListener( chrome.webRequest.onBeforeSendHeaders.addListener( ({ url, requestHeaders, tabId, frameId, requestId }) => { (async () => { - const tabUrl = syncCookieStore?.getTabUrl(tabId) ?? ''; + if (!syncCookieStore) {
Would you mind adding an explainer comment why `syncCookieStore` not being defined has the conclusion that the SW was in a sleep state?
ps-analysis-tool
github_2023
others
736
GoogleChromeLabs
amovar18
@@ -42,7 +42,7 @@ jobs: timeout-minutes: 20 steps: - name: Harden Runner # Security agent: blocks outbound traffic & detects code overwrite to prevent breaches - uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 + uses: step-security/harden-runner@17d0e2bd7d51742c...
This is already in develop. Lets merge that into this and remove this unrelated diff.
ps-analysis-tool
github_2023
others
789
GoogleChromeLabs
mohdsayed
@@ -4,7 +4,7 @@ "description": "Cookie Analysis Tool and CLI for analysis and understanding of cookie usage on web pages.", "scripts": { "build-storybook": "storybook build", - "build:all": "run-p build:tsc-packages build:cli-dashboard webpack:build:cli webpack:build:ext", + "build:all": "npm run build:tsc-pac...
What issue did we have with `run-p` running all commands in parallel?
ps-analysis-tool
github_2023
others
789
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,12 @@ +<!DOCTYPE html>
This means the other `index.html` is used for development only? Let's keep the production file name as `index.html` and the development file's name may be something like `index-dev.html`
ps-analysis-tool
github_2023
typescript
789
GoogleChromeLabs
mohdsayed
@@ -16,8 +16,7 @@ /** * External dependencies. */ -import { type Cookie as ParsedCookie } from 'simple-cookie'; -import { TabCookies, TabFrames } from '@google-psat/common'; +import { CookieData, TabCookies, TabFrames } from '@google-psat/common';
Please consider using the keyword `type` for these imports.
ps-analysis-tool
github_2023
others
735
GoogleChromeLabs
mohdsayed
@@ -24,7 +24,7 @@ }, "homepage": "https://github.com/GoogleChromeLabs/ps-analysis-tool#readme", "scripts": { - "dev": "webpack --config ../../dashboard.webpack.config.cjs --watch", + "dev": "NODE_ENV=development webpack serve --config ../../dashboard.webpack.config.cjs",
```suggestion "dev": "webpack serve --config ../../dashboard.webpack.config.cjs --open", ``` The default is `development`, so will `NODE_ENV=development` be required? Also, let's open it after serving. https://github.com/GoogleChromeLabs/ps-analysis-tool/blob/2b89c2ef1685d1f5700d021b888a936cf8a0c6c4/webpac...
ps-analysis-tool
github_2023
others
735
GoogleChromeLabs
mohdsayed
@@ -44,6 +44,7 @@ "@babel/preset-env": "^7.22.15", "@babel/preset-react": "^7.22.15", "@babel/preset-typescript": "^7.22.15", + "@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
Tabs used here
ps-analysis-tool
github_2023
typescript
735
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,161 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
```suggestion /** * Internal dependencies */ import { ```
ps-analysis-tool
github_2023
typescript
735
GoogleChromeLabs
mohdsayed
@@ -13,114 +13,102 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + /** * External dependencies */ -import React, { useMemo } from 'react'; +import React, { useMemo, useState } from 'react'; import { - LibraryDetection, - useLibraryDetectionCon...
Move to "External dependencies"
ps-analysis-tool
github_2023
others
735
GoogleChromeLabs
mohdsayed
@@ -139,7 +139,8 @@ "forbid": ["for"] } ], - "@typescript-eslint/ban-ts-comment": "off" + "@typescript-eslint/ban-ts-comment": "off", + "react/react-in-jsx-scope": "off"
This should have been done in a separate PR.
ps-analysis-tool
github_2023
typescript
735
GoogleChromeLabs
mohdsayed
@@ -16,7 +16,6 @@ /** * External dependencies. */
Also remove empty comments from all files.
ps-analysis-tool
github_2023
typescript
749
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,97 @@ +/*
These dashboard files should be moved to a new folder, probably `report` under `view/devtools`
ps-analysis-tool
github_2023
others
749
GoogleChromeLabs
mohdsayed
@@ -128,4 +128,28 @@ const report = { ...commonConfig, }; -module.exports = [root, devTools, popup, report]; +const dashboard = { + entry: { + index: './src/view/devtools/dashboard.tsx', + }, + output: { + path: path.resolve(__dirname, './dist/extension/devtools'), + filename: 'devtoolsDashboard.js', ...
This would be confusing, let's rename this to something like dashboard report or something.
ps-analysis-tool
github_2023
others
749
GoogleChromeLabs
mohdsayed
@@ -31,9 +32,9 @@ "cli-dashboard:prebuild": "npm run build:remove -w @google-psat/cli-dashboard", "cli-dashboard:build": "npm run cli-dashboard:prebuild && cross-env NODE_ENV=production npm run build -w @google-psat/cli-dashboard", "cookie-db:update": "node scripts/update-cookie-db.cjs", - "ext:dev": "npm run...
`build:tsc-packages` runs all the `:build` instead of `:dev`. This means it will not pick up new changes made to other packages like library-detection while running `npm run ext:dev`
ps-analysis-tool
github_2023
typescript
749
GoogleChromeLabs
mohdsayed
@@ -47,6 +50,8 @@ const CookiesWithIssues = ({ 'cookiesWithIssuesListing', selectedSite ); + //@ts-ignore
Please add reason for `@ts-ignore`
ps-analysis-tool
github_2023
typescript
749
GoogleChromeLabs
mohdsayed
@@ -189,10 +189,16 @@ const Layout = ({ return; } + //@ts-ignore
Please add reasons.
ps-analysis-tool
github_2023
typescript
758
GoogleChromeLabs
mohdsayed
@@ -0,0 +1,112 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by ...
?
ps-analysis-tool
github_2023
typescript
734
GoogleChromeLabs
mayan-000
@@ -46,7 +48,9 @@ export const analyzeCookiesUrlsAndFetchResources = async ( }, isHeadless, delayTime, - false + verbose, + urls.length > 2 ? 4 : 3,
I guess it's urls.length > 1
ps-analysis-tool
github_2023
typescript
734
GoogleChromeLabs
mayan-000
@@ -59,95 +64,118 @@ const parseUrlsFromCSV = async (csvPath: string, spinnies: any) => { }, [] as string[]); if (_urls.length === 0) { - console.log(`Error: CSV file contains no URLs: ${basename(csvPath)}`); + console.log(
This can be converted into a logger function inside the same file, as it's used in many places.
ps-analysis-tool
github_2023
typescript
729
GoogleChromeLabs
mayan-000
@@ -32,6 +33,21 @@ const CookieBlockedReason = { SamePartyFromCrossPartyContext: ['body_SamePartyFromCrossPartyContext'], NameValuePairExceedsMaxSize: ['body_NameValuePairExceedsMaxSize'], InvalidDomain: ['body_InvalidDomain'], + SameSiteLax: + "This cookie was blocked because it had the 'SameSite=Lax' att...
```suggestion "This attempt to set a cookie via a 'Set-Cookie' header was blocked because the header did not contain any value.", ```
ps-analysis-tool
github_2023
typescript
729
GoogleChromeLabs
mohdsayed
@@ -83,6 +83,21 @@ export const LEGEND_DESCRIPTION: LegendData = { StorageAccessAPI: 'exemptionReasonStorageAccessAPI', TopLevelStorageAccessAPI: 'exemptionReasonTopLevelStorageAccessAPI', CorsOptIn: 'exemptionReasonCorsOptIn', + SameSiteLax: + "This cookie was blocked because it had the 'SameSite=Lax' att...
Curious to know why these are defined in two different packages?
ps-analysis-tool
github_2023
typescript
729
GoogleChromeLabs
mohdsayed
@@ -56,7 +56,9 @@ const CookiesSection = () => { ...component, description: typeof legendDescription === 'string' - ? I18n.getMessage(legendDescription) + ? legendDescription.includes(' ') + ? legendDescription + : I18n.getMessage(legendDescri...
Can this become a function?
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -68,6 +69,11 @@ const App = () => { }, []); useEffect(() => { + sessionStorage.clear();
What's the purpose of clearing `sessionStorage` here?
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -27,6 +27,10 @@ import { useFiltersMapping, } from '@ps-analysis-tool/design-system'; import type { TabCookies, TabFrames } from '@ps-analysis-tool/common'; +import { I18n } from '@ps-analysis-tool/i18n'; +/** + * Internal dependencies + */
?
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -37,7 +37,7 @@ const Tabs: SidebarItems = { dropdownOpen: true, }, [SIDEBAR_ITEMS_KEYS.COOKIES_WITH_ISSUES]: { - title: 'Cookie Issues', + title: 'cookieIssues',
For later refactoring, since this is the title key instead of the actual title string now, the key name should reflect that.
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -131,6 +132,8 @@ function generateReportObject(analysisData: CompleteJson, siteURL: string) { showBlockedCategory: true, url: siteURL, source: 'cli', + // @ts-ignore
Please add reason for `@ts-ignore`
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -210,6 +213,8 @@ function generateSitemapReportObject( showFramesSection: false, showBlockedCategory: true, url: sitemapURL, + // @ts-ignore
Reason for `@ts-ignore`
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -146,7 +146,10 @@ const SidebarChild = ({ </div> )} <p className="flex flex-row items-center justify-center whitespace-nowrap gap-x-1 pr-1"> - {sidebarItem.title} + {typeof sidebarItem.title === 'string' + ? sidebarItem.title + : sidebarItem.title?...
```suggestion {typeof sidebarItem.title === 'function' ? sidebarItem.title() : sidebarItem.title} ```
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
mohdsayed
@@ -128,7 +129,9 @@ const ListItem = ({ className="text-link ml-2 mt-1 block text-royal-blue dark:text-medium-persian-blue" href="#" > - {isExpanded ? 'Show Less' : 'Show More'} + {isExpanded + ? I18n.getMessage('showLess') + ...
Shorter alternative. ```suggestion {I18n.getMessage(isExpanded ? 'showLess' : 'showMore')} ```
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
amovar18
@@ -64,15 +65,19 @@ const InformationContainer = () => { const handleCopy = useCallback(() => { setCopying(true); - let clipboardText = `**Open Tabs:** ${currentTabs}\n`; + let clipboardText = `**${I18n.getMessage('openTabs')}:** ${currentTabs}\n`;
Do we need translated details here? AFAIK this is for developers to replicate the environment to reproduce the breakage.
ps-analysis-tool
github_2023
typescript
713
GoogleChromeLabs
amovar18
@@ -22,8 +22,28 @@ import '@testing-library/jest-dom'; * Internal dependencies. */ import getFrameType from '../getFrameType'; +import { I18n } from '@ps-analysis-tool/i18n';
Some import from other package are under internal dependencies comment, please move them to appropriate place.