skunk 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +21 -69
- data/.github/workflows/skunk.yml +4 -3
- data/.reek.yml +4 -3
- data/.rubocop_todo.yml +16 -16
- data/CHANGELOG.md +12 -1
- data/CONTRIBUTING.md +84 -0
- data/Gemfile +4 -0
- data/Gemfile-Ruby-2-4 +3 -0
- data/Gemfile-Ruby-2-5 +13 -0
- data/README.md +104 -156
- data/lib/skunk/cli/application.rb +3 -3
- data/lib/skunk/cli/options/argv.rb +1 -1
- data/lib/skunk/command_factory.rb +25 -0
- data/lib/skunk/commands/base.rb +20 -0
- data/lib/skunk/commands/compare.rb +64 -0
- data/lib/skunk/commands/compare_score.rb +39 -0
- data/lib/skunk/commands/default.rb +47 -0
- data/lib/skunk/commands/help.rb +25 -0
- data/lib/skunk/commands/shareable.rb +25 -0
- data/lib/skunk/{cli/commands → commands}/status_reporter.rb +1 -1
- data/lib/skunk/{cli/commands → commands}/status_sharer.rb +1 -3
- data/lib/skunk/commands/version.rb +20 -0
- data/lib/skunk/rubycritic/analysed_module.rb +15 -9
- data/lib/skunk/version.rb +1 -1
- data/skunk.gemspec +5 -6
- metadata +34 -50
- data/CODEOWNERS +0 -5
- data/lib/skunk/cli/command_factory.rb +0 -27
- data/lib/skunk/cli/commands/base.rb +0 -22
- data/lib/skunk/cli/commands/compare.rb +0 -66
- data/lib/skunk/cli/commands/compare_score.rb +0 -41
- data/lib/skunk/cli/commands/default.rb +0 -49
- data/lib/skunk/cli/commands/help.rb +0 -27
- data/lib/skunk/cli/commands/shareable.rb +0 -27
- data/lib/skunk/cli/commands/version.rb +0 -22
- /data/lib/skunk/{cli/commands → commands}/output.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 816d1842d51cccffa9e5284adc57ab7650bad54ef646e31bf8ac7941cd9dbb96
|
4
|
+
data.tar.gz: aaa37f4214a723eaacb3ddbae476f084f75e13b2c3fd156ab841ff9d6930739c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ede49233f3739dc19fb14bc2633acc8dbd2fbc87493673ed11eaeb22ecca3e7efa6e53c65b6e41548c8b30e00bb54349372429adc7fe9152fe77b8c12073bde1
|
7
|
+
data.tar.gz: e22e1e0d5e2bb43f1f7188b7eda3d36613baa6c3e68dd2e63d7664f01b9f7f89cc9ff3be6b72d96d75a667ebf5f836d175df4a379162193865084ad4ec4abd31
|
data/.github/workflows/main.yml
CHANGED
@@ -1,104 +1,56 @@
|
|
1
|
-
# .github/workflows/
|
1
|
+
# .github/workflows/main.yml
|
2
2
|
|
3
3
|
name: CI
|
4
|
-
on:
|
5
|
-
push:
|
6
|
-
branches:
|
7
|
-
- main
|
8
|
-
pull_request:
|
9
|
-
branches:
|
10
|
-
- main
|
4
|
+
on: [push, pull_request]
|
11
5
|
|
12
6
|
jobs:
|
13
7
|
test-ruby-2-4-x:
|
14
8
|
runs-on: ubuntu-latest
|
15
|
-
|
16
9
|
steps:
|
17
|
-
- uses: actions/checkout@
|
18
|
-
- name: Setup Ruby
|
10
|
+
- uses: actions/checkout@v2
|
11
|
+
- name: Setup Ruby 2.4
|
19
12
|
uses: ruby/setup-ruby@v1
|
20
13
|
with:
|
21
14
|
ruby-version: 2.4
|
22
|
-
bundler-cache: true
|
23
15
|
- name: Build and run tests
|
24
16
|
env:
|
25
17
|
BUNDLE_GEMFILE: "Gemfile-Ruby-2-4"
|
26
18
|
run: |
|
27
|
-
gem install bundler
|
19
|
+
gem install bundler -v 2.3
|
28
20
|
bundle install --jobs 4 --retry 3
|
29
21
|
bundle exec rake
|
22
|
+
|
30
23
|
test-ruby-2-5-x:
|
31
24
|
runs-on: ubuntu-latest
|
32
|
-
|
33
25
|
steps:
|
34
|
-
- uses: actions/checkout@
|
35
|
-
- name: Setup Ruby
|
26
|
+
- uses: actions/checkout@v2
|
27
|
+
- name: Setup Ruby 2.5
|
36
28
|
uses: ruby/setup-ruby@v1
|
37
29
|
with:
|
38
30
|
ruby-version: 2.5
|
39
|
-
bundler-cache: true
|
40
|
-
- name: Build and run tests
|
41
|
-
run: |
|
42
|
-
gem install bundler
|
43
|
-
bundle install --jobs 4 --retry 3
|
44
|
-
bundle exec rake
|
45
|
-
test-ruby-2-6-x:
|
46
|
-
runs-on: ubuntu-latest
|
47
|
-
|
48
|
-
steps:
|
49
|
-
- uses: actions/checkout@v1
|
50
|
-
- name: Setup Ruby
|
51
|
-
uses: ruby/setup-ruby@v1
|
52
|
-
with:
|
53
|
-
ruby-version: 2.6
|
54
|
-
bundler-cache: true
|
55
|
-
- name: Build and run tests
|
56
|
-
run: |
|
57
|
-
gem install bundler
|
58
|
-
bundle install --jobs 4 --retry 3
|
59
|
-
bundle exec rake
|
60
|
-
test-ruby-2-7-x:
|
61
|
-
runs-on: ubuntu-latest
|
62
|
-
|
63
|
-
steps:
|
64
|
-
- uses: actions/checkout@v1
|
65
|
-
- name: Setup Ruby
|
66
|
-
uses: ruby/setup-ruby@v1
|
67
|
-
with:
|
68
|
-
ruby-version: 2.7
|
69
|
-
bundler-cache: true
|
70
31
|
- name: Build and run tests
|
32
|
+
env:
|
33
|
+
BUNDLE_GEMFILE: "Gemfile-Ruby-2-5"
|
71
34
|
run: |
|
72
|
-
gem install bundler
|
35
|
+
gem install bundler -v 2.3.26
|
73
36
|
bundle install --jobs 4 --retry 3
|
74
37
|
bundle exec rake
|
75
|
-
test-ruby-3-0-x:
|
76
|
-
runs-on: ubuntu-latest
|
77
38
|
|
39
|
+
test-ruby:
|
40
|
+
runs-on: ${{ matrix.os }}-latest
|
41
|
+
strategy:
|
42
|
+
matrix:
|
43
|
+
os: [ubuntu]
|
44
|
+
ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2"]
|
78
45
|
steps:
|
79
|
-
- uses: actions/checkout@
|
80
|
-
- name: Setup Ruby
|
46
|
+
- uses: actions/checkout@v2
|
47
|
+
- name: Setup Ruby ${{ matrix.ruby-version }}
|
81
48
|
uses: ruby/setup-ruby@v1
|
82
49
|
with:
|
83
|
-
ruby-version:
|
50
|
+
ruby-version: ${{ matrix.ruby-version }}
|
84
51
|
bundler-cache: true
|
85
52
|
- name: Build and run tests
|
86
53
|
run: |
|
87
|
-
gem install bundler
|
54
|
+
gem install bundler -v 2.4.6
|
88
55
|
bundle install --jobs 4 --retry 3
|
89
56
|
bundle exec rake
|
90
|
-
test-ruby-3-1-x:
|
91
|
-
runs-on: ubuntu-latest
|
92
|
-
|
93
|
-
steps:
|
94
|
-
- uses: actions/checkout@v1
|
95
|
-
- name: Setup Ruby
|
96
|
-
uses: ruby/setup-ruby@v1
|
97
|
-
with:
|
98
|
-
ruby-version: 3.1
|
99
|
-
bundler-cache: true
|
100
|
-
- name: Build and run tests
|
101
|
-
run: |
|
102
|
-
gem install bundler
|
103
|
-
bundle install --jobs 4 --retry 3
|
104
|
-
bundle exec rake
|
data/.github/workflows/skunk.yml
CHANGED
@@ -6,11 +6,12 @@ jobs:
|
|
6
6
|
runs-on: ubuntu-latest
|
7
7
|
|
8
8
|
steps:
|
9
|
-
- uses: actions/checkout@
|
9
|
+
- uses: actions/checkout@v2
|
10
10
|
- name: Setup Ruby
|
11
|
-
uses:
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
12
|
with:
|
13
|
-
ruby-version:
|
13
|
+
ruby-version: 3.1
|
14
|
+
bundler-cache: true
|
14
15
|
- name: Run test suite with COVERAGE=true
|
15
16
|
run: |
|
16
17
|
gem install bundler
|
data/.reek.yml
CHANGED
@@ -24,6 +24,7 @@ detectors:
|
|
24
24
|
- Skunk::Cli::Options::Argv#parse
|
25
25
|
UtilityFunction:
|
26
26
|
exclude:
|
27
|
-
-
|
28
|
-
- Skunk::
|
29
|
-
- Skunk::
|
27
|
+
- capture_output_streams
|
28
|
+
- Skunk::Command::Compare#analyse_modified_files
|
29
|
+
- Skunk::Command::Compare#build_details_path
|
30
|
+
- Skunk::Command::Shareable#sharing?
|
data/.rubocop_todo.yml
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-07-22 00:31:00 UTC using RuboCop version 1.54.2.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
10
|
-
# Configuration parameters: Include.
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: Severity, Include.
|
11
11
|
# Include: **/*.gemspec
|
12
12
|
Gemspec/RequiredRubyVersion:
|
13
13
|
Exclude:
|
14
|
-
- 'gemfiles/skunk.gemspec'
|
15
14
|
- 'skunk.gemspec'
|
16
15
|
|
17
16
|
# Offense count: 1
|
18
|
-
#
|
17
|
+
# This cop supports safe autocorrection (--autocorrect).
|
19
18
|
Layout/ClosingHeredocIndentation:
|
20
19
|
Exclude:
|
21
|
-
- 'lib/skunk/
|
20
|
+
- 'lib/skunk/commands/status_reporter.rb'
|
22
21
|
|
23
22
|
# Offense count: 1
|
24
|
-
#
|
23
|
+
# This cop supports safe autocorrection (--autocorrect).
|
25
24
|
Layout/HeredocIndentation:
|
26
25
|
Exclude:
|
27
|
-
- 'lib/skunk/
|
26
|
+
- 'lib/skunk/commands/status_reporter.rb'
|
28
27
|
|
29
28
|
# Offense count: 2
|
29
|
+
# Configuration parameters: AllowedParentClasses.
|
30
30
|
Lint/MissingSuper:
|
31
31
|
Exclude:
|
32
32
|
- 'lib/skunk/cli/application.rb'
|
33
|
-
- 'lib/skunk/
|
33
|
+
- 'lib/skunk/commands/base.rb'
|
34
34
|
|
35
35
|
# Offense count: 1
|
36
|
-
# Configuration parameters:
|
36
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
37
37
|
Metrics/AbcSize:
|
38
38
|
Max: 18
|
39
39
|
|
40
40
|
# Offense count: 7
|
41
|
-
# Configuration parameters: CountComments, CountAsOne,
|
42
|
-
#
|
41
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
42
|
+
# AllowedMethods: refine
|
43
43
|
Metrics/BlockLength:
|
44
44
|
Max: 76
|
45
45
|
|
46
46
|
# Offense count: 2
|
47
|
-
# Configuration parameters: CountComments, CountAsOne,
|
47
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
48
48
|
Metrics/MethodLength:
|
49
49
|
Max: 13
|
50
50
|
|
51
51
|
# Offense count: 1
|
52
|
-
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
|
52
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
53
53
|
# SupportedStyles: snake_case, normalcase, non_integer
|
54
|
-
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
54
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
55
55
|
Naming/VariableNumber:
|
56
56
|
Exclude:
|
57
|
-
- 'lib/skunk/
|
57
|
+
- 'lib/skunk/commands/status_sharer.rb'
|
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
-
## main [(unreleased)](https://github.com/fastruby/skunk/compare/v0.5.
|
8
|
+
## main [(unreleased)](https://github.com/fastruby/skunk/compare/v0.5.3...HEAD)
|
9
9
|
|
10
10
|
* <INSERT YOUR FEATURE OR BUGFIX HERE>
|
11
|
+
|
12
|
+
## v0.5.3 / 2023-12-01 [(commits)](https://github.com/fastruby/skunk/compare/v0.5.2...v0.5.3)
|
13
|
+
|
14
|
+
* [BUGFIX: Update reek, rubocop, and terminal-table dependencies](https://github.com/fastruby/skunk/pull/111)
|
15
|
+
* [BUGFIX: Better test coverage tracking for skunk](https://github.com/fastruby/skunk/pull/108)
|
16
|
+
* [FEATURE: Add Ruby 3.2 Support](https://github.com/fastruby/skunk/pull/106)
|
17
|
+
* [BUGFIX: Fix skunk workflow](https://github.com/fastruby/skunk/pull/104)
|
18
|
+
* [BUGFIX: Fix documentation and refactor `skunk_score` method](https://github.com/fastruby/skunk/pull/102)
|
19
|
+
* [FEATURE: Improve main workflow](https://github.com/fastruby/skunk/pull/99)
|
20
|
+
* [BUGFIX: Fix analized module test](https://github.com/fastruby/skunk/pull/98)
|
21
|
+
|
11
22
|
## v0.5.2 / 2022-04-27 [(commits)](https://github.com/fastruby/skunk/compare/v0.5.1...v0.5.2)
|
12
23
|
|
13
24
|
* [FEATURE: Support more rubies](https://github.com/fastruby/skunk/pull/92)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributing to Skunk
|
2
|
+
Have a fix for a problem you've been running into or an idea for a new feature you think would be useful? Bug reports and pull requests are welcome on GitHub at [https://github.com/fastruby/skunk](https://github.com/fastruby/skunk).
|
3
|
+
|
4
|
+
Here's what you need to do:
|
5
|
+
|
6
|
+
- Read and understand the [Code of Conduct](https://github.com/fastruby/skunk/blob/main/CODE_OF_CONDUCT.md).
|
7
|
+
- Fork this repo and clone your fork to somewhere on your machine.
|
8
|
+
- [Ensure that you have a working environment](#setting-up-your-environment)
|
9
|
+
- Read up on the [architecture of the gem](#architecture), and [run the tests](#running-all-tests).
|
10
|
+
- Cut a new branch and write a failing test for the feature or bug fix you plan on implementing.
|
11
|
+
- [Update the changelog when applicable](#a-word-on-the-changelog).
|
12
|
+
- Read the guidelines when [Releasing a new version](#releasing-a-new-version)
|
13
|
+
- Push to your fork and submit a pull request.
|
14
|
+
- [Make sure the test suite passes on GitHub Actions and make any necessary changes to your branch to bring it to green.](#continuous-integration).
|
15
|
+
- Check out the [Help Wanted](#help-wanted) section for suggestions on how to support Skunk.
|
16
|
+
|
17
|
+
## Setting up your environment
|
18
|
+
To install the dependencies, run:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
bin/setup
|
22
|
+
```
|
23
|
+
|
24
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment with the gem.
|
25
|
+
|
26
|
+
To install this gem onto your local machine, run:
|
27
|
+
|
28
|
+
`bundle exec rake install`.
|
29
|
+
|
30
|
+
## Architecture
|
31
|
+
|
32
|
+
This project follows the typical structure for a gem: code is located in `lib` and tests are in `test`.
|
33
|
+
|
34
|
+
Under `/lib/skunk`, you find the CLI commands. Under `lib/skunk/rubycritic` you find skunk's extension from `rubycritic` gem.
|
35
|
+
|
36
|
+
### Running all tests
|
37
|
+
|
38
|
+
To run all of the tests, simply run:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
bundle exec rake
|
42
|
+
```
|
43
|
+
|
44
|
+
## A word on the changelog
|
45
|
+
You may also notice that we have a changelog in the form of [CHANGELOG.md](CHANGELOG.md). We use a format based on [Keep A Changelog](https://keepachangelog.com/en/1.0.0/).
|
46
|
+
|
47
|
+
The important things to keep in mind are:
|
48
|
+
|
49
|
+
- If your PR closes any open GitHub issue, make sure you include `Closes #XXXX` in your comment.
|
50
|
+
- New additions get added under the main (unreleased) heading;
|
51
|
+
- Attach a link to the PR with the following format:
|
52
|
+
|
53
|
+
* [<FEATURE | BUGFIX | CHORE>: Description of changes](github.com/link/to/pr).
|
54
|
+
|
55
|
+
## Releasing a new version
|
56
|
+
To release a new version, update the version number in `version.rb`.
|
57
|
+
|
58
|
+
To create a git tag for the version, push git commits and tags, and push the `.gem` file to rubygems.org, run:
|
59
|
+
|
60
|
+
`bundle exec rake release`
|
61
|
+
|
62
|
+
## When Submitting a Pull Request:
|
63
|
+
* If your PR closes any open GitHub issues, please include `Closes #XXXX` in your comment.
|
64
|
+
* Please include a summary of the change and which issue is fixed or which feature is introduced.
|
65
|
+
* If changes to the behavior are made, clearly describe what are the changes and why.
|
66
|
+
* If changes to the UI are made, please include screenshots of the before and after.
|
67
|
+
|
68
|
+
## Continuous integration
|
69
|
+
After opening your Pull Request, please make sure that all tests pass on the CI, to make sure your changes work in all possible environments. GitHub Actions will kick in after you push up a branch or open a PR.
|
70
|
+
|
71
|
+
If the build fails, click on a failed job and scroll through its output to verify what is the problem. Push your changes to your branch until the build is green.
|
72
|
+
|
73
|
+
## Help Wanted
|
74
|
+
Skunk's formula is not perfect and it is certainly controversial. The SkunkScore could be calculated per method. This would provide a more accurate representation of the average SkunkScore in a module.
|
75
|
+
|
76
|
+
The SkunkScore of a module should be the average of the SkunkScores of all of its methods. Right now the SkunkScore is calculated using the totals for a module:
|
77
|
+
|
78
|
+
- Total Code Coverage Percentage per Module
|
79
|
+
- Total Churn per Module
|
80
|
+
- Total Cost per Module
|
81
|
+
|
82
|
+
Feel free to review and submit your suggestions to improve the method [RubyCritic::AnalysedModule#skunk_score](https://github.com/fastruby/skunk/blob/main/lib/skunk/rubycritic/analysed_module.rb#L33).
|
83
|
+
|
84
|
+
📘 Read [Escaping The Tar Pit: Introducing Skunk v0.3.2 at RubyConf 2019](https://www.fastruby.io/blog/code-quality/escaping-the-tar-pit-at-rubyconf.html) and [Churn vs. Complexity vs. Code Coverage](https://www.fastruby.io/blog/code-quality/churn-vs-complexity-vs-coverage.html) for more details about the `skunk_score` method.
|
data/Gemfile
CHANGED
data/Gemfile-Ruby-2-4
CHANGED
data/Gemfile-Ruby-2-5
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
6
|
+
|
7
|
+
# Specify your gem's dependencies in skunk.gemspec
|
8
|
+
gemspec
|
9
|
+
|
10
|
+
gem "reek", "~> 6.0.0"
|
11
|
+
gem "rubocop", "~> 1.0"
|
12
|
+
gem "simplecov", "< 0.19.0"
|
13
|
+
gem "vcr", "< 6.1.0"
|