danger-spelling 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c00f343a9b9ba9b4c615a3ff5581e9d17193fc8da79167ee9b664384e926bfe1
4
+ data.tar.gz: cdd9b031a3167fc8428c9dc7f7d36f75ee6be0b62b04a10669588ab08bbd5f90
5
+ SHA512:
6
+ metadata.gz: aea7441a74f7cd79bd26959ba900094dc497442ab0c8924293037f65679760af2454ddbe83b00edf18dadc8d3803c7f36194356f9aaddda24007a0688457ab3a
7
+ data.tar.gz: 28ad9975295d71e8365607f90cbe6a66930e87930d398d7e94d7ec214216ac5a78e6fe4ad433285d9b840157f237ea18d5aeb8978b432a6da9554c16bc7c4293
@@ -0,0 +1,26 @@
1
+ name: Branch Checks
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ danger:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+
15
+ - uses: actions/setup-ruby@v1
16
+ with:
17
+ ruby-version: '2.6'
18
+
19
+ - name: Danger Report
20
+ run: |
21
+ gem install bundler
22
+ bundle install --jobs 4 --retry 3
23
+ bundle exec danger
24
+ timeout-minutes: 10
25
+ env:
26
+ DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .yardoc
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ Style/FrozenStringLiteralComment:
2
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ## Changelog
2
+
3
+ ### 0.0.1 - Next
4
+
5
+ * Your contribution here.
6
+
7
+ * Implelemted pyspelling as a danger plugin - [@HamstringAssassin](https://github.com/HamstringAssassin).
data/Dangerfile ADDED
@@ -0,0 +1,10 @@
1
+ gemfile_updated = !git.modified_files.grep(/Gemfile/).empty?
2
+
3
+ # Leave warning, if Gemfile changes
4
+ warn 'The `Gemfile` was updated' if gemfile_updated
5
+
6
+ # Rubocop lint
7
+ rubocop.lint
8
+
9
+ # CHANGELOG CHECKS
10
+ changelog.check!
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in danger-spelling.gemspec
6
+ gemspec
7
+
8
+ # Danger plugins to run as part of CI
9
+ gem 'danger-changelog', '~> 0.6.0'
10
+ gem 'danger-rubocop'
data/Gemfile.lock ADDED
@@ -0,0 +1,177 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-spelling (0.0.1)
5
+ danger-plugin-api (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ addressable (2.8.0)
11
+ public_suffix (>= 2.0.2, < 5.0)
12
+ ast (2.4.2)
13
+ claide (1.1.0)
14
+ claide-plugins (0.9.2)
15
+ cork
16
+ nap
17
+ open4 (~> 1.3)
18
+ coderay (1.1.3)
19
+ colored2 (3.1.2)
20
+ cork (0.3.0)
21
+ colored2 (~> 3.1)
22
+ danger (8.4.5)
23
+ claide (~> 1.0)
24
+ claide-plugins (>= 0.9.2)
25
+ colored2 (~> 3.1)
26
+ cork (~> 0.1)
27
+ faraday (>= 0.9.0, < 2.0)
28
+ faraday-http-cache (~> 2.0)
29
+ git (~> 1.7)
30
+ kramdown (~> 2.3)
31
+ kramdown-parser-gfm (~> 1.0)
32
+ no_proxy_fix
33
+ octokit (~> 4.7)
34
+ terminal-table (>= 1, < 4)
35
+ danger-changelog (0.6.1)
36
+ danger-plugin-api (~> 1.0)
37
+ danger-plugin-api (1.0.0)
38
+ danger (> 2.0)
39
+ danger-rubocop (0.10.0)
40
+ danger
41
+ rubocop (~> 1.0)
42
+ diff-lcs (1.5.0)
43
+ faraday (1.10.0)
44
+ faraday-em_http (~> 1.0)
45
+ faraday-em_synchrony (~> 1.0)
46
+ faraday-excon (~> 1.1)
47
+ faraday-httpclient (~> 1.0)
48
+ faraday-multipart (~> 1.0)
49
+ faraday-net_http (~> 1.0)
50
+ faraday-net_http_persistent (~> 1.0)
51
+ faraday-patron (~> 1.0)
52
+ faraday-rack (~> 1.0)
53
+ faraday-retry (~> 1.0)
54
+ ruby2_keywords (>= 0.0.4)
55
+ faraday-em_http (1.0.0)
56
+ faraday-em_synchrony (1.0.0)
57
+ faraday-excon (1.1.0)
58
+ faraday-http-cache (2.2.0)
59
+ faraday (>= 0.8)
60
+ faraday-httpclient (1.0.1)
61
+ faraday-multipart (1.0.3)
62
+ multipart-post (>= 1.2, < 3)
63
+ faraday-net_http (1.0.1)
64
+ faraday-net_http_persistent (1.2.0)
65
+ faraday-patron (1.0.0)
66
+ faraday-rack (1.0.0)
67
+ faraday-retry (1.0.3)
68
+ ffi (1.15.5)
69
+ formatador (1.1.0)
70
+ git (1.10.2)
71
+ rchardet (~> 1.8)
72
+ guard (2.18.0)
73
+ formatador (>= 0.2.4)
74
+ listen (>= 2.7, < 4.0)
75
+ lumberjack (>= 1.0.12, < 2.0)
76
+ nenv (~> 0.1)
77
+ notiffany (~> 0.0)
78
+ pry (>= 0.13.0)
79
+ shellany (~> 0.0)
80
+ thor (>= 0.18.1)
81
+ guard-compat (1.2.1)
82
+ guard-rspec (4.7.3)
83
+ guard (~> 2.1)
84
+ guard-compat (~> 1.1)
85
+ rspec (>= 2.99.0, < 4.0)
86
+ kramdown (2.3.1)
87
+ rexml
88
+ kramdown-parser-gfm (1.1.0)
89
+ kramdown (~> 2.0)
90
+ listen (3.0.7)
91
+ rb-fsevent (>= 0.9.3)
92
+ rb-inotify (>= 0.9.7)
93
+ lumberjack (1.2.8)
94
+ method_source (1.0.0)
95
+ multipart-post (2.1.1)
96
+ nap (1.1.0)
97
+ nenv (0.3.0)
98
+ no_proxy_fix (0.1.2)
99
+ notiffany (0.1.3)
100
+ nenv (~> 0.1)
101
+ shellany (~> 0.0)
102
+ octokit (4.22.0)
103
+ faraday (>= 0.9)
104
+ sawyer (~> 0.8.0, >= 0.5.3)
105
+ open4 (1.3.4)
106
+ parallel (1.21.0)
107
+ parser (3.1.1.0)
108
+ ast (~> 2.4.1)
109
+ pry (0.14.1)
110
+ coderay (~> 1.1)
111
+ method_source (~> 1.0)
112
+ public_suffix (4.0.6)
113
+ rainbow (3.1.1)
114
+ rake (10.5.0)
115
+ rb-fsevent (0.11.1)
116
+ rb-inotify (0.10.1)
117
+ ffi (~> 1.0)
118
+ rchardet (1.8.0)
119
+ regexp_parser (2.2.1)
120
+ rexml (3.2.5)
121
+ rspec (3.11.0)
122
+ rspec-core (~> 3.11.0)
123
+ rspec-expectations (~> 3.11.0)
124
+ rspec-mocks (~> 3.11.0)
125
+ rspec-core (3.11.0)
126
+ rspec-support (~> 3.11.0)
127
+ rspec-expectations (3.11.0)
128
+ diff-lcs (>= 1.2.0, < 2.0)
129
+ rspec-support (~> 3.11.0)
130
+ rspec-mocks (3.11.0)
131
+ diff-lcs (>= 1.2.0, < 2.0)
132
+ rspec-support (~> 3.11.0)
133
+ rspec-support (3.11.0)
134
+ rubocop (1.26.0)
135
+ parallel (~> 1.10)
136
+ parser (>= 3.1.0.0)
137
+ rainbow (>= 2.2.2, < 4.0)
138
+ regexp_parser (>= 1.8, < 3.0)
139
+ rexml
140
+ rubocop-ast (>= 1.16.0, < 2.0)
141
+ ruby-progressbar (~> 1.7)
142
+ unicode-display_width (>= 1.4.0, < 3.0)
143
+ rubocop-ast (1.16.0)
144
+ parser (>= 3.1.1.0)
145
+ ruby-progressbar (1.11.0)
146
+ ruby2_keywords (0.0.5)
147
+ sawyer (0.8.2)
148
+ addressable (>= 2.3.5)
149
+ faraday (> 0.8, < 2.0)
150
+ shellany (0.0.1)
151
+ terminal-table (3.0.2)
152
+ unicode-display_width (>= 1.1.1, < 3)
153
+ thor (1.2.1)
154
+ unicode-display_width (2.1.0)
155
+ webrick (1.7.0)
156
+ yard (0.9.27)
157
+ webrick (~> 1.7.0)
158
+
159
+ PLATFORMS
160
+ arm64-darwin-20
161
+
162
+ DEPENDENCIES
163
+ bundler (~> 2.0)
164
+ danger-changelog (~> 0.6.0)
165
+ danger-rubocop
166
+ danger-spelling!
167
+ guard (~> 2.14)
168
+ guard-rspec (~> 4.7)
169
+ listen (= 3.0.7)
170
+ pry
171
+ rake (~> 10.0)
172
+ rspec (~> 3.4)
173
+ rubocop
174
+ yard
175
+
176
+ BUNDLED WITH
177
+ 2.2.26
data/Guardfile ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A guardfile for making Danger Plugins
4
+ # For more info see https://github.com/guard/guard#readme
5
+
6
+ # To run, use `bundle exec guard`.
7
+
8
+ guard :rspec, cmd: "bundle exec rspec" do
9
+ require "guard/rspec/dsl"
10
+ dsl = Guard::RSpec::Dsl.new(self)
11
+
12
+ # RSpec files
13
+ rspec = dsl.rspec
14
+ watch(rspec.spec_helper) { rspec.spec_dir }
15
+ watch(rspec.spec_support) { rspec.spec_dir }
16
+ watch(rspec.spec_files)
17
+
18
+ # Ruby files
19
+ ruby = dsl.ruby
20
+ dsl.watch_spec_files_for(ruby.lib_files)
21
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2022 HammyAssassin <alanoc83@gmail.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,127 @@
1
+
2
+
3
+ ### spelling
4
+
5
+ This is a Danger plugin that wraps the python library pyspelling and some of its usage.
6
+ The pyspelling results are posted to the pull request as a comment with the spelling mistake, file path &
7
+ line number where the spelling mistake was found.
8
+
9
+ It has some dependencies that should be installed prior to running.
10
+
11
+ * [pyspelling](https://facelessuser.github.io/pyspelling/)
12
+ * [aspell](http://aspell.net)
13
+ * **OR**
14
+ * [hunspell](http://hunspell.github.io)
15
+
16
+ Your repository will also require a .pyspelling.yml file to be present. This .pyspelling.yml can be basic,
17
+ but it will require a name and source property.
18
+
19
+ There are several ways to use this danger plugin
20
+
21
+ added in the given pull request.
22
+ spelling.name = "test_matrix"
23
+ spelling.check_spelling
24
+
25
+ request, excluding some specific file names
26
+ spelling.ignored_files = ["Gemfile"]
27
+ spelling.name = "test_matrix"
28
+ spelling.check_spelling
29
+
30
+ request, excluding some specific file names and excluding some words
31
+ spelling.ignored_words = ["HammyAssassin"]
32
+ spelling.ignored_files = ["Gemfile"]
33
+ spelling.name = "test_matrix"
34
+ spelling.check_spelling
35
+
36
+ <blockquote>execute pyspelling matrix with the name 'test_matrix' on all files modified or
37
+ <pre></pre>
38
+ </blockquote>
39
+
40
+ <blockquote>execute pyspelling matrix with the name 'test_matrix' on all files modified or added in the given pull
41
+ <pre></pre>
42
+ </blockquote>
43
+
44
+ <blockquote>execute pyspelling matrix with the name 'test_matrix' on all files modified or added in the given pull
45
+ <pre></pre>
46
+ </blockquote>
47
+
48
+
49
+
50
+ #### Attributes
51
+
52
+ `ignored_words` - Allows you to ignore certain words that might otherwise be detected as a spelling error.
53
+ default value is [] when its nil
54
+
55
+ `ignored_files` - Allows you to ignore certain files that might otherwise be scanned by pyspelling.
56
+ The default value is [] for when its nil
57
+
58
+ `name` - **required** The name of the test matrix in your .pyspelling.yml
59
+ An exception will be raised if this is not specified in your Danger file.
60
+
61
+
62
+
63
+
64
+ #### Methods
65
+
66
+ `check_spelling` - Checks the spelling of all files added or modified in a given pull request. This will fail if
67
+ pyspelling cannot be installed if not installed already. It will fail if `aspell` or `hunspell`
68
+ are not detected.
69
+
70
+ It will also fail if the required parameter `name` hasn't been specificed in the Danger file.
71
+
72
+
73
+ modified files will be scanned.
74
+
75
+ `update_message_for_issues` - **Internal Method**
76
+
77
+ Updates the message that will eventually be posted as a comment a pull request with
78
+ a new line for each time the spelling error has been detected.
79
+
80
+ `pyspelling_results` - **Internal Method**
81
+
82
+ Runs pyspelling on the test matrix name provided with any files given.
83
+
84
+ `git_check` - **Internal Method**
85
+
86
+ Check on the git service used. Will raise an error if using bitbucket as it currently doesnt support that.
87
+
88
+ `check_for_dependancies` - **Internal Method**
89
+
90
+ Check for dependencies. Raises exception if pyspelling, hunspell or aspell are not installed.
91
+
92
+ `ignore_line` - **Internal Method**
93
+
94
+ Checks if a given line can be ignored if it contains expected pyspelling output.
95
+
96
+ `remove_ignored_words` - **Internal Method**
97
+
98
+ Removes some standard words in the pyspelling results.
99
+ Words provided in `ignored_words` will also be removed from the results array.
100
+
101
+ `pyspelling_installed?` - **Internal Method**
102
+
103
+ Checks of pyspelling is installed.
104
+
105
+ `aspell_installed?` - **Internal Method**
106
+
107
+ Checks if aspell is installed.
108
+
109
+ `hunspell_installed?` - **Internal Method**
110
+
111
+ Checks if Hunspell is installed.
112
+
113
+ `aspell_hunspell_installed?` - **Internal Method**
114
+
115
+ checks if aspell and hunspell are installed.
116
+
117
+ `get_files` - **Internal Method**
118
+
119
+ Gets a file list of the files provided or finds modified and added files to scan.
120
+ If files are provided via `ignored_files` they will be removed from the final returned
121
+ list.
122
+
123
+ Will raise an exception if no files are found.
124
+
125
+
126
+
127
+
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+ require "rubocop/rake_task"
6
+
7
+ RSpec::Core::RakeTask.new(:specs)
8
+
9
+ task default: :specs
10
+
11
+ task :spec do
12
+ Rake::Task["specs"].invoke
13
+ Rake::Task["rubocop"].invoke
14
+ Rake::Task["spec_docs"].invoke
15
+ end
16
+
17
+ desc "Run RuboCop on the lib/specs directory"
18
+ RuboCop::RakeTask.new(:rubocop) do |task|
19
+ task.patterns = ["lib/**/*.rb", "spec/**/*.rb"]
20
+ end
21
+
22
+ desc "Ensure that the plugin passes `danger plugins lint`"
23
+ task :spec_docs do
24
+ sh "bundle exec danger plugins lint"
25
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("lib", __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "spelling/gem_version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "danger-spelling"
9
+ spec.version = Spelling::VERSION
10
+ spec.authors = ["HammyAssassin"]
11
+ spec.email = ["alanoc83@gmail.com"]
12
+ spec.description = "A Danger plugin for pyspelling."
13
+ spec.summary = "danger-spelling uses pyspelling to scan files changed for spelling mistakes."
14
+ spec.homepage = "https://github.com/HammyAssassin/danger-spelling"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_runtime_dependency "danger-plugin-api", "~> 1.0"
23
+
24
+ # General ruby development
25
+ spec.add_development_dependency "bundler", "~> 2.0"
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+
28
+ # Testing support
29
+ spec.add_development_dependency "rspec", "~> 3.4"
30
+
31
+ # Linting code and docs
32
+ spec.add_development_dependency "rubocop"
33
+ spec.add_development_dependency "yard"
34
+
35
+ # Makes testing easy via `bundle exec guard`
36
+ spec.add_development_dependency "guard", "~> 2.14"
37
+ spec.add_development_dependency "guard-rspec", "~> 4.7"
38
+
39
+ # If you want to work on older builds of ruby
40
+ spec.add_development_dependency "listen", "3.0.7"
41
+
42
+ # This gives you the chance to run a REPL inside your tests
43
+ # via:
44
+ #
45
+ # require 'pry'
46
+ # binding.pry
47
+ #
48
+ # This will stop test execution and let you inspect the results
49
+ spec.add_development_dependency "pry"
50
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spelling/plugin"
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spelling/gem_version"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spelling
4
+ VERSION = "0.0.1"
5
+ end