jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
Signup
Sonar Plugins
  • Sonar Plugins
  • SONARPLUGINS-1806

Rule: Avoid usage of eval

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: JAVASCRIPT-1.0
  • Component/s: JavaScript
  • Labels:
    None
  • Number of attachments :
    0

Issue Links

depends upon

New Feature - A new feature of the product, which has yet to be developed. SONARPLUGINS-1788 Provide JavaScript rule engine based on SSLR

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Freddy Mallet added a comment - 15/May/12 7:53 AM - edited

Works well Evgeny.

Could you just update the description as follows :

<p>The eval() function in javascript is a way to run arbitrary code at run-time. In almost all cases, eval should never be used. If it exists in your page, there is almost always a more correct way to accomplish what you are doing.

The rule is, "Eval is evil." Don't use it unless you are an experienced developer and know that your case is an exception.</p>

<p>
The following code snippet illustrates this rule :
</p>

<pre>
var myCode = 'alert("Howdy?");';
eval(myCode);     //NOK
</pre>
Show
Freddy Mallet added a comment - 15/May/12 7:53 AM - edited Works well Evgeny. Could you just update the description as follows : <p>The eval() function in javascript is a way to run arbitrary code at run-time. In almost all cases, eval should never be used. If it exists in your page, there is almost always a more correct way to accomplish what you are doing. The rule is, "Eval is evil." Don't use it unless you are an experienced developer and know that your case is an exception.</p> <p> The following code snippet illustrates this rule : </p> <pre> var myCode = 'alert("Howdy?");'; eval(myCode); //NOK </pre>
Hide
Permalink
Evgeny Mandrikov added a comment - 16/May/12 1:37 AM

Done.

Show
Evgeny Mandrikov added a comment - 16/May/12 1:37 AM Done.
Hide
Permalink
Freddy Mallet added a comment - 18/May/12 6:47 AM

Manually tested !

Show
Freddy Mallet added a comment - 18/May/12 6:47 AM Manually tested !

People

  • Assignee:
    Evgeny Mandrikov
    Reporter:
    Evgeny Mandrikov
Vote (0)
Watch (0)

Dates

  • Created:
    11/May/12 11:51 PM
    Updated:
    22/May/12 4:17 AM
    Resolved:
    16/May/12 1:37 AM
  • Atlassian JIRA (v5.2.7#850-sha1:b2af0c8)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.