Let's re-organize linter file code to a common structure that shouldn't be mandatory, but we can rewrite files into so people who copy and paste existing linter code will be more likely to write shorter linter definition files. We can step through the following rules from 1 to n logically to reduce the amount of code down the minimum it needs to be.
Prefer writing linter functions in ale_linters files instead of handlers when they don't need to shared across multiple files.
Prefer ale#Pad for adding options to a command string where possible.
Prefer %e to get and escape the executable name in commands where possible.
Prefer lambdas for executable functions where the command doesn't need the executable except through %e.
Fix the lack of ale#Escape for executable names where seen.
Prefer lambdas for command where possible, and use the variable name b for the buffer argument.
Prefer strings for executables where a function is not needed.
Prefer strings for commands where a function is not needed.
Order functions in linter files in the order Handle, then GetExecutable, then GetCommand.
Maybe put s: variables in linter files after Handle.
Ensure ale#Set calls are used in linter files mostly for options, and they appear at the top of files.
I do not want to make this a set of rules to follow for a pull request. I just want to do a single pass through the codebase this time and forget about it. I much prefer to just accept working code, even if overly verbose, and to compress it down later on.
Let's re-organize linter file code to a common structure that shouldn't be mandatory, but we can rewrite files into so people who copy and paste existing linter code will be more likely to write shorter linter definition files. We can step through the following rules from 1 to n logically to reduce the amount of code down the minimum it needs to be.
ale_linters
files instead ofhandlers
when they don't need to shared across multiple files.ale#Pad
for adding options to a command string where possible.%e
to get and escape the executable name in commands where possible.executable
functions where the command doesn't need the executable except through%e
.ale#Escape
for executable names where seen.command
where possible, and use the variable nameb
for the buffer argument.Handle
, thenGetExecutable
, thenGetCommand
.s:
variables in linter files afterHandle
.ale#Set
calls are used in linter files mostly for options, and they appear at the top of files.I do not want to make this a set of rules to follow for a pull request. I just want to do a single pass through the codebase this time and forget about it. I much prefer to just accept working code, even if overly verbose, and to compress it down later on.