   lintOnSave: (textEditor) =>
     console.log 'lintOnSave'
     return new Promise (resolve, reject) =>
-      results = []
-
-      file = do textEditor.getPath
-      curDir = path.dirname file
-      cmd = @cmd[0..]
-      cmd.push file
-      console.log cmd
-      command = cmd[0]
-      options = {cwd: curDir}
-      args = cmd.slice 1
-
-
-      lintInfo =
-        command: command
-        args: args
-        options: options
-        curDir: curDir
-        origFileName: file
-
+      lintInfo = @makeLintInfo do textEditor.getPath
       @lintFile lintInfo, (results) ->
         resolve(results)
 

        fs.close(info.fd, (err) =>
          return reject(err) if err

          curDir = path.dirname file
          cmd = @cmd[0..]
          console.log cmd
          cmd.push info.path
          command = cmd[0]
          options = {cwd: curDir}
          args = cmd.slice 1
          console.log cmd

          lintInfo =
            command: command
            args: args
            options: options
            curDir: curDir
            origFileName: file
          @lintFile lintInfo, (results) ->
            fs.unlink(info.path)
            resolve(results)

        messages.push {
          type: type or 'Warning'
          text: match.message
          filePath: lintInfo.fileName
          range: [
            [match.line - 1, 0]
            [match.line - 1, 0]
