rubocop-md 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 914629c131d136ea85643a2121decc4bfebb5213a6f5390a16c5fd6273ae632c
4
- data.tar.gz: 8b8bf3581a9b1217b1a8aa843d6719c0425c6555e1686036a3b6f2fd2c118e46
3
+ metadata.gz: 3456efa614f5cb4f801f7b8b247e53b42022adfcdbffd3fab4752f4698ce321b
4
+ data.tar.gz: ac12ebd0c7bed14a4c05afd24bd24f1e463ffa0541dcf8a55353f52fbe3c9afd
5
5
  SHA512:
6
- metadata.gz: 5feb50478f1924e6bd518505b88d196575eeeaf842cbecd653fd7dd3e2baaf35dcd2300b3489d826f970828440944f7e4b27c6225c62080081c08ab73b8568b9
7
- data.tar.gz: fee4f59f4ac8ff91a48f2de1f324ca3c4ac5d7041bfa54b3f61c1d2cadd7cfba9c22895146d68d9c11b84e0951500899a76a36b24e0bbe974f8969352e4264cf
6
+ metadata.gz: 5309505cbbf58587a74f8ea7c50435f9258163cbc9ba8e75fa6f4361a92c13d05fe401bec4f8cb7611d26cefdf9a9f9f2adad0e4e1395d000c7d4f0b44f4754b
7
+ data.tar.gz: 5cded0021d44ef0bdfb02279eefffd7eed20cf2c5c184c1de65fe9e2559fb86111ae09a96068a271c890f8d1d662c98a875d3d4f8e81af8840a5bfea99d5a1e9
@@ -0,0 +1,33 @@
1
+ name: Lint
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ rubocop:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ BUNDLE_JOBS: 4
14
+ BUNDLE_RETRY: 3
15
+ CI: true
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: actions/cache@v1
19
+ with:
20
+ path: /home/runner/bundle
21
+ key: bundle-lint-${{ hashFiles('Gemfile') }}-${{ hashFiles('**/*.gemspec') }}
22
+ restore-keys: |
23
+ bundle-lint-
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: 2.7
27
+ - name: Bundle install
28
+ run: |
29
+ bundle config path /home/runner/bundle
30
+ bundle install
31
+ - name: Run Rubocop
32
+ run: |
33
+ bundle exec rubocop
@@ -0,0 +1,34 @@
1
+ name: JRuby Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ BUNDLE_JOBS: 4
14
+ BUNDLE_RETRY: 3
15
+ CI: true
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+ - uses: actions/cache@v1
19
+ with:
20
+ path: /home/runner/bundle
21
+ key: bundle-${{ hashFiles('Gemfile') }}-${{ hashFiles('**/*.gemspec') }}
22
+ restore-keys: |
23
+ bundle-
24
+ - uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: jruby
27
+ - name: Bundle install
28
+ run: |
29
+ bundle config path /home/runner/bundle
30
+ bundle install
31
+ bundle update
32
+ - name: Run tests
33
+ run: |
34
+ bundle exec rake test
@@ -0,0 +1,49 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ env:
13
+ BUNDLE_JOBS: 4
14
+ BUNDLE_RETRY: 3
15
+ CI: true
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: ["2.7"]
20
+ gemfile: [
21
+ "Gemfile"
22
+ ]
23
+ include:
24
+ - ruby: "2.5"
25
+ gemfile: "Gemfile"
26
+ - ruby: "2.6"
27
+ gemfile: "Gemfile"
28
+ - ruby: "2.7"
29
+ gemfile: "gemfiles/rubocopmaster.gemfile"
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: actions/cache@v1
33
+ with:
34
+ path: /home/runner/bundle
35
+ key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
36
+ restore-keys: |
37
+ bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
38
+ - uses: ruby/setup-ruby@v1
39
+ with:
40
+ ruby-version: ${{ matrix.ruby }}
41
+ - name: Bundle install
42
+ run: |
43
+ bundle config path /home/runner/bundle
44
+ bundle config --global gemfile ${{ matrix.gemfile }}
45
+ bundle install
46
+ bundle update
47
+ - name: Run tests
48
+ run: |
49
+ bundle exec rake test
@@ -1,4 +1,5 @@
1
1
  AllCops:
2
+ NewCops: enable
2
3
  Include:
3
4
  - 'lib/**/*.rb'
4
5
  - 'lib/**/*.rake'
@@ -12,10 +13,8 @@ AllCops:
12
13
  - '*.gemspec'
13
14
  DisplayCopNames: true
14
15
  StyleGuideCopsOnly: false
15
- TargetRubyVersion: 2.3
16
-
17
- Rails:
18
- Enabled: false
16
+ TargetRubyVersion: 2.5
17
+ SuggestExtensions: false
19
18
 
20
19
  Style/Documentation:
21
20
  Exclude:
@@ -31,6 +30,15 @@ Style/ClassAndModuleChildren:
31
30
  Exclude:
32
31
  - 'test/**/*.rb'
33
32
 
33
+ Style/HashEachMethods:
34
+ Enabled: true
35
+
36
+ Style/HashTransformKeys:
37
+ Enabled: true
38
+
39
+ Style/HashTransformValues:
40
+ Enabled: true
41
+
34
42
  Layout/EmptyLinesAroundArguments:
35
43
  Enabled: false
36
44
 
@@ -41,7 +49,7 @@ Naming/FileName:
41
49
  Exclude:
42
50
  - 'lib/rubocop-md.rb'
43
51
 
44
- Metrics/LineLength:
52
+ Layout/LineLength:
45
53
  Max: 100
46
54
  Exclude:
47
55
  - 'test/**/*.rb'
@@ -2,8 +2,32 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.0.0 (2020-12-24)
6
+
7
+ - Drop Ruby 2.4 support and require RuboCop 1.0.
8
+
9
+ ## 0.4.1 (2020-11-05)
10
+
11
+ - Relax required RuboCop version.
12
+
13
+ ## 0.4.0 (2020-07-03)
14
+
15
+ - [#10](https://github.com/rubocop-hq/rubocop-md/pull/10): **Drop Ruby 2.3 support** ([@dominicsayers][])
16
+
17
+ ## 0.3.2 (2020-03-18)
18
+
19
+ - [#9](https://github.com/rubocop-hq/rubocop-md/pull/9): Add file extensions for Markdown ([@ybiquitous][])
20
+
21
+ ## 0.3.1 (2019-12-25)
22
+
23
+ - Upgrade to RuboCop 0.78 ([@palkan][])
24
+
25
+ Change the default config to use the new cop names for (e.g., `Layout/LineLength`).
26
+
5
27
  ## 0.3.0 (2019-05-14)
6
28
 
7
29
  - **Drop Ruby 2.2 support** ([@palkan][])
8
30
 
9
31
  [@palkan]: https://github.com/palkan
32
+ [@ybiquitous]: https://github.com/ybiquitous
33
+ [@dominicsayers]: https://github.com/dominicsayers
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017-2019 Vladimir Dementyev
3
+ Copyright (c) 2017-2021 Vladimir Dementyev
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rubocop-md.svg)](http://badge.fury.io/rb/rubocop-md)
2
- [![Travis Status](https://travis-ci.org/rubocop-hq/rubocop-md.svg?branch=master)](https://travis-ci.org/rubocop-hq/rubocop-md)
2
+ ![Test](https://github.com/rubocop-hq/rubocop-md/workflows/Test/badge.svg)
3
3
 
4
4
  # Rubocop Markdown
5
5
 
@@ -12,7 +12,7 @@ Run Rubocop against your Markdown files to make sure that code examples follow s
12
12
  - Preserves specified language (i.e., do not try to analyze "\`\`\`sh")
13
13
  - **Supports autocorrect 📝**
14
14
 
15
- This project was developed to keep [test-prof](https://github.com/palkan/test-prof) guides consistent with Ruby style guide.
15
+ This project was developed to keep [test-prof](https://github.com/test-prof/test-prof) guides consistent with Ruby style guide.
16
16
 
17
17
  ## Installation
18
18
 
@@ -126,7 +126,7 @@ end
126
126
 
127
127
  <span style="display:none;"># rubocop:enable all</span>
128
128
 
129
- ... continuation of article ...
129
+ ... continuation of article ...
130
130
  ```
131
131
 
132
132
  ## How it works?
@@ -145,13 +145,13 @@ end
145
145
 
146
146
  ## Development
147
147
 
148
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
148
+ After checking out the repo, run `bundle install` to install dependencies. Then, run `rake test` to run the tests.
149
149
 
150
150
  To install this gem onto your local machine, run `bundle exec rake install`.
151
151
 
152
152
  ## Contributing
153
153
 
154
- Bug reports and pull requests are welcome on GitHub at https://github.com/palkan/rubocop-md.
154
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop-hq/rubocop-md.
155
155
 
156
156
  ## License
157
157
 
@@ -17,11 +17,71 @@ Layout/TrailingBlankLines:
17
17
  - '**/*.md'
18
18
  - '**/*.markdown'
19
19
 
20
+ Layout/TrailingEmptyLines:
21
+ Exclude:
22
+ - '**/*.md'
23
+ - '**/*.markdown'
24
+
20
25
  Lint/UselessAssignment:
21
26
  Exclude:
22
27
  - '**/*.md'
23
28
  - '**/*.markdown'
24
29
 
30
+ Lint/DuplicateRequire:
31
+ Exclude:
32
+ - '**/*.md'
33
+ - '**/*.markdown'
34
+
35
+ Lint/DuplicateMethods:
36
+ Exclude:
37
+ - '**/*.md'
38
+ - '**/*.markdown'
39
+
40
+ Lint/RedundantCopDisableDirective:
41
+ Exclude:
42
+ - '**/*.md'
43
+ - '**/*.markdown'
44
+
45
+ Lint/RedundantCopEnableDirective:
46
+ Exclude:
47
+ - '**/*.md'
48
+ - '**/*.markdown'
49
+
50
+ Lint/RedundantRequireStatement:
51
+ Exclude:
52
+ - '**/*.md'
53
+ - '**/*.markdown'
54
+
55
+ Lint/UnusedMethodArgument:
56
+ Exclude:
57
+ - '**/*.md'
58
+ - '**/*.markdown'
59
+
60
+ Lint/UnusedBlockArgument:
61
+ Exclude:
62
+ - '**/*.md'
63
+ - '**/*.markdown'
64
+
65
+ Lint/UselessAssignment:
66
+ Exclude:
67
+ - '**/*.md'
68
+ - '**/*.markdown'
69
+
70
+ Lint/UselessMethodDefinition:
71
+ Exclude:
72
+ - '**/*.md'
73
+ - '**/*.markdown'
74
+
75
+ Lint/UselessAccessModifier:
76
+ Exclude:
77
+ - '**/*.md'
78
+ - '**/*.markdown'
79
+
80
+ Lint/Void:
81
+ Exclude:
82
+ - '**/*.md'
83
+ - '**/*.markdown'
84
+
25
85
  Naming/FileName:
26
86
  Exclude:
27
87
  - '**/*.md'
@@ -47,6 +107,6 @@ Style/FrozenStringLiteralComment:
47
107
  - '**/*.md'
48
108
  - '**/*.markdown'
49
109
 
50
- Metrics/LineLength:
110
+ Layout/LineLength:
51
111
  IgnoredPatterns:
52
112
  - !ruby/regexp /^\#/
@@ -73,8 +73,8 @@ module RuboCop
73
73
  walker = Walker.new
74
74
 
75
75
  parts.each do |part|
76
- if walker.code_body?
77
- next walker.next! if maybe_ruby?(@syntax) && valid_syntax?(@syntax, part)
76
+ if walker.code_body? && maybe_ruby?(@syntax) && valid_syntax?(@syntax, part)
77
+ next walker.next!
78
78
  end
79
79
 
80
80
  if walker.code_attr?
@@ -2,10 +2,24 @@
2
2
 
3
3
  module RuboCop
4
4
  module Markdown # :nodoc:
5
- MARKDOWN_EXTENSIONS = %w[.md .markdown].freeze
5
+ # According to Linguist.
6
+ # See https://github.com/github/linguist/blob/96ca71ab99c2f9928d5d69f4c08fd2a51440d045/lib/linguist/languages.yml#L3065-L3083
7
+ MARKDOWN_EXTENSIONS = %w[
8
+ .md
9
+ .markdown
10
+ .mdown
11
+ .mdwn
12
+ .mdx
13
+ .mkd
14
+ .mkdn
15
+ .mkdown
16
+ .ronn
17
+ .workbook
18
+ ].freeze
6
19
 
7
20
  class << self
8
21
  attr_accessor :config_store
22
+
9
23
  # Merge markdown config into default configuration
10
24
  # See https://github.com/backus/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
11
25
  def inject!
@@ -64,7 +78,7 @@ RuboCop::ProcessedSource.prepend(Module.new do
64
78
  def parse(src, *args)
65
79
  # only process Markdown files
66
80
  src = RuboCop::Markdown::Preprocess.new(path).call(src) if
67
- path.nil? || RuboCop::Markdown.markdown_file?(path)
81
+ path && RuboCop::Markdown.markdown_file?(path)
68
82
  super(src, *args)
69
83
  end
70
84
  end)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Markdown
5
- VERSION = "0.3.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -25,13 +25,13 @@ Gem::Specification.new do |spec|
25
25
  "source_code_uri" => "http://github.com/rubocop-hq/rubocop-md"
26
26
  }
27
27
 
28
- spec.required_ruby_version = ">= 2.3.0"
28
+ spec.required_ruby_version = ">= 2.5.0"
29
29
 
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_runtime_dependency "rubocop", "~> 0.60"
32
+ spec.add_runtime_dependency "rubocop", ">= 1.0"
33
33
 
34
34
  spec.add_development_dependency "bundler", ">= 1.15"
35
- spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rake", ">= 13.0"
36
36
  spec.add_development_dependency "minitest", "~> 5.0"
37
37
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-14 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.60'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.60'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -75,15 +75,16 @@ extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
77
  - ".gem_release.yml"
78
+ - ".github/workflows/lint.yml"
79
+ - ".github/workflows/test-jruby.yml"
80
+ - ".github/workflows/test.yml"
78
81
  - ".gitignore"
79
82
  - ".rubocop.yml"
80
- - ".travis.yml"
81
83
  - CHANGELOG.md
82
84
  - Gemfile
83
85
  - LICENSE.txt
84
86
  - README.md
85
87
  - Rakefile
86
- - bin/setup
87
88
  - config/default.yml
88
89
  - gemfiles/rubocopmaster.gemfile
89
90
  - lib/rubocop-md.rb
@@ -109,14 +110,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
110
  requirements:
110
111
  - - ">="
111
112
  - !ruby/object:Gem::Version
112
- version: 2.3.0
113
+ version: 2.5.0
113
114
  required_rubygems_version: !ruby/object:Gem::Requirement
114
115
  requirements:
115
116
  - - ">="
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  requirements: []
119
- rubygems_version: 3.0.3
120
+ rubygems_version: 3.0.6
120
121
  signing_key:
121
122
  specification_version: 4
122
123
  summary: Run Rubocop against your Markdown files to make sure that code examples follow
@@ -1,28 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- before_install:
4
- - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
5
- - gem install bundler -v '< 2'
6
-
7
- matrix:
8
- fast_finish: true
9
- include:
10
- - rvm: ruby-head
11
- gemfile: gemfiles/rubocopmaster.gemfile
12
- - rvm: jruby-9.1.0.0
13
- gemfile: Gemfile
14
- - rvm: 2.5.0
15
- gemfile: gemfiles/rubocopmaster.gemfile
16
- - rvm: 2.5.0
17
- gemfile: Gemfile
18
- - rvm: 2.4.2
19
- gemfile: Gemfile
20
- - rvm: 2.3.1
21
- gemfile: Gemfile
22
- allow_failures:
23
- - rvm: ruby-head
24
- gemfile: gemfiles/rubocopmaster.gemfile
25
- - rvm: jruby-9.1.0.0
26
- gemfile: Gemfile
27
- - rvm: 2.5.0
28
- gemfile: gemfiles/rubocopmaster.gemfile
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here