Example #1
0
    def run_rubocop(self, view):
        s = sublime.load_settings(SETTINGS_FILE)

        use_rvm = view.settings().get('check_for_rvm', s.get('check_for_rvm'))
        use_rbenv = view.settings().get('check_for_rbenv',
                                        s.get('check_for_rbenv'))
        cmd = view.settings().get('rubocop_command', s.get('rubocop_command'))
        rvm_path = view.settings().get('rvm_auto_ruby_path',
                                       s.get('rvm_auto_ruby_path'))
        rbenv_path = view.settings().get('rbenv_path', s.get('rbenv_path'))
        cfg_file = view.settings().get('rubocop_config_file',
                                       s.get('rubocop_config_file'))
        chdir = view.settings().get('rubocop_chdir', s.get('rubocop_chdir'))

        if cfg_file:
            cfg_file = FileTools.quote(cfg_file)

        runner = RubocopRunner({
            'use_rbenv': use_rbenv,
            'use_rvm': use_rvm,
            'custom_rubocop_cmd': cmd,
            'rvm_auto_ruby_path': rvm_path,
            'rbenv_path': rbenv_path,
            'on_windows': sublime.platform() == 'windows',
            'rubocop_config_file': cfg_file,
            'chdir': chdir,
            'is_st2': sublime.version() < '3000'
        })
        output = runner.run([view.file_name()],
                            ['--format', 'emacs']).splitlines()

        return output
Example #2
0
 def run_rubocop(self, path):
   s = sublime.load_settings(SETTINGS_FILE)
   use_rvm = s.get('check_for_rvm')
   use_rbenv = s.get('check_for_rbenv')
   cmd = s.get('rubocop_command')
   rvm_path = s.get('rvm_auto_ruby_path')
   rbenv_path = s.get('rbenv_path')
   runner = RubocopRunner(use_rbenv, use_rvm, cmd, rvm_path, rbenv_path)
   output = runner.run(path, '--format emacs').splitlines()
   return output
Example #3
0
  def load_config(self):
    s = sublime.load_settings(SETTINGS_FILE)
    use_rvm = s.get('check_for_rvm')
    use_rbenv = s.get('check_for_rbenv')
    self.rubocop_command = s.get('rubocop_command')
    rvm_auto_ruby_path = s.get('rvm_auto_ruby_path')
    rbenv_path = s.get('rbenv_path')

    self.runner = RubocopRunner(use_rbenv, use_rvm, self.rubocop_command, rvm_auto_ruby_path, rbenv_path)
    self.rubocop_command = self.runner.command_string() + ' {options} {path}'
Example #4
0
 def load_config(self):
   s = sublime.load_settings(SETTINGS_FILE)
   cfg_file = s.get('rubocop_config_file')
   if cfg_file:
     cfg_file = FileTools.quote(cfg_file)
   self.runner = RubocopRunner(
     {
       'use_rbenv': s.get('check_for_rbenv'),
       'use_rvm': s.get('check_for_rvm'),
       'custom_rubocop_cmd': s.get('rubocop_command'),
       'rvm_auto_ruby_path': s.get('rvm_auto_ruby_path'),
       'rbenv_path': s.get('rbenv_path'),
       'on_windows': self.on_windows(),
       'rubocop_config_file': cfg_file,
       'is_st2': self.is_st2()
     }
   )