Skip to content

Commit

Permalink
#469 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaneberly committed Dec 24, 2017
1 parent 458deaf commit 533200d
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/cflint/CFLint.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private void process(final Element elem, final String space, final Context conte
if (elem.getName().equalsIgnoreCase(CF.CFCOMPONENT)) {
final Context componentContext = context.subContext(elem);
componentContext.setInComponent(true);
componentContext.setComponentName(elem.getAttributeValue(CF.DISPLAYNAME));
componentContext.setComponentName(context.getFilename().replaceAll(".[cC][fF][cC]", "").replaceAll("^.*[/\\\\]", ""));//elem.getAttributeValue(CF.DISPLAYNAME)
componentContext.setContextType(ContextType.COMPONENT);
handler.push(CF.COMPONENT);
doStructureStart(elem, componentContext, CFCompDeclStatement.class);
Expand Down Expand Up @@ -521,7 +521,7 @@ private void process(final Element elem, final String space, final Context conte
} else if (elem.getName().equalsIgnoreCase(CF.CFCOMPONENT)) {
final Context componentContext = context.subContext(elem);
componentContext.setInComponent(true);
componentContext.setComponentName(elem.getAttributeValue(CF.DISPLAYNAME));
componentContext.setComponentName(context.getFilename().replaceAll(".[cC][fF][cC]", "").replaceAll("^.*[/\\\\]", ""));//elem.getAttributeValue(CF.DISPLAYNAME)
componentContext.setContextType(ContextType.COMPONENT);

scanElement(elem, componentContext);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<cfcomponent hint="test" displayName="TestComp">
<cffunction name="testFunction" displayname="" access="public" output="false" returntype="void" hint="no close tag">
</cffunction>
</cfcomponent>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"version" : "",
"timestamp" : 1514084382,
"issues" : [ {
"severity" : "INFO",
"id" : "COMPONENT_INVALID_NAME",
"message" : "COMPONENT_INVALID_NAME",
"category" : "CFLINT",
"abbrev" : "CI",
"locations" : [ {
"file" : "src\\test\\resources\\com\\cflint\\tests\\ComponentNameChecker\\veryLongComponentName.cfc",
"fileName" : "veryLongComponentName.cfc",
"function" : "",
"column" : 0,
"line" : 1,
"message" : "Component name veryLongComponentName is not a valid name. Please use CamelCase and start with a capital letter.",
"variable" : "",
"expression" : "<cfcomponent hint=\"test\" displayName=\"TestComp\">\r\n <cffunction name=\"testFunction\" displayname=\"\" access=\"public\" output=\"false\" returntype=\"void\" hint=\"no close tag\">\r\n </cffunction>\r\n</cfcomponent>"
} ]
}, {
"severity" : "INFO",
"id" : "COMPONENT_TOO_LONG",
"message" : "COMPONENT_TOO_LONG",
"category" : "CFLINT",
"abbrev" : "CT",
"locations" : [ {
"file" : "src\\test\\resources\\com\\cflint\\tests\\ComponentNameChecker\\veryLongComponentName.cfc",
"fileName" : "veryLongComponentName.cfc",
"function" : "",
"column" : 0,
"line" : 1,
"message" : "Component name veryLongComponentName should be shorter than 15 characters.",
"variable" : "",
"expression" : "<cfcomponent hint=\"test\" displayName=\"TestComp\">\r\n <cffunction name=\"testFunction\" displayname=\"\" access=\"public\" output=\"false\" returntype=\"void\" hint=\"no close tag\">\r\n </cffunction>\r\n</cfcomponent>"
} ]
}, {
"severity" : "INFO",
"id" : "COMPONENT_TOO_WORDY",
"message" : "COMPONENT_TOO_WORDY",
"category" : "CFLINT",
"abbrev" : "CT",
"locations" : [ {
"file" : "src\\test\\resources\\com\\cflint\\tests\\ComponentNameChecker\\veryLongComponentName.cfc",
"fileName" : "veryLongComponentName.cfc",
"function" : "",
"column" : 0,
"line" : 1,
"message" : "Component name veryLongComponentName is too wordy, can you think of a more concise name?",
"variable" : "",
"expression" : "<cfcomponent hint=\"test\" displayName=\"TestComp\">\r\n <cffunction name=\"testFunction\" displayname=\"\" access=\"public\" output=\"false\" returntype=\"void\" hint=\"no close tag\">\r\n </cffunction>\r\n</cfcomponent>"
} ]
} ],
"counts" : {
"totalFiles" : 0,
"totalLines" : 0,
"countByCode" : [ {
"code" : "COMPONENT_INVALID_NAME",
"count" : 1
}, {
"code" : "COMPONENT_TOO_WORDY",
"count" : 1
}, {
"code" : "COMPONENT_TOO_LONG",
"count" : 1
} ],
"countBySeverity" : [ {
"severity" : "INFO",
"count" : 3
} ]
}
}

0 comments on commit 533200d

Please sign in to comment.