Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule to check for structNew and suggest using {} instead #91

Merged
merged 4 commits into from
Oct 12, 2015
Merged

Conversation

justinmclean
Copy link
Contributor

No description provided.

ryaneberly added a commit that referenced this pull request Oct 12, 2015
Rule to check for structNew and suggest using {} instead
@ryaneberly ryaneberly merged commit ae7170a into dev Oct 12, 2015
@ryaneberly ryaneberly deleted the structNew branch October 12, 2015 03:28
@ryaneberly
Copy link
Contributor

@justinmclean
I combined the structnew() and writedump() checks into a single generic FunctionXChecker with 2 parameterized definitions in cflint.definition.xml

@justinmclean
Copy link
Contributor Author

Does it understand / check that writedump take a parameter, where structnew doesn't?

@justinmclean
Copy link
Contributor Author

And I assume you've not merged in arraynew(1), as arraynew(1) can be replaced by [] but arraynew(2) can't.

final String cfmlFunctionCheck = getParameter("functionName");

CFFunctionExpression functionExpression = (CFFunctionExpression)expression;
if(functionExpression.getName().equalsIgnoreCase(cfmlFunctionCheck)){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may want to use cfmlFunctionCheck "(" so less chance of matching things that are not function calls?

@ryaneberly
Copy link
Contributor

Right, I didn't use this strategy for arraynew(1). I was going to, but one of the tests failed :-).

cfmlFunctionCheck is the entire name. The grammar will not call it a function unless there is a parenthesis though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants