mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Fix typos throughout the code
This commit is contained in:
		
							parent
							
								
									f9b6b17657
								
							
						
					
					
						commit
						95d68114c7
					
				
					 9 changed files with 26 additions and 26 deletions
				
			
		|  | @ -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 | ||||
|  |  | |||
|  | @ -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'}" | ||||
|       ) | ||||
|  |  | |||
|  | @ -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 %} | ||||
|  |  | |||
|  | @ -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| | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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}") | ||||
|  |  | |||
|  | @ -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: | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ module Ameba::Rule::Style | |||
|   # And should be rewritten to the following: | ||||
|   # | ||||
|   # ``` | ||||
|   # if s.emtpy? | ||||
|   # if s.empty? | ||||
|   #   :ok | ||||
|   # end | ||||
|   # ``` | ||||
|  |  | |||
|  | @ -90,7 +90,7 @@ module Ameba::Rule::Style | |||
|   # ``` | ||||
|   # Style/RedundantReturn: | ||||
|   #   Enabled: true | ||||
|   #   AllowMutliReturn: true | ||||
|   #   AllowMultiReturn: true | ||||
|   #   AllowEmptyReturn: true | ||||
|   # ``` | ||||
|   class RedundantReturn < Base | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue