Skip to content

Instantly share code, notes, and snippets.

@fand
Created December 22, 2017 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/594993a9ec0f59e1979e73d37a66b8ef to your computer and use it in GitHub Desktop.
Save fand/594993a9ec0f59e1979e73d37a66b8ef to your computer and use it in GitHub Desktop.
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