standard-sorbet 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: 3ad98617b4e4b4d22f2d305b050f9890646f42ca9bfa03ac7ac5d1f5d2a4871d
4
+ data.tar.gz: 25a4118c83cb23ed9d34ef27c84b0e41b5885c009c40032945c69aa1eee1fe2e
5
+ SHA512:
6
+ metadata.gz: 9cac41956b8601604981a8b27ebe1c2d3b838039e538d31e345e5d342248de189344836c37fde8ca90ff00c45fcb6864453685184963614634f2e4acbfa174d0
7
+ data.tar.gz: a8cf15a2301f2db6ebcf755e4a76a88cc01da64196a3cc2decf2224f3710faf44e6b6cd7bbe37aea2a8c9b6a56aaae2b57140b0bef0a7445962f9079b3c74132
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.7
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.0.1]
4
+
5
+ - Initial release. All rules in `config/base.yml` are set to the defaults of
6
+ rubocop-sorbet until we develop some contrary opinions!
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+ gem "rake"
5
+ gem "minitest"
6
+ gem "standard"
7
+ gem "m"
data/Gemfile.lock ADDED
@@ -0,0 +1,73 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ standard-sorbet (0.0.1)
5
+ lint_roller (~> 1.0)
6
+ rubocop-sorbet (~> 0.7.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ json (2.6.3)
13
+ language_server-protocol (3.17.0.3)
14
+ lint_roller (1.0.0)
15
+ m (1.6.1)
16
+ method_source (>= 0.6.7)
17
+ rake (>= 0.9.2.2)
18
+ method_source (1.0.0)
19
+ minitest (5.18.1)
20
+ parallel (1.23.0)
21
+ parser (3.2.2.3)
22
+ ast (~> 2.4.1)
23
+ racc
24
+ racc (1.7.1)
25
+ rainbow (3.1.1)
26
+ rake (13.0.6)
27
+ regexp_parser (2.8.1)
28
+ rexml (3.2.5)
29
+ rubocop (1.52.1)
30
+ json (~> 2.3)
31
+ parallel (~> 1.10)
32
+ parser (>= 3.2.2.3)
33
+ rainbow (>= 2.2.2, < 4.0)
34
+ regexp_parser (>= 1.8, < 3.0)
35
+ rexml (>= 3.2.5, < 4.0)
36
+ rubocop-ast (>= 1.28.0, < 2.0)
37
+ ruby-progressbar (~> 1.7)
38
+ unicode-display_width (>= 2.4.0, < 3.0)
39
+ rubocop-ast (1.29.0)
40
+ parser (>= 3.2.1.0)
41
+ rubocop-performance (1.18.0)
42
+ rubocop (>= 1.7.0, < 2.0)
43
+ rubocop-ast (>= 0.4.0)
44
+ rubocop-sorbet (0.7.0)
45
+ rubocop (>= 0.90.0)
46
+ ruby-progressbar (1.13.0)
47
+ standard (1.30.0)
48
+ language_server-protocol (~> 3.17.0.2)
49
+ lint_roller (~> 1.0)
50
+ rubocop (~> 1.52.0)
51
+ standard-custom (~> 1.0.0)
52
+ standard-performance (~> 1.1.0)
53
+ standard-custom (1.0.1)
54
+ lint_roller (~> 1.0)
55
+ standard-performance (1.1.0)
56
+ lint_roller (~> 1.0)
57
+ rubocop-performance (~> 1.18.0)
58
+ unicode-display_width (2.4.2)
59
+
60
+ PLATFORMS
61
+ arm64-darwin-22
62
+ ruby
63
+ x86_64-linux
64
+
65
+ DEPENDENCIES
66
+ m
67
+ minitest
68
+ rake
69
+ standard
70
+ standard-sorbet!
71
+
72
+ BUNDLED WITH
73
+ 2.4.10
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Test Double, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # standard-sorbet
2
+
3
+ This gem provides a [lint_roller](https://github.com/standardrb/lint_roller)
4
+ plugin configuration for the
5
+ [rubocop-sorbet](https://github.com/Shopify/rubocop-sorbet) ruleset to be run
6
+ as part of `standardrb` and `rake standard` in your project.
7
+
8
+ To install it, add it to your Gemfile:
9
+
10
+ ```ruby
11
+ gem "standard-sorbet"
12
+ ```
13
+
14
+ ## Configuration
15
+
16
+ In your `.standard.yml` file in your project root, add `standard-sorbet` as a
17
+ plugin:
18
+
19
+ ```yaml
20
+ plugins:
21
+ - standard-sorbet
22
+ ```
23
+
24
+ ## Code of Conduct
25
+
26
+ This project follows Test Double's [code of
27
+ conduct](https://testdouble.com/code-of-conduct) for all community interactions,
28
+ including (but not limited to) one-on-one communications, public posts/comments,
29
+ code reviews, pull requests, and GitHub issues. If violations occur, Test Double
30
+ will take any action they deem appropriate for the infraction, up to and
31
+ including blocking a user from the organization's repositories.
32
+
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ require "standard/rake"
11
+
12
+ desc "Verify linting works in example project"
13
+ task :lint_test do
14
+ puts "-----> Running standardrb in example/"
15
+ output = `cd example; bundle exec standardrb`
16
+ if output.include?("type_check_me.rb:1:1: Sorbet/FalseSigil: Invalid Sorbet sigil `banana`.")
17
+ puts "Standard violation detected in example/ app as expected"
18
+ else
19
+ fail "Expected linting violation not detected. Ensure `cd example; bundle exec standardrb' fails with a violation."
20
+ end
21
+ end
22
+
23
+ task default: %i[test standard:fix lint_test]
data/config/base.yml ADDED
@@ -0,0 +1,86 @@
1
+ Sorbet/AllowIncompatibleOverride:
2
+ Enabled: true
3
+
4
+ Sorbet/BindingConstantWithoutTypeAlias:
5
+ Enabled: true
6
+
7
+ Sorbet/CallbackConditionalsBinding:
8
+ Enabled: false
9
+
10
+ Sorbet/CheckedTrueInSignature:
11
+ Enabled: true
12
+
13
+ Sorbet/EmptyLineAfterSig:
14
+ Enabled: true
15
+
16
+ Sorbet/ConstantsFromStrings:
17
+ Enabled: true
18
+
19
+ Sorbet/EnforceSigilOrder:
20
+ Enabled: true
21
+
22
+ Sorbet/EnforceSingleSigil:
23
+ Enabled: true
24
+
25
+ Sorbet/EnforceSignatures:
26
+ Enabled: false
27
+
28
+ Sorbet/FalseSigil:
29
+ Enabled: true
30
+
31
+ Sorbet/ForbidExtendTSigHelpersInShims:
32
+ Enabled: true
33
+
34
+ Sorbet/ForbidRBIOutsideOfAllowedPaths:
35
+ Enabled: true
36
+
37
+ Sorbet/ForbidIncludeConstLiteral:
38
+ Enabled: false
39
+
40
+ Sorbet/ForbidSuperclassConstLiteral:
41
+ Enabled: false
42
+
43
+ Sorbet/ForbidTUnsafe:
44
+ Enabled: false
45
+
46
+ Sorbet/ForbidTUntyped:
47
+ Enabled: false
48
+
49
+ Sorbet/ForbidUntypedStructProps:
50
+ Enabled: true
51
+
52
+ Sorbet/HasSigil:
53
+ Enabled: false
54
+
55
+ Sorbet/IgnoreSigil:
56
+ Enabled: false
57
+
58
+ Sorbet/KeywordArgumentOrdering:
59
+ Enabled: true
60
+
61
+ Sorbet/OneAncestorPerLine:
62
+ Enabled: false
63
+
64
+ Sorbet/RedundantExtendTSig:
65
+ Enabled: false
66
+
67
+ Sorbet/SignatureBuildOrder:
68
+ Enabled: true
69
+
70
+ Sorbet/SingleLineRbiClassModuleDefinitions:
71
+ Enabled: false
72
+
73
+ Sorbet/StrictSigil:
74
+ Enabled: false
75
+
76
+ Sorbet/StrongSigil:
77
+ Enabled: false
78
+
79
+ Sorbet/TrueSigil:
80
+ Enabled: false
81
+
82
+ Sorbet/TypeAliasName:
83
+ Enabled: true
84
+
85
+ Sorbet/ValidSigil:
86
+ Enabled: true
@@ -0,0 +1,57 @@
1
+ module Standard::Sorbet
2
+ class Plugin < LintRoller::Plugin
3
+ def initialize(config)
4
+ @config = config
5
+ @merges_upstream_metadata = Standard::PluginSupport::MergesUpstreamMetadata.new
6
+ end
7
+
8
+ def about
9
+ LintRoller::About.new(
10
+ name: "standard-sorbet",
11
+ version: VERSION,
12
+ homepage: "https://github.com/standardrb/standard-sorbet",
13
+ description: "Configuration for rubocop-sorbet's rules"
14
+ )
15
+ end
16
+
17
+ def supported?(context)
18
+ true
19
+ end
20
+
21
+ def rules(context)
22
+ trick_rubocop_into_thinking_we_required_rubocop_sorbet!
23
+
24
+ rules = @merges_upstream_metadata.merge(
25
+ YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml")),
26
+ YAML.load_file(Pathname.new(Gem.loaded_specs["rubocop-sorbet"].full_gem_path).join("config/default.yml"))
27
+ )
28
+
29
+ LintRoller::Rules.new(
30
+ type: :object,
31
+ config_format: :rubocop,
32
+ value: rules
33
+ )
34
+ end
35
+
36
+ private
37
+
38
+ # This is not fantastic.
39
+ #
40
+ # When you `require "rubocop-sorbet"`, it will not only load the cops,
41
+ # but it will also monkey-patch RuboCop's default_configuration, which is
42
+ # something that can't be undone for the lifetime of the process.
43
+ #
44
+ # See: https://github.com/Shopify/rubocop-sorbet/blob/main/lib/rubocop/sorbet/inject.rb
45
+ #
46
+ # As an alternative, standard-sorbet loads the cops directly, and then
47
+ # simply tells the RuboCop config loader that it's been loaded. This is
48
+ # taking advantage of a private API of an `attr_reader` that probably wasn't
49
+ # meant to be mutated externally, but it's better than the `Inject` monkey
50
+ # patching that rubocop-sorbet does (and many other RuboCop plugins do)
51
+ def trick_rubocop_into_thinking_we_required_rubocop_sorbet!
52
+ require "rubocop"
53
+ require "rubocop/cop/sorbet_cops"
54
+ RuboCop::ConfigLoader.default_configuration.loaded_features.add("rubocop-sorbet")
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ module Standard
2
+ module Sorbet
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,10 @@
1
+ require "lint_roller"
2
+
3
+ require_relative "sorbet/version"
4
+ require_relative "sorbet/plugin"
5
+ require "standard/plugin_support"
6
+
7
+ module Standard
8
+ module Sorbet
9
+ end
10
+ end
@@ -0,0 +1 @@
1
+ require_relative "standard/sorbet"
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: standard-sorbet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Searls
8
+ - Max VelDink
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2023-07-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: lint_roller
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubocop-sorbet
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 0.7.0
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 0.7.0
42
+ description:
43
+ email:
44
+ - searls@gmail.com
45
+ - maxveldink@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".standard.yml"
51
+ - CHANGELOG.md
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - LICENSE.txt
55
+ - README.md
56
+ - Rakefile
57
+ - config/base.yml
58
+ - lib/standard-sorbet.rb
59
+ - lib/standard/sorbet.rb
60
+ - lib/standard/sorbet/plugin.rb
61
+ - lib/standard/sorbet/version.rb
62
+ homepage: https://github.com/standardrb/standard-sorbet
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ homepage_uri: https://github.com/standardrb/standard-sorbet
67
+ source_code_uri: https://github.com/standardrb/standard-sorbet
68
+ changelog_uri: https://github.com/standardrb/standard-sorbet/blob/main/CHANGELOG.md
69
+ default_lint_roller_plugin: Standard::Sorbet::Plugin
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 2.7.0
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.4.14
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Standard Ruby Plugin providing configuration for rubocop-sorbet
89
+ test_files: []