Skip to content

Commit

Permalink
Merge pull request #306 from crystal-ameba/Sija/fix-typos
Browse files Browse the repository at this point in the history
Fix typos throughout the code
  • Loading branch information
Sija committed Nov 16, 2022
2 parents f9b6b17 + 95d6811 commit 2430717
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion spec/ameba/config_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ module Ameba
config.sources.any?(&.fullpath.==(__FILE__)).should be_true
end

it "returns a list of sources mathing globs" do
it "returns a list of sources matching globs" do
config.globs = %w(**/config_spec.cr)
config.sources.size.should eq(1)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/ameba/rule/lint/redundant_string_cercion_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ module Ameba::Rule::Lint
describe RedundantStringCoercion do
subject = RedundantStringCoercion.new

it "does not report if there is no redundant string coersion" do
it "does not report if there is no redundant string coercion" do
s = Source.new %(
"Hello, #{name}"
)
subject.catch(s).should be_valid
end

it "reports if there is a redundant string coersion" do
it "reports if there is a redundant string coercion" do
s = Source.new %q(
"Hello, #{name.to_s}"
)
subject.catch(s).should_not be_valid
end

it "does not report if coersion is used in binary op" do
it "does not report if coercion is used in binary op" do
s = Source.new %q(
"Hello, #{3.to_s + 's'}"
)
Expand Down
16 changes: 8 additions & 8 deletions spec/ameba/rule/lint/useless_assign_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Ameba::Rule::Lint
describe UselessAssign do
subject = UselessAssign.new

it "does not report used assigments" do
it "does not report used assignments" do
s = Source.new %(
def method
a = 2
Expand Down Expand Up @@ -54,7 +54,7 @@ module Ameba::Rule::Lint
subject.catch(s).should_not be_valid
end

it "does not report ignored assigments" do
it "does not report ignored assignments" do
s = Source.new %(
payload, _header = decode
puts payload
Expand Down Expand Up @@ -859,7 +859,7 @@ module Ameba::Rule::Lint
end

context "typeof" do
it "reports useless assigments in typeof" do
it "reports useless assignments in typeof" do
s = Source.new %(
typeof(begin
foo = 1
Expand Down Expand Up @@ -944,7 +944,7 @@ module Ameba::Rule::Lint
subject.catch(s).should be_valid
end

it "doesn't report if assignement is referenced in for macro in exp" do
it "doesn't report if assignment is referenced in for macro in exp" do
s = Source.new %(
foo = 22
Expand All @@ -955,7 +955,7 @@ module Ameba::Rule::Lint
subject.catch(s).should be_valid
end

it "doesn't report if assignement is referenced in for macro in body" do
it "doesn't report if assignment is referenced in for macro in body" do
s = Source.new %(
foo = 22
Expand All @@ -966,7 +966,7 @@ module Ameba::Rule::Lint
subject.catch(s).should be_valid
end

it "doesn't report if assignement is referenced in if macro in cond" do
it "doesn't report if assignment is referenced in if macro in cond" do
s = Source.new %(
foo = 22
{% if "foo".id %}
Expand All @@ -975,7 +975,7 @@ module Ameba::Rule::Lint
subject.catch(s).should be_valid
end

it "doesn't report if assignement is referenced in if macro in then" do
it "doesn't report if assignment is referenced in if macro in then" do
s = Source.new %(
foo = 22
{% if true %}
Expand All @@ -985,7 +985,7 @@ module Ameba::Rule::Lint
subject.catch(s).should be_valid
end

it "doesn't report if assignement is referenced in if macro in else" do
it "doesn't report if assignment is referenced in if macro in else" do
s = Source.new %(
foo = 22
{% if true %}
Expand Down
2 changes: 1 addition & 1 deletion spec/ameba/rule/style/redundant_next_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ module Ameba::Rule::Style
end
end

context "expception handler" do
context "exception handler" do
it "doesn't report if there is no redundant next in exception handler" do
expect_no_issues subject, <<-CRYSTAL
block do |v|
Expand Down
18 changes: 9 additions & 9 deletions spec/ameba/severity_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module Ameba
end
end

struct SeverityConvertable
struct SeverityConvertible
include YAML::Serializable

@[YAML::Field(converter: Ameba::SeverityYamlConverter)]
Expand All @@ -52,53 +52,53 @@ module Ameba
describe ".from_yaml" do
it "converts from yaml to Severity::Error" do
yaml = {severity: "error"}.to_yaml
converted = SeverityConvertable.from_yaml(yaml)
converted = SeverityConvertible.from_yaml(yaml)
converted.severity.should eq Severity::Error
end

it "converts from yaml to Severity::Warning" do
yaml = {severity: "warning"}.to_yaml
converted = SeverityConvertable.from_yaml(yaml)
converted = SeverityConvertible.from_yaml(yaml)
converted.severity.should eq Severity::Warning
end

it "converts from yaml to Severity::Convention" do
yaml = {severity: "convention"}.to_yaml
converted = SeverityConvertable.from_yaml(yaml)
converted = SeverityConvertible.from_yaml(yaml)
converted.severity.should eq Severity::Convention
end

it "raises if severity is not a scalar" do
yaml = {severity: {convention: true}}.to_yaml
expect_raises(Exception, "Severity must be a scalar") do
SeverityConvertable.from_yaml(yaml)
SeverityConvertible.from_yaml(yaml)
end
end

it "raises if severity has a wrong type" do
yaml = {severity: [1, 2, 3]}.to_yaml
expect_raises(Exception, "Severity must be a scalar") do
SeverityConvertable.from_yaml(yaml)
SeverityConvertible.from_yaml(yaml)
end
end
end

describe ".to_yaml" do
it "converts Severity::Error to yaml" do
yaml = {severity: "error"}.to_yaml
converted = SeverityConvertable.from_yaml(yaml).to_yaml
converted = SeverityConvertible.from_yaml(yaml).to_yaml
converted.should eq "---\nseverity: Error\n"
end

it "converts Severity::Warning to yaml" do
yaml = {severity: "warning"}.to_yaml
converted = SeverityConvertable.from_yaml(yaml).to_yaml
converted = SeverityConvertible.from_yaml(yaml).to_yaml
converted.should eq "---\nseverity: Warning\n"
end

it "converts Severity::Convention to yaml" do
yaml = {severity: "convention"}.to_yaml
converted = SeverityConvertable.from_yaml(yaml).to_yaml
converted = SeverityConvertible.from_yaml(yaml).to_yaml
converted.should eq "---\nseverity: Convention\n"
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/ameba/ast/scope.cr
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module Ameba::AST
!!outer_scope.try(&.in_macro?)
end

# Returns `true` if instance variable is assinged in this scope.
# Returns `true` if instance variable is assigned in this scope.
def assigns_ivar?(name)
arguments.find(&.name.== name) &&
ivariables.find(&.name.== "@#{name}")
Expand Down
2 changes: 1 addition & 1 deletion src/ameba/rule/lint/shared_var_in_fiber.cr
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module Ameba::Rule::Lint
# during iterations. So it reports the issue on the first sample and passes on
# the second one.
#
# There are also other technics to solve the problem above which are
# There are also other techniques to solve the problem above which are
# [officially documented](https://crystal-lang.org/reference/guides/concurrency.html)
#
# YAML configuration example:
Expand Down
2 changes: 1 addition & 1 deletion src/ameba/rule/style/negated_conditions_in_unless.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Ameba::Rule::Style
# And should be rewritten to the following:
#
# ```
# if s.emtpy?
# if s.empty?
# :ok
# end
# ```
Expand Down
2 changes: 1 addition & 1 deletion src/ameba/rule/style/redundant_return.cr
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module Ameba::Rule::Style
# ```
# Style/RedundantReturn:
# Enabled: true
# AllowMutliReturn: true
# AllowMultiReturn: true
# AllowEmptyReturn: true
# ```
class RedundantReturn < Base
Expand Down

0 comments on commit 2430717

Please sign in to comment.