Composes a helpful lint message based on the original filename
 and the config options.

 @param orig_filename [String] the original filename
 @return [String] the helpful  lint message
486742
def compose_message(orig_filename)
      orig_basename = File.basename(orig_filename)
      fixed_basename = orig_basename

      if config['leading_underscore']
        fixed_basename = '_' + fixed_basename unless fixed_basename.start_with?('_')
      else
        fixed_basename = fixed_basename.sub(/^_/, '')
      end

      if config['filename_extension']
        fixed_basename += '.scss' unless fixed_basename.end_with?('.scss')
      else
        fixed_basename = fixed_basename.sub(/\.scss$/, '')
      end

      fixed_filename = orig_filename.sub(/(.*)#{Regexp.quote(orig_basename)}/,
                                         "\\1#{fixed_basename}")
      "Imported partial `#{orig_filename}` should be written as `#{fixed_filename}`"
    end
553287
def _wrapture(orig):
    

#    @functools.wraps(orig)
    def foo(*args):
        obj = args[0]
        obj.on_modify()
        return orig(*args)
    return foo
594731
def parser
      @parser = OptionParser.new do |opts|
        opts.banner = 'Usage: obfusc <command> <arguments> <options>'
        opts.separator ''
        opts.separator 'Commands:'
        VALID_COMMANDS.each do |command|
          opts.separator "    * #{command}"
        end

        opts.separator ''
        opts.separator 'Specific options:'

        opts.on('-c', '--config FILENAME',
                'Using a different ".obfusc.cnf" filename') do |filename|
          @options[:config_path] = filename
        end

        opts.on(
          '-e',
          '--extension STRING',
          'Specify a custom file extension. (Default to "obfc")'
        ) do |extension|
          @options[:extension] = extension
        end

        opts.on(
          '-p',
          '--prefix STRING',
          'Specify a custom file prefix. (Default to "obfc")'
        ) do |prefix|
          @options[:prefix] = prefix
        end

        opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v|
          @options[:verbose] = v
        end

        opts.on(
          '-s',
          '--[no-]simulate',
          'Do a simulate run without executing actions'
        ) do |v|
          @options[:simulate] = v
        end

        opts.separator ''
        opts.separator 'Common options:'

        opts.on_tail('-h', '--help', 'Show this message') do
          puts opts
          exit
        end
      end
    end
1132683
def parse(args)
      @options = {}

      OptionParser.new do |parser|
        parser.banner = "Usage: #{APP_NAME} [options] [file1, file2, ...]"

        add_linter_options parser
        add_report_options parser
        add_file_options parser
        add_logger_options parser
        add_info_options parser
      end.parse!(args)

      # Any remaining arguments are assumed to be files
      @options[:files] = args.empty? ? ['.'] : args

      @options
    rescue OptionParser::InvalidOption => e
      raise Exceptions::InvalidCLIOption, e.message, e.backtrace
    end
125279
def _extract_options(orig_script):
        
        first = (orig_script + '\n').splitlines()[0]
        match = _first_line_re().match(first)
        options = match.group(1) or '' if match else ''
        return options.strip()
1227194
def finished_file(file, lints)
      super

      if lints.any?
        lints.each do |lint|
          linters_with_lints[lint.linter.name] |= [lint.filename]
          linters_lint_count[lint.linter.name] += 1
        end
      end
    end
685011
def name=(filename)
      @dirty = true
      # dot and double dot are special cases (no processing please).
      if filename != "." and filename != ".."
        if filename.size > 12 || (not filename.include?(".") && filename.size > 8)
          mkLongName(filename)
          @name = self.longName
        else
          @dir_ent['name'] = mkSfn(filename)
          @name = self.shortName
        end
      else
        @dir_ent['name']= filename.ljust(11)
        @name = filename
      end
    end
1336028
def syntax_error!(message)
      raise SyntaxError.new(message, options[:file], @orig_line, @lineno,
                            @orig_line && @line ? @orig_line.size - @line.size : 0)
    rescue SyntaxError => ex
      # HACK: Manipulate stacktrace for Rails and other frameworks
      # to find the right file.
      ex.backtrace.unshift "#{options[:file]}:#{@lineno}"
      raise
    end
1215358
public static String getSafeFileName(String orig)
  {
    if (orig != null)
    {
      return orig.replaceAll("[^0-9A-Za-z-]", "_");
    }
    else
    {
      return UUID.randomUUID().toString();
    }
  }
1361605
def clean_path_to(file, options = {})
      # Allow individual calls to this method to specify additional custom load paths to consider
      if options[:load_paths]
        [options[:load_paths]].each do |root|
          if File.exist?("#{root}/#{file}")
            return Pathname.new("#{root}/#{file}")
          end
        end
      end
      if File.exist?(file)
        if Pathname.new(file).absolute?
          Pathname.new(file)
        else
          Pathname.new("#{Pathname.pwd}/#{file}")
        end
      # Is it a relative reference within a list file?
      elsif @last_opened_list_dir && File.exist?("#{@last_opened_list_dir}/#{file}")
        Pathname.new("#{@last_opened_list_dir}/#{file}")
      # Is it a relative reference to the current base directory?
      elsif File.exist?("#{base_directory}/#{file}")
        Pathname.new("#{base_directory}/#{file}")
      # Is it a path relative to Origen.root?
      elsif File.exist?("#{Origen.root}/#{file}")
        Pathname.new("#{Origen.root}/#{file}")
      # Is it a path relative to the current directory?
      elsif current_directory && File.exist?("#{current_directory}/#{file}")
        Pathname.new("#{current_directory}/#{file}")
      # Is it a path relative to the current plugin's Origen.root?
      elsif Origen.app.plugins.current && File.exist?("#{Origen.app.plugins.current.root}/#{file}")
        Pathname.new("#{Origen.app.plugins.current.root}/#{file}")
      elsif options[:default_dir]
        m = all_matches(file, options)
        if m
          Pathname.new(m)
        else
          if options[:allow_missing]
            return nil
          else
            fail "Can't find: #{file}"
          end
        end
      else
        if options[:allow_missing]
          return nil
        else
          fail "Can't find: #{file}"
        end
      end
    end
763185
def output_file(file = nil)
      if file
        output_filename = file.name
        if !@config.output_filename.nil? && @files.length == 1
          output_filename = @config.output_filename
        end
      else
        output_filename = Time.now.to_s.split(' ').join('_')
        output_filename = @files.last.name if @files.length == 1 || @config.merge
        output_filename = @config.output_filename unless @config.output_filename.nil?
      end

      ::File.join(output_dir, "#{output_filename}.pdf")
    end
209914
def file_or_filename(input):
    
    if isinstance(input, string_types):
        # input was a filename: open as file
        yield smart_open(input)
    else:
        # input already a file-like object; just reset to the beginning
        input.seek(0)
        yield input
618292
def lint
      config.javascript_files.each do |file|
        file_content = get_file_content_as_json(file)
        code = %(
          JSHINT(#{file_content}, #{jshint_options}, #{jshint_globals});
          return JSHINT.errors;
        )
        errors[file] = context.exec(code)
      end
    end
1114061
def run_linter(linter, engine, file_path)
      return if @config.excluded_file_for_linter?(file_path, linter)
      @lints += linter.run(engine, @config.linter_options(linter))
    end
611262
def call_orig(self, *args, **kwargs):
        '''
        
        '''
        rval = super(StubNew, self).call_orig(self._type)
        rval.__init__(*args, **kwargs)
        return rval
431210
function processText(text, filename, options) {

    var filePath,
        messages,
        stats;

    if (filename) {
        filePath = path.resolve(filename);
    }

    filename = filename || "<text>";
    debug("Linting " + filename);


    messages = bemlint.verify(text, lodash.assign(Object.create(null), {
        filename: filename
    }, options));

    stats = calculateStatsPerFile(messages);

    var result = {
        filePath: filename,
        messages: messages,
        errorCount: stats.errorCount,
        warningCount: stats.warningCount
    };

    return result;
}
200525
def lint
      lint_results
        .reject { |r| r.nil? || r['messages'].length.zero? }
        .reject { |r| r['messages'].first['message'].include? 'matching ignore pattern' }
        .map { |r| send_comment r }
    end