mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +01:00
fixed pr suggestions
This commit is contained in:
@@ -22,7 +22,7 @@ Write the class name beginning with an uppercase letter. For example, <code>clas
|
||||
|
||||
<li>
|
||||
Guido van Rossum, Barry Warsaw, Nick Coghlan <em>PEP 8 -- Style Guide for Python Code<em>
|
||||
<a href="https://www.python.org/dev/peps/pep-0008/#class-names"</a>
|
||||
<a href="https://www.python.org/dev/peps/pep-0008/#class-names">Python Class Names</a>
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -3,15 +3,21 @@
|
||||
* @description A class name that begins with a lowercase letter decreases readability.
|
||||
* @kind problem
|
||||
* @problem.severity recommendation
|
||||
* @precision medium
|
||||
* @id python/misnamed-type
|
||||
* @id py/misnamed-class
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import python
|
||||
|
||||
from Class c
|
||||
from Class c, string first_char
|
||||
where
|
||||
c.inSource() and
|
||||
not c.getName().substring(0, 1).toUpperCase() = c.getName().substring(0, 1)
|
||||
first_char = c.getName().prefix(1) and
|
||||
not first_char = first_char.toUpperCase() and
|
||||
not exists(Class c1, string first_char1 |
|
||||
c1 != c and
|
||||
c1.getLocation().getFile() = c.getLocation().getFile() and
|
||||
first_char1 = c1.getName().prefix(1) and
|
||||
not first_char1 = first_char1.toUpperCase()
|
||||
)
|
||||
select c, "Class names should start in uppercase."
|
||||
|
||||
@@ -22,7 +22,7 @@ Write the function name beginning with an lowercase letter. For example, <code>j
|
||||
|
||||
<li>
|
||||
Guido van Rossum, Barry Warsaw, Nick Coghlan <em>PEP 8 -- Style Guide for Python Code<em>
|
||||
<a href="https://www.python.org/dev/peps/pep-0008/#function-and-variable-names"</a>
|
||||
<a href="https://www.python.org/dev/peps/pep-0008/#function-and-variable-names">Python Function and Variable Names</a>
|
||||
</li>
|
||||
|
||||
</references>
|
||||
|
||||
@@ -3,15 +3,21 @@
|
||||
* @description A function name that begins with an uppercase letter decreases readability.
|
||||
* @kind problem
|
||||
* @problem.severity recommendation
|
||||
* @precision medium
|
||||
* @id python/misnamed-function
|
||||
* @id py/misnamed-function
|
||||
* @tags maintainability
|
||||
*/
|
||||
|
||||
import python
|
||||
|
||||
from Function f
|
||||
from Function f, string first_char
|
||||
where
|
||||
f.inSource() and
|
||||
not f.getName().substring(0, 1).toLowerCase() = f.getName().substring(0, 1)
|
||||
first_char = f.getName().prefix(1) and
|
||||
not first_char = first_char.toLowerCase() and
|
||||
not exists(Function f1, string first_char1 |
|
||||
f1 != f and
|
||||
f1.getLocation().getFile() = f.getLocation().getFile() and
|
||||
first_char1 = f1.getName().prefix(1) and
|
||||
not first_char1 = first_char1.toLowerCase()
|
||||
)
|
||||
select f, "Function names should start in lowercase."
|
||||
|
||||
Reference in New Issue
Block a user