FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Functions/NonCls.ql at codeql-cli-2.27.1 · github/codeql · GitHub
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10.1k
Code
Issues
1k
Pull requests
468
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Functions
/
NonCls.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (29 loc) · 865 Bytes
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Functions
/
NonCls.ql
Copy path
File metadata and controls
31 lines (29 loc) · 865 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @name First parameter of a class method is not named 'cls'
* @description By the PEP8 style guide, the first parameter of a class method should be named `cls`.
* @kind problem
* @tags maintainability
* readability
* convention
* quality
* @problem.severity recommendation
* @sub-severity high
* @precision high
* @id py/not-named-cls
*/
import
python
import
MethodArgNames
from
Function
f
,
string
message
where
firstArgShouldReferToClsAndDoesnt
(
f
)
and
(
if
exists
(
f
.
getArgName
(
0
)
)
then
message
=
"Class methods or methods of a type deriving from type should have 'cls', rather than '"
+
f
.
getArgName
(
0
)
+
"', as their first parameter."
else
message
=
"Class methods or methods of a type deriving from type should have 'cls' as their first parameter."
)
select
f
,
message
Back
|
FazBrowse Home
|
New Git URL