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
 | 
			
		||||
        s = Source.new ""
 | 
			
		||||
        s.add_issue DummyRule.new,
 | 
			
		||||
                    Crystal::Location.new("path", 3, 3),
 | 
			
		||||
                    Crystal::Location.new("path", 5, 4),
 | 
			
		||||
                    "message"
 | 
			
		||||
          Crystal::Location.new("path", 3, 3),
 | 
			
		||||
          Crystal::Location.new("path", 5, 4),
 | 
			
		||||
          "message"
 | 
			
		||||
 | 
			
		||||
        result = get_result [s]
 | 
			
		||||
        end_location = result["sources"][0]["issues"][0]["end_location"]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,8 @@ module Ameba
 | 
			
		|||
    it "tokenizes #{str}" do
 | 
			
		||||
      ([] of Symbol).tap do |token_types|
 | 
			
		||||
        Tokenizer.new(Source.new str)
 | 
			
		||||
                 .run { |token| token_types << token.type }
 | 
			
		||||
                 .should be_true
 | 
			
		||||
          .run { |token| token_types << token.type }
 | 
			
		||||
          .should be_true
 | 
			
		||||
      end.should eq expected
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,7 @@ class Ameba::Config
 | 
			
		|||
  setter files : Array(String)?
 | 
			
		||||
  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.
 | 
			
		||||
  #
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,8 +51,8 @@ module Ameba::Formatter
 | 
			
		|||
    private def rule_todo(rule, issues)
 | 
			
		||||
      rule.excluded =
 | 
			
		||||
        issues.map(&.location.try &.filename.try &.to_s)
 | 
			
		||||
              .compact
 | 
			
		||||
              .uniq!
 | 
			
		||||
          .compact
 | 
			
		||||
          .uniq!
 | 
			
		||||
 | 
			
		||||
      {rule.name => rule}.to_yaml
 | 
			
		||||
    end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,9 +39,9 @@ module Ameba::Rule::Lint
 | 
			
		|||
 | 
			
		||||
    private def duplicated_keys(entries)
 | 
			
		||||
      entries.map(&.key)
 | 
			
		||||
             .group_by(&.itself)
 | 
			
		||||
             .select { |_, v| v.size > 1 }
 | 
			
		||||
             .map { |k, _| k }
 | 
			
		||||
        .group_by(&.itself)
 | 
			
		||||
        .select { |_, v| v.size > 1 }
 | 
			
		||||
        .map { |k, _| k }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +43,7 @@ module Ameba
 | 
			
		|||
 | 
			
		||||
      @unneeded_disable_directive_rule =
 | 
			
		||||
        config.rules
 | 
			
		||||
              .find &.name.==(Rule::Lint::UnneededDisableDirective.rule_name)
 | 
			
		||||
          .find &.name.==(Rule::Lint::UnneededDisableDirective.rule_name)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    # :nodoc:
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +106,7 @@ module Ameba
 | 
			
		|||
        wildcard += "/**/*.cr" if File.directory?(wildcard)
 | 
			
		||||
        Dir[wildcard]
 | 
			
		||||
      end.flatten
 | 
			
		||||
         .map { |path| Source.new File.read(path), path }
 | 
			
		||||
        .map { |path| Source.new File.read(path), path }
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,8 +52,8 @@ module Ameba
 | 
			
		|||
    def ast
 | 
			
		||||
      @ast ||=
 | 
			
		||||
        Crystal::Parser.new(code)
 | 
			
		||||
                       .tap { |parser| parser.filename = @path }
 | 
			
		||||
                       .parse
 | 
			
		||||
          .tap { |parser| parser.filename = @path }
 | 
			
		||||
          .parse
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def fullpath
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue