un_used_methods 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 875c2f106cf4fc02e3f6fab4b7e57b39b6207bb87db110e221d6f42d54270dbe
4
+ data.tar.gz: 37a2ac5c9ba5b8378643777db4b59b4d8baef57a1fa9b457414cd11e2b822fa9
5
+ SHA512:
6
+ metadata.gz: d4ca47e9f5170e9ace7853ea9b5639fcdd6050e685058a49c232879c349ca30a1a709bcbbadc19a4c6cd62b4abf9dab38ea2b74cea7591d231989faaeba9dd52
7
+ data.tar.gz: 9321d49fe19e0452612c9dd13e95293eadfffc0cf316c4d4ce5e2eeceea3661e0dddb98dfa90cd46058dff82dac63a07cc94bbb0f244004f7699cfb907709e26
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-3.1.6-p260" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/un_used_methods.iml" filepath="$PROJECT_DIR$/.idea/un_used_methods.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,79 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="ruby-3.1.6-p260 (2)" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="actioncable (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="actionmailbox (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="actionmailer (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="actionpack (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="actiontext (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="actionview (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="activejob (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="activerecord (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="activestorage (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="builder (v3.3.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.17, ruby-3.1.6-p260 (2)) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, ruby-3.1.6-p260 (2)) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="date (v3.3.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="erubi (v1.13.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="globalid (v1.2.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.14.5, ruby-3.1.6-p260 (2)) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.7.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.3, ruby-3.1.6-p260 (2)) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="loofah (v2.22.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="mail (v2.8.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="marcel (v1.0.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v1.1.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.5, ruby-3.1.6-p260 (2)) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="net-imap (v0.4.14, ruby-3.1.6-p260 (2)) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="net-protocol (v0.2.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.5.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="nio4r (v2.7.3, ruby-3.1.6-p260 (2)) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.16.7, ruby-3.1.6-p260 (2)) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.26.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.3.4.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.9, ruby-3.1.6-p260 (2)) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="rack-test (v2.1.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="rails (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.2.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.6.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="railties (v7.0.8.4, ruby-3.1.6-p260 (2)) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.9.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.3.5, ruby-3.1.6-p260 (2)) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.13.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
63
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.13.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
64
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.13.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.65.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.32.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="strscan (v3.1.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.3.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="timeout (v0.4.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, ruby-3.1.6-p260 (2)) [gem]" level="application" />
74
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.5.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.6, ruby-3.1.6-p260 (2)) [gem]" level="application" />
76
+ <orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, ruby-3.1.6-p260 (2)) [gem]" level="application" />
77
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.6.17, ruby-3.1.6-p260 (2)) [gem]" level="application" />
78
+ </component>
79
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
9
+
10
+ Lint/ScriptPermission:
11
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-08-16
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Dhamo1107
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,39 @@
1
+ # UnUsedMethods
2
+
3
+ TODO: Delete this and the text below, and describe your gem
4
+
5
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/un_used_methods`. To experiment with that code, run `bin/console` for an interactive prompt.
6
+
7
+ ## Installation
8
+
9
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
+
11
+ Install the gem and add to the application's Gemfile by executing:
12
+
13
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+
15
+ If bundler is not being used to manage dependencies, install the gem by executing:
16
+
17
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Development
24
+
25
+ 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.
26
+
27
+ 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).
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/un_used_methods. 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]/un_used_methods/blob/master/CODE_OF_CONDUCT.md).
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the UnUsedMethods project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/un_used_methods/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
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]
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ #!/usr/bin/env ruby
4
+
5
+ require "bundler/setup"
6
+ require "un_used_methods"
7
+ require "un_used_methods/analyzer"
8
+
9
+ UnUsedMethods::CLI.start(ARGV)
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This class analyzes code to find unused methods within specific directories
4
+ # such as models, controllers, and helpers.
5
+
6
+ module UnUsedMethods
7
+ # It performs the following tasks:
8
+ # - Searches for method definitions in the specified directories.
9
+ # - Checks if these methods are used elsewhere in the codebase.
10
+ # - Reports methods that are not used.
11
+ class Analyzer
12
+ def analyze
13
+ un_used_methods = find_un_used_methods
14
+ report_un_used_methods(un_used_methods)
15
+ end
16
+
17
+ private
18
+
19
+ def find_un_used_methods
20
+ un_used_methods = []
21
+
22
+ # Analyze Models
23
+ un_used_methods += find_in_directory("app/models")
24
+
25
+ # Analyze Controllers
26
+ un_used_methods += find_in_directory("app/controllers")
27
+
28
+ # Analyze Helpers
29
+ un_used_methods += find_in_directory("app/helpers")
30
+
31
+ un_used_methods
32
+ end
33
+
34
+ def find_in_directory(directory)
35
+ un_used_methods = []
36
+
37
+ Dir.glob("#{directory}/**/*.rb").each do |file|
38
+ methods = extract_methods(file)
39
+ methods.each do |method|
40
+ un_used_methods << "#{file}: #{method}" unless method_used?(method)
41
+ end
42
+ end
43
+
44
+ un_used_methods
45
+ end
46
+
47
+ def extract_methods(file)
48
+ content = File.read(file)
49
+ content.scan(/def (\w+)/).flatten
50
+ end
51
+
52
+ def method_used?(method)
53
+ method_pattern = /#{method}/
54
+ files = Dir.glob("app/**/*.{rb}")
55
+
56
+ files.any? do |file|
57
+ content = File.read(file)
58
+ content.match?(method_pattern)
59
+ end
60
+ end
61
+
62
+ def report_un_used_methods(unused_methods)
63
+ if unused_methods.empty?
64
+ puts "No un used methods found!"
65
+ else
66
+ puts "Un used Methods found in your model, controller, and helper directories:"
67
+ unused_methods.each { |method| puts method }
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The CLI class provides the command-line interface for the UnUsedMethods gem.
4
+
5
+ require "thor"
6
+
7
+ module UnUsedMethods
8
+ # This class is responsible for handling command-line arguments and executing
9
+ # the appropriate tasks. It uses the Thor gem to define commands and options
10
+ # that users can run from the command line.
11
+ class CLI < Thor
12
+ desc "find_unused", "Find unused methods in models, controllers and helpers"
13
+ def find_unused
14
+ UnUsedMethods::Analyzer.new.analyze
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UnUsedMethods
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "un_used_methods/version"
4
+ require "un_used_methods/cli"
5
+
6
+ module UnUsedMethods
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,4 @@
1
+ module UnUsedMethods
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,125 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: un_used_methods
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dhamo1107
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-08-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.21'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.21'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: |-
70
+ The un_used_methods gem scans your Rails application to find methods defined in models,
71
+ controllers and helpers that are not used anywhere else in the application. This helps
72
+ you clean up your codebase by identifying dead code.
73
+ email:
74
+ - dhamodharansathish4533@gmail.com
75
+ executables:
76
+ - un_used_methods
77
+ extensions: []
78
+ extra_rdoc_files: []
79
+ files:
80
+ - ".idea/.gitignore"
81
+ - ".idea/misc.xml"
82
+ - ".idea/modules.xml"
83
+ - ".idea/un_used_methods.iml"
84
+ - ".idea/vcs.xml"
85
+ - ".rspec"
86
+ - ".rubocop.yml"
87
+ - CHANGELOG.md
88
+ - CODE_OF_CONDUCT.md
89
+ - LICENSE.txt
90
+ - README.md
91
+ - Rakefile
92
+ - exe/un_used_methods
93
+ - lib/un_used_methods.rb
94
+ - lib/un_used_methods/analyzer.rb
95
+ - lib/un_used_methods/cli.rb
96
+ - lib/un_used_methods/version.rb
97
+ - sig/un_used_methods.rbs
98
+ homepage: https://github.com/Dhamo1107/un_used_methods
99
+ licenses:
100
+ - MIT
101
+ metadata:
102
+ allowed_push_host: https://rubygems.org
103
+ homepage_uri: https://github.com/Dhamo1107/un_used_methods
104
+ source_code_uri: https://github.com/Dhamo1107/un_used_methods
105
+ changelog_uri: https://github.com/Dhamo1107/un_used_methods/blob/main/CHANGELOG.md
106
+ post_install_message:
107
+ rdoc_options: []
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: 3.0.0
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ requirements: []
121
+ rubygems_version: 3.3.26
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: A gem to identify and list unused methods in your Rails application.
125
+ test_files: []