bito-code-review[bot] commented on code in PR #40281:
URL: https://github.com/apache/superset/pull/40281#discussion_r3296538706
##########
superset-frontend/src/pages/UsersList/index.tsx:
##########
@@ -287,14 +287,14 @@ function UsersList({ user }: UsersListProps) {
id: 'login_count',
Header: t('Login count'),
hidden: true,
- Cell: ({ row: { original } }: any) => original.login_count,
+ Cell: ({ row: { original } }: any) => original.login_count ?? 0,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>CWE-1026: Avoid `any` type</b></div>
<div id="fix">
TypeScript type `any` violates the project's ongoing modernization rule ('NO
`any` types'). The `row` parameter can be properly typed using `UserObject`
from the existing import at line 45, following the pattern used in the deleted
`renderLoginCountCell` function. (See also:
[CWE-1026](https://cwe.mitre.org/data/definitions/1026.html))
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
```
--- superset-frontend/src/pages/UsersList/index.tsx
+++ superset-frontend/src/pages/UsersList/index.tsx
@@ -287,7 +287,7 @@
accessor: 'login_count',
id: 'login_count',
Header: t('Login count'),
hidden: true,
- Cell: ({ row: { original } }: any) => original.login_count ?? 0,
+ Cell: ({ row: { original } }: { row: { original: UserObject } })
=> original.login_count ?? 0,
},
{
accessor: 'fail_login_count',
id: 'fail_login_count',
Header: t('Fail login count'),
hidden: true,
- Cell: ({ row: { original } }: any) => original.fail_login_count
?? 0,
+ Cell: ({ row: { original } }: { row: { original: UserObject } })
=> original.fail_login_count ?? 0,
},
```
</div>
</details>
</div>
<small><i>Code Review Run #f74ad4</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
##########
superset-frontend/src/pages/UsersList/index.tsx:
##########
@@ -287,14 +287,14 @@ function UsersList({ user }: UsersListProps) {
id: 'login_count',
Header: t('Login count'),
hidden: true,
- Cell: ({ row: { original } }: any) => original.login_count,
+ Cell: ({ row: { original } }: any) => original.login_count ?? 0,
},
{
accessor: 'fail_login_count',
id: 'fail_login_count',
Header: t('Fail login count'),
hidden: true,
- Cell: ({ row: { original } }: any) => original.fail_login_count,
+ Cell: ({ row: { original } }: any) => original.fail_login_count ?? 0,
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>CWE-1026: Avoid `any` type</b></div>
<div id="fix">
Same `any` type violation as line 290. The `fail_login_count` cell renderer
also uses `any` instead of proper TypeScript typing. (See also:
[CWE-1026](https://cwe.mitre.org/data/definitions/1026.html))
</div>
</div>
<small><i>Code Review Run #f74ad4</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]