un_used_methods 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/misc.xml +3 -3
- data/.idea/un_used_methods.iml +41 -41
- data/.rspec +3 -3
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -5
- data/CODE_OF_CONDUCT.md +132 -132
- data/LICENSE.txt +21 -21
- data/README.md +48 -18
- data/Rakefile +12 -12
- data/lib/un_used_methods/analyzer.rb +57 -16
- data/lib/un_used_methods/version.rb +5 -5
- data/sig/un_used_methods.rbs +4 -4
- data/un_used_methods-0.1.0.gem +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03e7bb25efe13d600ecc3078919a2d63dc91f8134b9439541f464657577a21a2
|
4
|
+
data.tar.gz: fd5f60af074afadfa114e86b7bb556c0fb6831fa0d79bb8f5763736ba9292f98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 188d19d09c7b1112e646a9889ebb35e2f2b42f9d88e9d4469722f5d37e93d54bd84bcdd4511e3eaa51e43343095c6a35e35c966279c48ad3d6dbeaf82ce511e1
|
7
|
+
data.tar.gz: c8f0ced1ae32c8e485d94e87ae82beab821f4faae37bbacce056c29b9dc9d3d9f8e218a4467eb827854ff057e116eefbe0f7726be46eed52f87a944c835281a4
|
data/.idea/misc.xml
CHANGED
@@ -1,4 +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" />
|
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
4
|
</project>
|
data/.idea/un_used_methods.iml
CHANGED
@@ -11,50 +11,14 @@
|
|
11
11
|
</content>
|
12
12
|
<orderEntry type="jdk" jdkName="ruby-3.1.6-p260 (2)" jdkType="RUBY_SDK" />
|
13
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
14
|
<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
15
|
<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
16
|
<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
17
|
<orderEntry type="library" scope="PROVIDED" name="json (v2.7.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
36
18
|
<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
19
|
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.26.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
50
20
|
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.4.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
51
21
|
<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
22
|
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
59
23
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
60
24
|
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.9.2, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
@@ -69,11 +33,47 @@
|
|
69
33
|
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
70
34
|
<orderEntry type="library" scope="PROVIDED" name="strscan (v3.1.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
71
35
|
<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
36
|
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.5.0, ruby-3.1.6-p260 (2)) [gem]" level="application" />
|
75
|
-
|
76
|
-
|
77
|
-
<
|
37
|
+
</component>
|
38
|
+
<component name="RakeTasksCache-v2">
|
39
|
+
<option name="myRootTask">
|
40
|
+
<RakeTaskImpl id="rake">
|
41
|
+
<subtasks>
|
42
|
+
<RakeTaskImpl description="Build un_used_methods-0.1.1.gem into the pkg directory" fullCommand="build" id="build" />
|
43
|
+
<RakeTaskImpl id="build">
|
44
|
+
<subtasks>
|
45
|
+
<RakeTaskImpl description="Generate SHA512 checksum of un_used_methods-0.1.1.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
|
46
|
+
</subtasks>
|
47
|
+
</RakeTaskImpl>
|
48
|
+
<RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
|
49
|
+
<RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
|
50
|
+
<RakeTaskImpl description="Build and install un_used_methods-0.1.1.gem into system gems" fullCommand="install" id="install" />
|
51
|
+
<RakeTaskImpl id="install">
|
52
|
+
<subtasks>
|
53
|
+
<RakeTaskImpl description="Build and install un_used_methods-0.1.1.gem into system gems without network access" fullCommand="install:local" id="local" />
|
54
|
+
</subtasks>
|
55
|
+
</RakeTaskImpl>
|
56
|
+
<RakeTaskImpl description="Create tag v0.1.1 and build and push un_used_methods-0.1.1.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
|
57
|
+
<RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
|
58
|
+
<RakeTaskImpl id="rubocop">
|
59
|
+
<subtasks>
|
60
|
+
<RakeTaskImpl description="Autocorrect RuboCop offenses (only when it's safe)" fullCommand="rubocop:autocorrect" id="autocorrect" />
|
61
|
+
<RakeTaskImpl description="Autocorrect RuboCop offenses (safe and unsafe)" fullCommand="rubocop:autocorrect_all" id="autocorrect_all" />
|
62
|
+
<RakeTaskImpl description="" fullCommand="rubocop:auto_correct" id="auto_correct" />
|
63
|
+
</subtasks>
|
64
|
+
</RakeTaskImpl>
|
65
|
+
<RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
|
66
|
+
<RakeTaskImpl description="" fullCommand="default" id="default" />
|
67
|
+
<RakeTaskImpl description="" fullCommand="release" id="release" />
|
68
|
+
<RakeTaskImpl id="release">
|
69
|
+
<subtasks>
|
70
|
+
<RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
|
71
|
+
<RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
|
72
|
+
<RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
|
73
|
+
</subtasks>
|
74
|
+
</RakeTaskImpl>
|
75
|
+
</subtasks>
|
76
|
+
</RakeTaskImpl>
|
77
|
+
</option>
|
78
78
|
</component>
|
79
79
|
</module>
|
data/.rspec
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
--format documentation
|
2
|
-
--color
|
3
|
-
--require spec_helper
|
1
|
+
--format documentation
|
2
|
+
--color
|
3
|
+
--require spec_helper
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
## [Unreleased]
|
2
|
-
|
3
|
-
## [0.1.0] - 2024-08-16
|
4
|
-
|
5
|
-
- Initial release
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## [0.1.0] - 2024-08-16
|
4
|
+
|
5
|
+
- Initial release
|
data/CODE_OF_CONDUCT.md
CHANGED
@@ -1,132 +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
|
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
CHANGED
@@ -1,21 +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.
|
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
CHANGED
@@ -1,39 +1,69 @@
|
|
1
|
-
# UnUsedMethods
|
1
|
+
# UnUsedMethods Gem
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/un_used_methods.svg)](https://badge.fury.io/rb/un_used_methods)
|
4
4
|
|
5
|
-
|
5
|
+
The `un_used_methods` gem is designed to help you identify and clean up unused methods in your Ruby on Rails application. In a large codebase, it can be challenging to track which methods are actively used and which are obsolete. The `un_used_methods` gem scans your application's codebase and identifies methods that are defined but not used anywhere else in your project. This helps you spot and remove unnecessary code, improving maintainability and performance.
|
6
6
|
|
7
|
-
## Installation
|
8
7
|
|
9
|
-
|
8
|
+
## Features
|
9
|
+
|
10
|
+
- Scans for method definitions across various directories (models, controllers, helpers, views, and more).
|
11
|
+
- Checks for method usage in code files and view templates.
|
12
|
+
- Reports methods that are defined but not used in the project.
|
13
|
+
|
14
|
+
## Installation
|
10
15
|
|
11
|
-
|
16
|
+
Add this line to your application's `Gemfile`:
|
12
17
|
|
13
|
-
|
18
|
+
```ruby
|
19
|
+
gem 'un_used_methods'
|
20
|
+
```
|
14
21
|
|
15
|
-
|
22
|
+
Then run:
|
16
23
|
|
17
|
-
|
24
|
+
```ruby
|
25
|
+
bundle install
|
26
|
+
```
|
18
27
|
|
19
28
|
## Usage
|
20
29
|
|
21
|
-
|
30
|
+
To use the gem, run the following command:
|
22
31
|
|
23
|
-
|
32
|
+
```ruby
|
33
|
+
bundle exec un_used_methods find_unused
|
34
|
+
```
|
35
|
+
|
36
|
+
This command will analyze your codebase and print out any unused methods it finds. The gem scans through Ruby files, HTML/ERB templates, and other relevant file types to ensure comprehensive coverage.
|
24
37
|
|
25
|
-
|
38
|
+
## Example Output
|
26
39
|
|
27
|
-
|
40
|
+
```plaintext
|
41
|
+
Method 'test' called in file: app/models/test.rb
|
42
|
+
Method 'another_method' not called anywhere in the project
|
43
|
+
|
44
|
+
Unused Methods found in your model, controller and helper directories:
|
45
|
+
app/models/test.rb: another_method
|
46
|
+
```
|
47
|
+
|
48
|
+
## Configuration
|
49
|
+
|
50
|
+
The gem uses default settings to scan common directories and file types. If you need to customize the directories or file types to scan, you can modify the gem's configuration within the codebase.
|
51
|
+
|
52
|
+
## Development
|
28
53
|
|
29
|
-
|
54
|
+
To contribute to the development of this gem:
|
30
55
|
|
31
|
-
|
56
|
+
1. Fork the repository.
|
57
|
+
2. Create a new branch (`git checkout -b feature/your-feature`).
|
58
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
59
|
+
4. Push to the branch (`git push origin feature/your-feature`).
|
60
|
+
5. Create a new Pull Request.
|
61
|
+
6. Write RSpec test cases for the features you added.
|
32
62
|
|
33
63
|
## License
|
34
64
|
|
35
|
-
|
65
|
+
This gem is available as open source under the terms of the MIT License.
|
36
66
|
|
37
|
-
##
|
67
|
+
## Acknowledgements
|
38
68
|
|
39
|
-
|
69
|
+
This gem leverages concepts from static code analysis and method usage detection to enhance code quality.
|
data/Rakefile
CHANGED
@@ -1,12 +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]
|
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]
|
@@ -19,14 +19,10 @@ module UnUsedMethods
|
|
19
19
|
def find_un_used_methods
|
20
20
|
un_used_methods = []
|
21
21
|
|
22
|
-
# Analyze Models
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
un_used_methods += find_in_directory("app/controllers")
|
27
|
-
|
28
|
-
# Analyze Helpers
|
29
|
-
un_used_methods += find_in_directory("app/helpers")
|
22
|
+
# Analyze Models, Controllers, and Helpers
|
23
|
+
["app/models", "app/controllers", "app/helpers"].each do |directory|
|
24
|
+
un_used_methods += find_in_directory(directory)
|
25
|
+
end
|
30
26
|
|
31
27
|
un_used_methods
|
32
28
|
end
|
@@ -37,7 +33,7 @@ module UnUsedMethods
|
|
37
33
|
Dir.glob("#{directory}/**/*.rb").each do |file|
|
38
34
|
methods = extract_methods(file)
|
39
35
|
methods.each do |method|
|
40
|
-
un_used_methods << "#{file}: #{method}" unless method_used?(method)
|
36
|
+
un_used_methods << "#{file}: #{method}" unless method_used?(method, file)
|
41
37
|
end
|
42
38
|
end
|
43
39
|
|
@@ -46,24 +42,69 @@ module UnUsedMethods
|
|
46
42
|
|
47
43
|
def extract_methods(file)
|
48
44
|
content = File.read(file)
|
45
|
+
content = strip_comments(content, file)
|
49
46
|
content.scan(/def (\w+)/).flatten
|
50
47
|
end
|
51
48
|
|
52
|
-
def method_used?(method)
|
53
|
-
|
54
|
-
|
49
|
+
def method_used?(method, definition_file)
|
50
|
+
method_call_patterns = build_method_call_patterns(method)
|
51
|
+
|
52
|
+
files = Dir.glob("app/**/*.{rb,html,erb,haml,slim,js,jsx,ts,tsx}") + Dir.glob("lib/**/*.{rb}")
|
53
|
+
|
54
|
+
# Check if method is used in any file other than its own definition file
|
55
|
+
return true if file_contains_method_call?(files, definition_file, method_call_patterns)
|
56
|
+
|
57
|
+
# Check method usage within its own file
|
58
|
+
method_called_in_own_file?(definition_file, method_call_patterns)
|
59
|
+
end
|
60
|
+
|
61
|
+
def build_method_call_patterns(method)
|
62
|
+
[
|
63
|
+
/(\.|^|\s)#{method}\s*\(/, # Matches method calls with parameters
|
64
|
+
/(\.|^|\s)#{method}\b(?!\()/ # Matches method calls without parameters
|
65
|
+
]
|
66
|
+
end
|
55
67
|
|
68
|
+
def file_contains_method_call?(files, definition_file, patterns)
|
56
69
|
files.any? do |file|
|
57
|
-
|
58
|
-
|
70
|
+
next if file == definition_file
|
71
|
+
|
72
|
+
content = read_file(file)
|
73
|
+
patterns.any? { |pattern| content.match?(pattern) }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def method_called_in_own_file?(definition_file, patterns)
|
78
|
+
content = read_file(definition_file)
|
79
|
+
patterns.any? { |pattern| content.scan(pattern).count > 1 }
|
80
|
+
end
|
81
|
+
|
82
|
+
def read_file(file)
|
83
|
+
content = File.read(file)
|
84
|
+
strip_comments(content, file)
|
85
|
+
end
|
86
|
+
|
87
|
+
def strip_comments(content, file)
|
88
|
+
case File.extname(file)
|
89
|
+
when ".rb"
|
90
|
+
# Remove Ruby comments
|
91
|
+
content.gsub(/#.*$/, "")
|
92
|
+
when ".erb", ".html", ".haml", ".slim"
|
93
|
+
# Remove HTML, ERB, HAML, SLIM comments
|
94
|
+
content.gsub(/<!--.*?-->/m, "").gsub(/<%#.*?%>/m, "")
|
95
|
+
when ".js", ".jsx", ".ts", ".tsx"
|
96
|
+
# Remove JavaScript/TypeScript comments
|
97
|
+
content.gsub(%r{//.*$}, "").gsub(%r{/\*.*?\*/}m, "")
|
98
|
+
else
|
99
|
+
content
|
59
100
|
end
|
60
101
|
end
|
61
102
|
|
62
103
|
def report_un_used_methods(unused_methods)
|
63
104
|
if unused_methods.empty?
|
64
|
-
|
105
|
+
p "No un used methods found!"
|
65
106
|
else
|
66
|
-
|
107
|
+
p "Un used Methods found in your model, controller, and helper directories:"
|
67
108
|
unused_methods.each { |method| puts method }
|
68
109
|
end
|
69
110
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module UnUsedMethods
|
4
|
-
VERSION = "0.1.
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module UnUsedMethods
|
4
|
+
VERSION = "0.1.2"
|
5
|
+
end
|
data/sig/un_used_methods.rbs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module UnUsedMethods
|
2
|
-
VERSION: String
|
3
|
-
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
4
|
-
end
|
1
|
+
module UnUsedMethods
|
2
|
+
VERSION: String
|
3
|
+
# See the writing guide of rbs: https://github.com/ruby/rbs#guides
|
4
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: un_used_methods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dhamo1107
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/un_used_methods/cli.rb
|
96
96
|
- lib/un_used_methods/version.rb
|
97
97
|
- sig/un_used_methods.rbs
|
98
|
+
- un_used_methods-0.1.0.gem
|
98
99
|
homepage: https://github.com/Dhamo1107/un_used_methods
|
99
100
|
licenses:
|
100
101
|
- MIT
|
@@ -118,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
119
|
- !ruby/object:Gem::Version
|
119
120
|
version: '0'
|
120
121
|
requirements: []
|
121
|
-
rubygems_version: 3.3.
|
122
|
+
rubygems_version: 3.3.27
|
122
123
|
signing_key:
|
123
124
|
specification_version: 4
|
124
125
|
summary: A gem to identify and list unused methods in your Rails application.
|