rubocop-sorted 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b575aca29799efa90eee8e8e72783f66c668e6bc4d9d5c313b2d465a4570d054
4
+ data.tar.gz: 3f185d6fef21a48d0da5f8e470a3a6a8fe659b1b78403689eefbe484bd3d0a1e
5
+ SHA512:
6
+ metadata.gz: 4374fe341891ad794e333f67f5602b7f7e2de7aefe250bfae0217885db2eb0352637a6bd05aa5b41593ed66500b7adea03724d3ce3feff4443f5ed0002e9be95
7
+ data.tar.gz: 01a5c441cd0ce064102cb46e54c92facc514a9df0f67670361bba2c6916473bd10ceb187c31f4500c656f036ba0b034ac3452e44ceea8200d7801ba380dfc26c
@@ -0,0 +1,28 @@
1
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
2
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
3
+
4
+ name: Ruby
5
+
6
+ on:
7
+ push:
8
+ branches: [ main ]
9
+ pull_request:
10
+ branches: [ main ]
11
+
12
+ jobs:
13
+ test:
14
+
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ matrix:
18
+ ruby-version: ['2.6', '2.7', '3.0']
19
+
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+ - name: Run tests
28
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ require:
2
+ - rubocop-rake
3
+ - rubocop-rspec
4
+
5
+ Naming/FileName:
6
+ Exclude:
7
+ - lib/rubocop-sorted.rb
8
+
9
+ Metrics/BlockLength:
10
+ Max: 30
11
+ Exclude:
12
+ - 'spec/**/*'
13
+
14
+ RSpec/ExampleLength:
15
+ Max: 20
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in rubocop-sorted.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+
10
+ gem 'rspec', '~> 3.0'
11
+
12
+ gem 'rubocop', '~> 1.7'
13
+ gem 'rubocop-rake'
14
+ gem 'rubocop-rspec'
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rubocop-sorted (0.1.0)
5
+ rubocop
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ diff-lcs (1.4.4)
12
+ parallel (1.21.0)
13
+ parser (3.0.3.2)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.0.0)
16
+ rake (13.0.6)
17
+ regexp_parser (2.2.0)
18
+ rexml (3.2.5)
19
+ rspec (3.10.0)
20
+ rspec-core (~> 3.10.0)
21
+ rspec-expectations (~> 3.10.0)
22
+ rspec-mocks (~> 3.10.0)
23
+ rspec-core (3.10.1)
24
+ rspec-support (~> 3.10.0)
25
+ rspec-expectations (3.10.1)
26
+ diff-lcs (>= 1.2.0, < 2.0)
27
+ rspec-support (~> 3.10.0)
28
+ rspec-mocks (3.10.2)
29
+ diff-lcs (>= 1.2.0, < 2.0)
30
+ rspec-support (~> 3.10.0)
31
+ rspec-support (3.10.3)
32
+ rubocop (1.23.0)
33
+ parallel (~> 1.10)
34
+ parser (>= 3.0.0.0)
35
+ rainbow (>= 2.2.2, < 4.0)
36
+ regexp_parser (>= 1.8, < 3.0)
37
+ rexml
38
+ rubocop-ast (>= 1.12.0, < 2.0)
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (>= 1.4.0, < 3.0)
41
+ rubocop-ast (1.15.0)
42
+ parser (>= 3.0.1.1)
43
+ rubocop-rake (0.6.0)
44
+ rubocop (~> 1.0)
45
+ rubocop-rspec (2.6.0)
46
+ rubocop (~> 1.19)
47
+ ruby-progressbar (1.11.0)
48
+ unicode-display_width (2.1.0)
49
+
50
+ PLATFORMS
51
+ x86_64-darwin-18
52
+ x86_64-linux
53
+
54
+ DEPENDENCIES
55
+ rake (~> 13.0)
56
+ rspec (~> 3.0)
57
+ rubocop (~> 1.7)
58
+ rubocop-rake
59
+ rubocop-rspec
60
+ rubocop-sorted!
61
+
62
+ BUNDLED WITH
63
+ 2.2.17
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 HeroProtagonist
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,67 @@
1
+ # Rubocop::Sorted
2
+
3
+ ![ruby workflow](https://github.com/HeroProtagonist/rubocop-sorted/actions/workflows/ruby.yml/badge.svg)
4
+
5
+ [Rubocop](https://github.com/rubocop/rubocop) extension used to enforce that the keys of a hash are sorted alphabetically
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rubocop-sorted', require: false
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rubocop-sorted
22
+
23
+ ## Usage
24
+
25
+ You need to tell RuboCop to load the Sorted extension. There are three ways to do this:
26
+
27
+ ### RuboCop configuration file
28
+
29
+ Put this into your `.rubocop.yml`.
30
+
31
+ ```yaml
32
+ require: rubocop-sorted
33
+ ```
34
+
35
+ Alternatively, use the following array notation when specifying multiple extensions.
36
+
37
+ ```yaml
38
+ require:
39
+ - rubocop-other-extension
40
+ - rubocop-sorted
41
+ ```
42
+
43
+ Now you can run `rubocop` and it will automatically load the RuboCop Sorted cops together with the standard cops.
44
+
45
+ ### Command line
46
+
47
+ ```sh
48
+ rubocop --require rubocop-sorted
49
+ ```
50
+
51
+ ## Development
52
+
53
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
54
+
55
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
56
+
57
+ ## Contributing
58
+
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubocop-sorted. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rubocop-sorted/blob/main/CODE_OF_CONDUCT.md).
60
+
61
+ ## License
62
+
63
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
64
+
65
+ ## Code of Conduct
66
+
67
+ Everyone interacting in the Rubocop::Sorted project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rubocop-sorted/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
13
+
14
+ RSpec::Core::RakeTask.new(:spec) do |spec|
15
+ spec.pattern = FileList['spec/**/*_spec.rb']
16
+ end
17
+
18
+ desc 'Generate a new cop with a template'
19
+ task :new_cop, [:cop] do |_task, args|
20
+ require 'rubocop'
21
+
22
+ cop_name = args.fetch(:cop) do
23
+ warn 'usage: bundle exec rake new_cop[Department/Name]'
24
+ exit!
25
+ end
26
+
27
+ generator = RuboCop::Cop::Generator.new(cop_name)
28
+
29
+ generator.write_source
30
+ generator.write_spec
31
+ generator.inject_require(root_file_path: 'lib/rubocop/cop/sorted_cops.rb')
32
+ generator.inject_config(config_file_path: 'config/default.yml')
33
+
34
+ puts generator.todo
35
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'rubocop/sorted'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,5 @@
1
+ Sorted/SortHashKeys:
2
+ Description: 'Checks that hash keys are sorted alphabetically'
3
+ Enabled: true
4
+ VersionAdded: '0.1.0'
5
+ VariableNamesToCheck: []
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Cop
5
+ module Sorted
6
+ # TODO: Write cop description and example of bad / good code. For every
7
+ # `SupportedStyle` and unique configuration, there needs to be examples.
8
+ # Examples must have valid Ruby syntax. Do not use upticks.
9
+ #
10
+ # @safety
11
+ # Delete this section if the cop is not unsafe (`Safe: false` or
12
+ # `SafeAutoCorrect: false`), or use it to explain how the cop is
13
+ # unsafe.
14
+ #
15
+ # @example EnforcedStyle: bar (default)
16
+ # # Description of the `bar` style.
17
+ #
18
+ # # bad
19
+ # bad_bar_method
20
+ #
21
+ # # bad
22
+ # bad_bar_method(args)
23
+ #
24
+ # # good
25
+ # good_bar_method
26
+ #
27
+ # # good
28
+ # good_bar_method(args)
29
+ #
30
+ # @example EnforcedStyle: foo
31
+ # # Description of the `foo` style.
32
+ #
33
+ # # bad
34
+ # bad_foo_method
35
+ #
36
+ # # bad
37
+ # bad_foo_method(args)
38
+ #
39
+ # # good
40
+ # good_foo_method
41
+ #
42
+ # # good
43
+ # good_foo_method(args)
44
+ #
45
+ class SortHashKeys < Base
46
+ extend AutoCorrector
47
+
48
+ MSG = 'Key is not sorted alphabetically'
49
+
50
+ def on_hash(node)
51
+ @node = node
52
+
53
+ return if targeted_investigation? && !variable_of_interest?
54
+
55
+ return if hash_keys.map(&method(:str_from)) == sorted_key_strings
56
+
57
+ add_offense_to_keys
58
+ add_offense_to_hash
59
+ end
60
+
61
+ private
62
+
63
+ attr_reader :node
64
+
65
+ def hash_keys
66
+ @hash_keys ||= node.keys
67
+ end
68
+
69
+ def sorted_key_strings
70
+ @sorted_key_strings ||= hash_keys.map(&method(:str_from)).sort
71
+ end
72
+
73
+ def add_offense_to_keys
74
+ sorted_key_strings.each_with_index do |key, index|
75
+ unsorted_key_node = hash_keys[index]
76
+ add_offense(unsorted_key_node) if key != str_from(unsorted_key_node)
77
+ end
78
+ end
79
+
80
+ def add_offense_to_hash
81
+ message = 'Hash keys are not sorted alphabetically'
82
+
83
+ add_offense(node, message: message) do |corrector|
84
+ node
85
+ .each_pair
86
+ .sort_by(&method(:str_from))
87
+ .each_with_index do |pair, index|
88
+ corrector.replace(node.children[index], pair.source)
89
+ end
90
+ end
91
+ end
92
+
93
+ def str_from(ast_node)
94
+ return ast_node.key.value.to_s if ast_node.is_a?(AST::PairNode)
95
+
96
+ ast_node.value.to_s
97
+ end
98
+
99
+ def targeted_investigation?
100
+ variable_names_to_check.is_a?(Array) && variable_names_to_check.any?
101
+ end
102
+
103
+ def variable_of_interest?
104
+ return false unless node.parent.assignment?
105
+
106
+ variable_name = node.parent.children.first.to_s
107
+ variable_names_to_check.include?(variable_name)
108
+ end
109
+
110
+ def variable_names_to_check
111
+ @variable_names_to_check ||= cop_config['VariableNamesToCheck']
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'sorted/sort_hash_keys'
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The original code is from https://github.com/rubocop-hq/rubocop-rspec/blob/master/lib/rubocop/rspec/inject.rb
4
+ # See https://github.com/rubocop-hq/rubocop-rspec/blob/master/MIT-LICENSE.md
5
+ module RuboCop
6
+ module Sorted
7
+ # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
8
+ # bit of our configuration.
9
+ module Inject
10
+ def self.defaults!
11
+ path = CONFIG_DEFAULT.to_s
12
+ hash = ConfigLoader.send(:load_yaml_configuration, path)
13
+ config = Config.new(hash, path).tap(&:make_excludes_absolute)
14
+ puts "configuration from #{path}" if ConfigLoader.debug?
15
+ config = ConfigLoader.merge_with_default(config, path)
16
+ ConfigLoader.instance_variable_set(:@default_configuration, config)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RuboCop
4
+ module Sorted
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'sorted/version'
4
+
5
+ # rubocop:disable Style/Documentation
6
+ module RuboCop
7
+ module Sorted
8
+ class Error < StandardError; end
9
+ PROJECT_ROOT = Pathname.new(__dir__).parent.parent.expand_path.freeze
10
+ CONFIG_DEFAULT = PROJECT_ROOT.join('config', 'default.yml').freeze
11
+ CONFIG = YAML.safe_load(CONFIG_DEFAULT.read).freeze
12
+
13
+ private_constant(:CONFIG_DEFAULT, :PROJECT_ROOT)
14
+ end
15
+ end
16
+ # rubocop:enable Style/Documentation
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rubocop'
4
+
5
+ require_relative 'rubocop/sorted'
6
+ require_relative 'rubocop/sorted/version'
7
+ require_relative 'rubocop/sorted/inject'
8
+
9
+ RuboCop::Sorted::Inject.defaults!
10
+
11
+ require_relative 'rubocop/cop/sorted_cops'
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/rubocop/sorted/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'rubocop-sorted'
7
+ spec.version = RuboCop::Sorted::VERSION
8
+ spec.authors = ['HeroProtagonist']
9
+
10
+ spec.summary = 'Rubocop extension used to enforce that the keys of a hash are sorted alphabetically'
11
+ # spec.description = ''
12
+ spec.homepage = 'https://github.com/HeroProtagonist/rubocop-sorted'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/HeroProtagonist/rubocop-sorted'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/HeroProtagonist/rubocop-sorted/blob/main/CODE_OF_CONDUCT.md'
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ # Uncomment to register a new dependency of your gem
30
+ # spec.add_dependency "example-gem", "~> 1.0"
31
+
32
+ # For more information and examples about making a new gem, checkout our
33
+ # guide at: https://bundler.io/guides/creating_gem.html
34
+
35
+ spec.add_runtime_dependency 'rubocop'
36
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop-sorted
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - HeroProtagonist
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-12-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubocop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - ".github/workflows/ruby.yml"
34
+ - ".gitignore"
35
+ - ".rspec"
36
+ - ".rubocop.yml"
37
+ - CODE_OF_CONDUCT.md
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - bin/console
44
+ - bin/setup
45
+ - config/default.yml
46
+ - lib/rubocop-sorted.rb
47
+ - lib/rubocop/cop/sorted/sort_hash_keys.rb
48
+ - lib/rubocop/cop/sorted_cops.rb
49
+ - lib/rubocop/sorted.rb
50
+ - lib/rubocop/sorted/inject.rb
51
+ - lib/rubocop/sorted/version.rb
52
+ - rubocop-sorted.gemspec
53
+ homepage: https://github.com/HeroProtagonist/rubocop-sorted
54
+ licenses:
55
+ - MIT
56
+ metadata:
57
+ homepage_uri: https://github.com/HeroProtagonist/rubocop-sorted
58
+ source_code_uri: https://github.com/HeroProtagonist/rubocop-sorted
59
+ changelog_uri: https://github.com/HeroProtagonist/rubocop-sorted/blob/main/CODE_OF_CONDUCT.md
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.5.0
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubygems_version: 3.0.6
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Rubocop extension used to enforce that the keys of a hash are sorted alphabetically
79
+ test_files: []