Skip to content
Permalink
Browse files

UCS_0_0

  • Loading branch information...
Michal Nowak
Michal Nowak committed Mar 14, 2019
1 parent 1ce3854 commit 1e15121270f96b242139137d00e6cd491baa7347
Showing with 69 additions and 1 deletion.
  1. +11 −0 .project
  2. +16 −0 QL/Source/Shared/LowerCamelCaseString.qll
  3. +17 −0 QL/Source/Shared/MutableLocalVariable.qll
  4. +24 −0 QL/Source/UCS_0_0.ql
  5. +1 −1 README.md
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>BeautifulCode</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
@@ -0,0 +1,16 @@
import csharp

/**
* Lower camel case string.
*/
class LowerCamelCaseString extends string
{
/**
* LowerCamelCaseString constructor.
*/
bindingset[this]
LowerCamelCaseString()
{
this.regexpMatch("[a-z]+((\\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?")
}
}
@@ -0,0 +1,17 @@
import csharp

/**
* A mutable local variable.
*/
class MutableLocalVariable extends LocalVariable
{
/**
* MutableLocalVariable constructor.
*/
MutableLocalVariable()
{
this.fromSource()
and
not this instanceof LocalConstant
}
}
@@ -0,0 +1,24 @@
/**
* @name UCS_0_0
* @description Class names should follow PascalCasing.
* @kind problem
* @problem.severity error
* @precision very high
* @id UCS_0_0
*/

import Shared.MutableLocalVariable
import Shared.LowerCamelCaseString

from
MutableLocalVariable mutableLocalVariable

where
not mutableLocalVariable.getName() instanceof LowerCamelCaseString

select
mutableLocalVariable, "Mutable local variable '$@' should follow PascalCasing.",
mutableLocalVariable, mutableLocalVariable.toString()

order
by mutableLocalVariable asc
@@ -7,4 +7,4 @@ UCS_CATEGORYNUMBER_RULENUMBER

## Category 0: Naming conventions

### Rule 0: Class names should follow PascalCasing
### Rule 0: Class names should follow PascalCasing

0 comments on commit 1e15121

Please sign in to comment.
You can’t perform that action at this time.