From 95d68114c7d8662b17d85b35e53a1993f4f6e0b8 Mon Sep 17 00:00:00 2001 From: Sijawusz Pur Rahnama Date: Wed, 16 Nov 2022 16:55:32 +0100 Subject: [PATCH] Fix typos throughout the code --- spec/ameba/config_spec.cr | 2 +- .../rule/lint/redundant_string_cercion_spec.cr | 6 +++--- spec/ameba/rule/lint/useless_assign_spec.cr | 16 ++++++++-------- spec/ameba/rule/style/redundant_next_spec.cr | 2 +- spec/ameba/severity_spec.cr | 18 +++++++++--------- src/ameba/ast/scope.cr | 2 +- src/ameba/rule/lint/shared_var_in_fiber.cr | 2 +- .../rule/style/negated_conditions_in_unless.cr | 2 +- src/ameba/rule/style/redundant_return.cr | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/spec/ameba/config_spec.cr b/spec/ameba/config_spec.cr index 86b111eb..c5f82631 100644 --- a/spec/ameba/config_spec.cr +++ b/spec/ameba/config_spec.cr @@ -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 diff --git a/spec/ameba/rule/lint/redundant_string_cercion_spec.cr b/spec/ameba/rule/lint/redundant_string_cercion_spec.cr index cacb74e0..f60defe6 100644 --- a/spec/ameba/rule/lint/redundant_string_cercion_spec.cr +++ b/spec/ameba/rule/lint/redundant_string_cercion_spec.cr @@ -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'}" ) diff --git a/spec/ameba/rule/lint/useless_assign_spec.cr b/spec/ameba/rule/lint/useless_assign_spec.cr index 5b7e06ac..2f67281c 100644 --- a/spec/ameba/rule/lint/useless_assign_spec.cr +++ b/spec/ameba/rule/lint/useless_assign_spec.cr @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 %} @@ -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 %} @@ -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 %} diff --git a/spec/ameba/rule/style/redundant_next_spec.cr b/spec/ameba/rule/style/redundant_next_spec.cr index 689894d1..47fcec2d 100644 --- a/spec/ameba/rule/style/redundant_next_spec.cr +++ b/spec/ameba/rule/style/redundant_next_spec.cr @@ -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| diff --git a/spec/ameba/severity_spec.cr b/spec/ameba/severity_spec.cr index cf63c133..633372b0 100644 --- a/spec/ameba/severity_spec.cr +++ b/spec/ameba/severity_spec.cr @@ -41,7 +41,7 @@ module Ameba end end - struct SeverityConvertable + struct SeverityConvertible include YAML::Serializable @[YAML::Field(converter: Ameba::SeverityYamlConverter)] @@ -52,33 +52,33 @@ 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 @@ -86,19 +86,19 @@ module Ameba 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 diff --git a/src/ameba/ast/scope.cr b/src/ameba/ast/scope.cr index 4a114930..34be5b59 100644 --- a/src/ameba/ast/scope.cr +++ b/src/ameba/ast/scope.cr @@ -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}") diff --git a/src/ameba/rule/lint/shared_var_in_fiber.cr b/src/ameba/rule/lint/shared_var_in_fiber.cr index 69bb8b38..2a2bd16e 100644 --- a/src/ameba/rule/lint/shared_var_in_fiber.cr +++ b/src/ameba/rule/lint/shared_var_in_fiber.cr @@ -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: diff --git a/src/ameba/rule/style/negated_conditions_in_unless.cr b/src/ameba/rule/style/negated_conditions_in_unless.cr index 653a574b..62e477f7 100644 --- a/src/ameba/rule/style/negated_conditions_in_unless.cr +++ b/src/ameba/rule/style/negated_conditions_in_unless.cr @@ -12,7 +12,7 @@ module Ameba::Rule::Style # And should be rewritten to the following: # # ``` - # if s.emtpy? + # if s.empty? # :ok # end # ``` diff --git a/src/ameba/rule/style/redundant_return.cr b/src/ameba/rule/style/redundant_return.cr index 329fab76..7a020073 100644 --- a/src/ameba/rule/style/redundant_return.cr +++ b/src/ameba/rule/style/redundant_return.cr @@ -90,7 +90,7 @@ module Ameba::Rule::Style # ``` # Style/RedundantReturn: # Enabled: true - # AllowMutliReturn: true + # AllowMultiReturn: true # AllowEmptyReturn: true # ``` class RedundantReturn < Base