Repository: protofire/solhint (js)

Issue:
mark-callable-contracts rule is firing a false positive on emitting events
The `mark-callable-contracts` rule is being triggered against emitting events, as events are camel-cased very similarly to contracts. We should update this rule so that it does not get triggered by emitting an event. Take for instance this example:
```sol
contract A {
  event UpdatedToken();

  function b() public {
    emit UpdatedToken(); // This line triggers mark-callable-contracts
  }

}
```

Pull request description:
Fixes #116 mark-callable-contracts firing false positive on event names
Fixes #116 

Patch:
diff --git a/lib/rules/security/mark-callable-contracts.js b/lib/rules/security/mark-callable-contracts.js
index b9ec42f..8673fee 100644
--- a/lib/rules/security/mark-callable-contracts.js
+++ b/lib/rules/security/mark-callable-contracts.js
@@ -25,11 +25,15 @@ class MarkCallableContractsChecker {
     this.reporter = reporter
     this.ruleId = ruleId
     this.meta = meta
-    this.structNames = []
+    this.nonContractNames = []
   }
 
   enterStructDefinition(ctx) {
-    this.gatherStructNames(ctx)
+    this.gatherNonContractNames(ctx)
+  }
+
+  enterEventDefinition(ctx) {
+    this.gatherNonContractNames(ctx)
   }
 
   exitIdentifier(ctx) {
@@ -42,7 +46,7 @@ class MarkCallableContractsChecker {
       isFirstCharUpper &&
       !containsTrustInfo &&
       isStatement &&
-      !this.structNames.includes(identifier)
+      !this.nonContractNames.includes(identifier)
     ) {
       this.reporter.addMessage(
         ctx.getSourceInterval(),
@@ -53,12 +57,12 @@ class MarkCallableContractsChecker {
     }
   }
 
-  gatherStructNames(ctx) {
+  gatherNonContractNames(ctx) {
     const identifier = ctx.children[1]
-    const structName = identifier.getText()
+    const name = identifier.getText()
 
-    if (structName) {
-      this.structNames.push(structName)
+    if (name) {
+      this.nonContractNames.push(name)
     }
   }
 }


Test patch:
diff --git a/test/rules/security/mark-callable-contracts.js b/test/rules/security/mark-callable-contracts.js
index 0a5c6f9..0992312 100644
--- a/test/rules/security/mark-callable-contracts.js
+++ b/test/rules/security/mark-callable-contracts.js
@@ -55,4 +55,20 @@ describe('Linter - mark-callable-contracts', () => {
 
     assert.equal(report.warningCount, 0)
   })
+
+  it('should not return error for an event', () => {
+    const code = contractWith(`
+  event UpdatedToken();
+
+  function b() public {
+    emit UpdatedToken();
+  }
+    `)
+
+    const report = linter.processStr(code, {
+      rules: { 'mark-callable-contracts': 'warn' }
+    })
+
+    assert.equal(report.warningCount, 0)
+  })
 })