goodcheck 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +37 -0
- data/CHANGELOG.md +4 -0
- data/README.md +107 -50
- data/Rakefile +20 -0
- data/benchmark/gc.c +12221 -0
- data/docusaurus/website/package.json +1 -1
- data/docusaurus/website/versions.json +1 -0
- data/docusaurus/website/yarn.lock +209 -115
- data/lib/goodcheck/buffer.rb +42 -1
- data/lib/goodcheck/commands/check.rb +1 -0
- data/lib/goodcheck/version.rb +1 -1
- metadata +5 -4
- data/.travis.yml +0 -11
    
        data/lib/goodcheck/buffer.rb
    CHANGED
    
    | @@ -3,6 +3,31 @@ module Goodcheck | |
| 3 3 | 
             
                attr_reader :path
         | 
| 4 4 | 
             
                attr_reader :content
         | 
| 5 5 |  | 
| 6 | 
            +
                DISABLE_LINE_PATTERNS = [
         | 
| 7 | 
            +
                  /\/\/ goodcheck-disable-line$/, #JS, Java, C, ...
         | 
| 8 | 
            +
                  /# goodcheck-disable-line$/, # Ruby, Python, PHP, ...
         | 
| 9 | 
            +
                  /-- goodcheck-disable-line$/, # Haskel, SQL, ...
         | 
| 10 | 
            +
                  /<!-- goodcheck-disable-line -->$/, # HTML, Markdown, ...
         | 
| 11 | 
            +
                  /\/* goodcheck-disable-line *\/$/, # CSS, SCSS, 
         | 
| 12 | 
            +
                  /<%# goodcheck-disable-line %>$/, # ERB, ...
         | 
| 13 | 
            +
                  /' goodcheck-disable-line$/, # VB
         | 
| 14 | 
            +
                ].freeze
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                DISABLE_NEXT_LINE_PATTERNS = [
         | 
| 17 | 
            +
                  /\/\/ goodcheck-disable-next-line$/, #JS, Java, C, ...
         | 
| 18 | 
            +
                  /# goodcheck-disable-next-line$/, # Ruby, Python, PHP, ...
         | 
| 19 | 
            +
                  /-- goodcheck-disable-next-line$/, # Haskel, SQL, ...
         | 
| 20 | 
            +
                  /<!-- goodcheck-disable-next-line -->$/, # HTML, Markdown, ...
         | 
| 21 | 
            +
                  /\/* goodcheck-disable-next-line *\/$/, # CSS, SCSS, 
         | 
| 22 | 
            +
                  /<%# goodcheck-disable-next-line %>$/, # ERB, ...
         | 
| 23 | 
            +
                  /' goodcheck-disable-next-line$/, # VB
         | 
| 24 | 
            +
                ].freeze
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                class << self
         | 
| 27 | 
            +
                    attr_accessor :DISABLE_LINE_PATTERNS
         | 
| 28 | 
            +
                    attr_accessor :DISABLE_NEXT_LINE_PATTERNS
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 6 31 | 
             
                def initialize(path:, content:)
         | 
| 7 32 | 
             
                  @path = path
         | 
| 8 33 | 
             
                  @content = content
         | 
| @@ -24,6 +49,18 @@ module Goodcheck | |
| 24 49 |  | 
| 25 50 | 
             
                  @line_ranges
         | 
| 26 51 | 
             
                end
         | 
| 52 | 
            +
                
         | 
| 53 | 
            +
                def line_disabled?(line_number)
         | 
| 54 | 
            +
                  if line_number > 1
         | 
| 55 | 
            +
                    return true if DISABLE_NEXT_LINE_PATTERNS.any? { |pattern| line(line_number - 1).match?(pattern) } 
         | 
| 56 | 
            +
                  end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
                  if line_number <= lines.length
         | 
| 59 | 
            +
                    return DISABLE_LINE_PATTERNS.any? { |pattern| line(line_number).match?(pattern) }
         | 
| 60 | 
            +
                  end
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                  return false
         | 
| 63 | 
            +
                end
         | 
| 27 64 |  | 
| 28 65 | 
             
                def location_for_position(position)
         | 
| 29 66 | 
             
                  line_index = line_ranges.bsearch_index do |range|
         | 
| @@ -35,8 +72,12 @@ module Goodcheck | |
| 35 72 | 
             
                  end
         | 
| 36 73 | 
             
                end
         | 
| 37 74 |  | 
| 75 | 
            +
                def lines
         | 
| 76 | 
            +
                  @lines ||= content.lines
         | 
| 77 | 
            +
                end
         | 
| 78 | 
            +
             | 
| 38 79 | 
             
                def line(line_number)
         | 
| 39 | 
            -
                   | 
| 80 | 
            +
                  lines[line_number-1]
         | 
| 40 81 | 
             
                end
         | 
| 41 82 |  | 
| 42 83 | 
             
                def position_for_location(line, column)
         | 
| @@ -36,6 +36,7 @@ module Goodcheck | |
| 36 36 | 
             
                          reporter.rule(rule) do
         | 
| 37 37 | 
             
                            analyzer = Analyzer.new(rule: rule, buffer: buffer, trigger: trigger)
         | 
| 38 38 | 
             
                            analyzer.scan do |issue|
         | 
| 39 | 
            +
                              next if issue.location && buffer.line_disabled?(issue.location.start_line)
         | 
| 39 40 | 
             
                              if reported_issues.add?(issue)
         | 
| 40 41 | 
             
                                issue_reported = true
         | 
| 41 42 | 
             
                                reporter.issue(issue)
         | 
    
        data/lib/goodcheck/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: goodcheck
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2. | 
| 4 | 
            +
              version: 2.5.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Soutaro Matsumoto
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2020-02-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -162,15 +162,16 @@ executables: | |
| 162 162 | 
             
            extensions: []
         | 
| 163 163 | 
             
            extra_rdoc_files: []
         | 
| 164 164 | 
             
            files:
         | 
| 165 | 
            +
            - ".github/workflows/test.yml"
         | 
| 165 166 | 
             
            - ".gitignore"
         | 
| 166 167 | 
             
            - ".rubocop.yml"
         | 
| 167 | 
            -
            - ".travis.yml"
         | 
| 168 168 | 
             
            - CHANGELOG.md
         | 
| 169 169 | 
             
            - Dockerfile
         | 
| 170 170 | 
             
            - Gemfile
         | 
| 171 171 | 
             
            - LICENSE
         | 
| 172 172 | 
             
            - README.md
         | 
| 173 173 | 
             
            - Rakefile
         | 
| 174 | 
            +
            - benchmark/gc.c
         | 
| 174 175 | 
             
            - bin/console
         | 
| 175 176 | 
             
            - bin/setup
         | 
| 176 177 | 
             
            - cheatsheet.pdf
         | 
| @@ -259,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 259 260 | 
             
                - !ruby/object:Gem::Version
         | 
| 260 261 | 
             
                  version: '0'
         | 
| 261 262 | 
             
            requirements: []
         | 
| 262 | 
            -
            rubygems_version: 3. | 
| 263 | 
            +
            rubygems_version: 3.1.2
         | 
| 263 264 | 
             
            signing_key: 
         | 
| 264 265 | 
             
            specification_version: 4
         | 
| 265 266 | 
             
            summary: Regexp based customizable linter
         |