Module: RuboCop::MCP::SourceFiles Private
| Relationships & Source Files | |
| Defined in: | lib/rubocop/mcp/source_files.rb |
Overview
Reads and writes the files the tools work on. A file that can’t be read or written fails the request with an error the agent can act on.
Class Method Summary
- .read(file, config) Internal use only mod_func
-
.write(file, content)
Internal use only
mod_func
Writing what a file already holds would only bump its modification time.
Class Method Details
.read(file, config) (mod_func)
[ GitHub ].write(file, content) (mod_func)
Writing what a file already holds would only bump its modification time.
# File 'lib/rubocop/mcp/source_files.rb', line 20
def write(file, content) return if File.file?(file) && File.binread(file) == content.b Util.replace_file_contents(file, content) rescue Errno::EACCES raise RuboCop::Error, "Permission denied: #{file}" rescue Errno::EPERM raise RuboCop::Error, "Operation not permitted: #{file}" rescue Errno::ENOSPC raise RuboCop::Error, "No space left on device: #{file}" rescue Errno::EROFS raise RuboCop::Error, "Read-only file system: #{file}" end