title: Why does lintr say "warning: no visible binding for global variable ‘Cloaked’"?
body: <p>I'm sure that this is a misunderstanding of mine, since I'm not really an R programmer...</p>
  
  <p>I have my code here: <a href="https://gist.github.com/bnsh/3839c4eb2c6b31e32c39ec312014b2b8" rel="nofollow noreferrer">https://gist.github.com/bnsh/3839c4eb2c6b31e32c39ec312014b2b8</a></p>
  
  <pre><code>#! /usr/bin/env Rscript
  
  library(R6)
  
  Cloaked &lt;- R6::R6Class("Cloaked",
    public = list(
      msg = function() {
        return(paste(
          "this code _works_, but lintr (https://github.com/jimhester/lintr)",
          "complains that cloak_class.R:19:8: warning: no visible binding for",
          "global variable ‘Cloaked’ when I try to use Cloaked within a",
          "function. It's fine tho, if I use it _outside_ a function."
        ))
      }
    )
  )
  
  main &lt;- function() {
    c &lt;- Cloaked$new()
    c$msg()
  }
  
  main()
  </code></pre>
  
  <p>It works... But, lintr complains: "cloak_class.R:19:8: warning: no visible binding for global variable ‘Cloaked’"</p>
  
  <p>Actually, it's not about a class, really, because this also complains:</p>
  
  <pre><code>#! /usr/bin/env Rscript
  
  cloaked &lt;- function() {
    return(paste(
      "this code _works_, but lintr (https://github.com/jimhester/lintr)",
      "complains that cloak_function.R:13:3: warning: no visible global",
      "function definition for ‘cloaked’ when I try to use cloaked within",
      "a function. It's fine tho, if I use it _outside_ a function."
    ))
  }
  
  main &lt;- function() {
    cloaked()
  }
  
  main()
  </code></pre>
  
  <p>This code also runs, but lintr says:
  cloak_function.R:13:3: warning: no visible global function definition for ‘cloaked’</p>
  
  <p>Why? <strong>Short</strong> of doing something blunt instrument like <code># nolint start</code>/<code># nolint end</code>, what can I do to satisfy lintr?</p>
  
  <p>Thanks!</p>