mirror of
				https://gitea.invidious.io/iv-org/shard-ameba.git
				synced 2024-08-15 00:53:29 +00:00 
			
		
		
		
	Apply default formatting
This commit is contained in:
		
							parent
							
								
									bbb0cf51e7
								
							
						
					
					
						commit
						f4680a75f4
					
				
					 7 changed files with 15 additions and 15 deletions
				
			
		| 
						 | 
					@ -58,9 +58,9 @@ module Ameba
 | 
				
			||||||
      it "shows issue end_location" do
 | 
					      it "shows issue end_location" do
 | 
				
			||||||
        s = Source.new ""
 | 
					        s = Source.new ""
 | 
				
			||||||
        s.add_issue DummyRule.new,
 | 
					        s.add_issue DummyRule.new,
 | 
				
			||||||
                    Crystal::Location.new("path", 3, 3),
 | 
					          Crystal::Location.new("path", 3, 3),
 | 
				
			||||||
                    Crystal::Location.new("path", 5, 4),
 | 
					          Crystal::Location.new("path", 5, 4),
 | 
				
			||||||
                    "message"
 | 
					          "message"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        result = get_result [s]
 | 
					        result = get_result [s]
 | 
				
			||||||
        end_location = result["sources"][0]["issues"][0]["end_location"]
 | 
					        end_location = result["sources"][0]["issues"][0]["end_location"]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,8 +5,8 @@ module Ameba
 | 
				
			||||||
    it "tokenizes #{str}" do
 | 
					    it "tokenizes #{str}" do
 | 
				
			||||||
      ([] of Symbol).tap do |token_types|
 | 
					      ([] of Symbol).tap do |token_types|
 | 
				
			||||||
        Tokenizer.new(Source.new str)
 | 
					        Tokenizer.new(Source.new str)
 | 
				
			||||||
                 .run { |token| token_types << token.type }
 | 
					          .run { |token| token_types << token.type }
 | 
				
			||||||
                 .should be_true
 | 
					          .should be_true
 | 
				
			||||||
      end.should eq expected
 | 
					      end.should eq expected
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@ class Ameba::Config
 | 
				
			||||||
  setter files : Array(String)?
 | 
					  setter files : Array(String)?
 | 
				
			||||||
  getter rules : Array(Rule::Base)
 | 
					  getter rules : Array(Rule::Base)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @rule_groups: Hash(String, Array(Rule::Base))
 | 
					  @rule_groups : Hash(String, Array(Rule::Base))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # Creates a new instance of `Ameba::Config` based on YAML parameters.
 | 
					  # Creates a new instance of `Ameba::Config` based on YAML parameters.
 | 
				
			||||||
  #
 | 
					  #
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,8 +51,8 @@ module Ameba::Formatter
 | 
				
			||||||
    private def rule_todo(rule, issues)
 | 
					    private def rule_todo(rule, issues)
 | 
				
			||||||
      rule.excluded =
 | 
					      rule.excluded =
 | 
				
			||||||
        issues.map(&.location.try &.filename.try &.to_s)
 | 
					        issues.map(&.location.try &.filename.try &.to_s)
 | 
				
			||||||
              .compact
 | 
					          .compact
 | 
				
			||||||
              .uniq!
 | 
					          .uniq!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      {rule.name => rule}.to_yaml
 | 
					      {rule.name => rule}.to_yaml
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,9 +39,9 @@ module Ameba::Rule::Lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private def duplicated_keys(entries)
 | 
					    private def duplicated_keys(entries)
 | 
				
			||||||
      entries.map(&.key)
 | 
					      entries.map(&.key)
 | 
				
			||||||
             .group_by(&.itself)
 | 
					        .group_by(&.itself)
 | 
				
			||||||
             .select { |_, v| v.size > 1 }
 | 
					        .select { |_, v| v.size > 1 }
 | 
				
			||||||
             .map { |k, _| k }
 | 
					        .map { |k, _| k }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,7 +43,7 @@ module Ameba
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      @unneeded_disable_directive_rule =
 | 
					      @unneeded_disable_directive_rule =
 | 
				
			||||||
        config.rules
 | 
					        config.rules
 | 
				
			||||||
              .find &.name.==(Rule::Lint::UnneededDisableDirective.rule_name)
 | 
					          .find &.name.==(Rule::Lint::UnneededDisableDirective.rule_name)
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # :nodoc:
 | 
					    # :nodoc:
 | 
				
			||||||
| 
						 | 
					@ -106,7 +106,7 @@ module Ameba
 | 
				
			||||||
        wildcard += "/**/*.cr" if File.directory?(wildcard)
 | 
					        wildcard += "/**/*.cr" if File.directory?(wildcard)
 | 
				
			||||||
        Dir[wildcard]
 | 
					        Dir[wildcard]
 | 
				
			||||||
      end.flatten
 | 
					      end.flatten
 | 
				
			||||||
         .map { |path| Source.new File.read(path), path }
 | 
					        .map { |path| Source.new File.read(path), path }
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,8 +52,8 @@ module Ameba
 | 
				
			||||||
    def ast
 | 
					    def ast
 | 
				
			||||||
      @ast ||=
 | 
					      @ast ||=
 | 
				
			||||||
        Crystal::Parser.new(code)
 | 
					        Crystal::Parser.new(code)
 | 
				
			||||||
                       .tap { |parser| parser.filename = @path }
 | 
					          .tap { |parser| parser.filename = @path }
 | 
				
			||||||
                       .parse
 | 
					          .parse
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def fullpath
 | 
					    def fullpath
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue