Skip to content

Instantly share code, notes, and snippets.

@fand fand/.anylintrc
Created Dec 22, 2017

Embed
What would you like to do?
anylint sample
{
".pl": {
"~/bin/anylint/blank.pl": 2,
},
}
# anylint使い方
1. Atomで [linter-anylint](https://github.com/fand/linter-anylint) をインストール
2. .anylintrc を `~/.anylintrc` に配置
3. blank.pl を `~/bin/anylint/blank.pl` に配置
4. `chmod +x ~/bin/anylint/blank.pl`
これで `.pl` ファイルで連続する改行がハイライトされます
#!/usr/bin/env perl
# This rule disallows more than 2 blank lines
use strict;
use warnings;
use JSON;
use v5.010;
my $errors = [];
my $linenum = 1;
my $lastline = 'DUMMY';
while (<>) {
my $line = $_;
if ($line =~ /^\s*$/ && $lastline =~ /^\s*$/) {
push @$errors, {
line => $linenum,
column => 1,
message => 'Too many blank lines!',
ruleId => 'no-multiple-blank-lines',
}
}
$linenum++;
$lastline = $line;
}
say encode_json($errors);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.