mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Add Lint/Typos
rule
This commit is contained in:
parent
9f6615bdfd
commit
0140fd3573
3 changed files with 132 additions and 0 deletions
32
spec/ameba/rule/lint/typos_spec.cr
Normal file
32
spec/ameba/rule/lint/typos_spec.cr
Normal file
|
@ -0,0 +1,32 @@
|
|||
require "../../../spec_helper"
|
||||
|
||||
private def check_typos_bin!
|
||||
unless Ameba::Rule::Lint::Typos::BIN_PATH
|
||||
pending! "`typos` executable is not available"
|
||||
end
|
||||
end
|
||||
|
||||
module Ameba::Rule::Lint
|
||||
subject = Typos.new
|
||||
.tap(&.fail_on_error = true)
|
||||
|
||||
describe Typos do
|
||||
it "reports typos" do
|
||||
check_typos_bin!
|
||||
|
||||
source = expect_issue subject, <<-CRYSTAL
|
||||
# method with no arugments
|
||||
# ^^^^^^^^^ error: Typo found: arugments -> arguments
|
||||
def tpos
|
||||
# ^^^^ error: Typo found: tpos -> typos
|
||||
end
|
||||
CRYSTAL
|
||||
|
||||
expect_correction source, <<-CRYSTAL
|
||||
# method with no arguments
|
||||
def typos
|
||||
end
|
||||
CRYSTAL
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue