skunk 0.3.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +53 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +47 -0
- data/.github/workflows/main.yml +89 -0
- data/.github/workflows/skunk.yml +29 -0
- data/.gitignore +1 -0
- data/.reek.yml +2 -7
- data/.rubocop_todo.yml +41 -18
- data/CHANGELOG.md +46 -6
- data/CODEOWNERS +5 -0
- data/Gemfile-Ruby-2-4 +10 -0
- data/README.md +78 -25
- data/fastruby-logo.png +0 -0
- data/lib/skunk.rb +1 -1
- data/lib/skunk/cli/application.rb +34 -4
- data/lib/skunk/cli/commands/base.rb +2 -0
- data/lib/skunk/cli/commands/compare.rb +52 -30
- data/lib/skunk/cli/commands/compare_score.rb +41 -0
- data/lib/skunk/cli/commands/default.rb +14 -1
- data/lib/skunk/cli/commands/help.rb +11 -1
- data/lib/skunk/cli/commands/output.rb +12 -0
- data/lib/skunk/cli/commands/shareable.rb +21 -0
- data/lib/skunk/cli/commands/status_reporter.rb +23 -16
- data/lib/skunk/cli/commands/status_sharer.rb +99 -0
- data/lib/skunk/cli/commands/version.rb +16 -0
- data/lib/skunk/cli/options/argv.rb +11 -7
- data/lib/skunk/rubycritic/analysed_module.rb +30 -10
- data/lib/skunk/rubycritic/analysed_modules_collection.rb +2 -2
- data/lib/skunk/version.rb +1 -1
- data/logo.png +0 -0
- data/samples/engines/spec/nested_sample_spec.rb +5 -0
- data/samples/rubycritic/analysed_module.rb +9 -9
- data/skunk.gemspec +14 -8
- metadata +105 -30
- data/.travis.yml +0 -5
- data/Gemfile.lock +0 -119
- data/bin/console +0 -16
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8741b921c9257b475b2bae0741cc039e8afef0556312667e57ba7986f10f7fa
|
4
|
+
data.tar.gz: 79cc09d05f4a7ac2de50461e3ec1c9351ab68803fd33c7d9166b0d1046051891
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29cd83b1f165c6e52c0196495428c80f388fd7ca7b633fe01455665632337a8a07b4bcfa26c8d29c34a23101d69ccadf858cb1615aa66812aac603850899c6df
|
7
|
+
data.tar.gz: 6b22ce77d18d98dc8f53275dfde28453a5b877a9b6e30b30fe6393321daad3ae655f13502924ba42991efe4876765e0e0317dc1e1fa3c2e4b1a769ea10f01304
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: "[BUG] "
|
5
|
+
labels: 'bug'
|
6
|
+
assignees: 'black-bunny-brigade'
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.**
|
11
|
+
|
12
|
+
**Before we start...:**
|
13
|
+
|
14
|
+
- [ ] I checked the documentation and found no answer
|
15
|
+
- [ ] I checked to make sure that this issue has not already been filed
|
16
|
+
- [ ] I'm reporting the issue to the correct repository (for multi-repository projects)
|
17
|
+
|
18
|
+
|
19
|
+
**Version, Branch, or Commit:**
|
20
|
+
|
21
|
+
Inform what version, branch, commit of Skunk you are using.
|
22
|
+
|
23
|
+
**Expected behavior:**
|
24
|
+
|
25
|
+
Please include a detailed description of the behavior you were expecting when you encountered this issue.
|
26
|
+
|
27
|
+
**Actual behavior:**
|
28
|
+
|
29
|
+
Please include a detailed description of the actual behavior of the application.
|
30
|
+
|
31
|
+
**Steps to reproduce:**
|
32
|
+
|
33
|
+
How do I achieve this behavior? Use the following format to provide a step-by-step guide:
|
34
|
+
|
35
|
+
1. Step 1: ...
|
36
|
+
2. Step 2: ...
|
37
|
+
|
38
|
+
**Context and environment:**
|
39
|
+
|
40
|
+
Provide any relevant information about your setup (Customize the list accordingly based on what info is relevant to this project)
|
41
|
+
|
42
|
+
1. Version of the software the issue is being opened for.
|
43
|
+
2. Operating System
|
44
|
+
3. Operating System version
|
45
|
+
4. Ruby version
|
46
|
+
|
47
|
+
_Delete any information that is not relevant._
|
48
|
+
|
49
|
+
**Logs**
|
50
|
+
|
51
|
+
Include relevant log snippets or files here.
|
52
|
+
|
53
|
+
**I will abide by the [code of conduct] (https://github.com/fastruby/skunk/blob/master/CODE_OF_CONDUCT.md)**
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Request a new feature
|
4
|
+
title: "[REQUEST]"
|
5
|
+
labels: 'enhancement'
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**IMPORTANT: please make sure you ask yourself all intro questions and fill all sections of the template.**
|
11
|
+
|
12
|
+
**Before we start...:**
|
13
|
+
|
14
|
+
- [ ] I checked the documentation and didn't find this feature
|
15
|
+
- [ ] I checked to make sure that this feature has not already been requested
|
16
|
+
|
17
|
+
|
18
|
+
**Branch/Commit:**
|
19
|
+
|
20
|
+
Inform what branch/commit/version of "Skunk" you are using.
|
21
|
+
|
22
|
+
**Describe the feature:**
|
23
|
+
|
24
|
+
Please include a detailed description of the feature you are requesting and any detail on it’s expected behavior.
|
25
|
+
|
26
|
+
> **As a \<role name\>**
|
27
|
+
> **I do \<something\>**
|
28
|
+
> **And then I do \<another action\>**
|
29
|
+
> **And I see \<some result\>**
|
30
|
+
|
31
|
+
**Problem:**
|
32
|
+
|
33
|
+
Please include a detailed description of the problem this feature would solve.
|
34
|
+
|
35
|
+
> **As a \<role name\>**
|
36
|
+
> **I want to \<do something\>**
|
37
|
+
> **So that I can achieve a \<goal\>**
|
38
|
+
|
39
|
+
**Mockups:**
|
40
|
+
|
41
|
+
Include any mockup idea related to the requested feature if it applies.
|
42
|
+
|
43
|
+
**Resources:**
|
44
|
+
|
45
|
+
If you have resources related to the implementation or research for this feature, add them here.
|
46
|
+
|
47
|
+
**I will abide by the [code of conduct](https://github.com/fastruby/skunk/blob/main/CODE_OF_CONDUCT.md)**
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# .github/workflows/ci.yml
|
2
|
+
|
3
|
+
name: CI
|
4
|
+
on:
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- main
|
8
|
+
pull_request:
|
9
|
+
branches:
|
10
|
+
- main
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test-ruby-2-4-x:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
|
16
|
+
steps:
|
17
|
+
- uses: actions/checkout@v1
|
18
|
+
- name: Setup Ruby
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.4
|
22
|
+
bundler-cache: true
|
23
|
+
- name: Build and run tests
|
24
|
+
env:
|
25
|
+
BUNDLE_GEMFILE: "Gemfile-Ruby-2-4"
|
26
|
+
run: |
|
27
|
+
gem install bundler
|
28
|
+
bundle install --jobs 4 --retry 3
|
29
|
+
bundle exec rake
|
30
|
+
test-ruby-2-5-x:
|
31
|
+
runs-on: ubuntu-latest
|
32
|
+
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v1
|
35
|
+
- name: Setup Ruby
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
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
|
+
- name: Build and run tests
|
71
|
+
run: |
|
72
|
+
gem install bundler
|
73
|
+
bundle install --jobs 4 --retry 3
|
74
|
+
bundle exec rake
|
75
|
+
test-ruby-3-0-x:
|
76
|
+
runs-on: ubuntu-latest
|
77
|
+
|
78
|
+
steps:
|
79
|
+
- uses: actions/checkout@v1
|
80
|
+
- name: Setup Ruby
|
81
|
+
uses: ruby/setup-ruby@v1
|
82
|
+
with:
|
83
|
+
ruby-version: 3.0
|
84
|
+
bundler-cache: true
|
85
|
+
- name: Build and run tests
|
86
|
+
run: |
|
87
|
+
gem install bundler
|
88
|
+
bundle install --jobs 4 --retry 3
|
89
|
+
bundle exec rake
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name: Skunk
|
2
|
+
on: [push, pull_request]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
skunk:
|
6
|
+
runs-on: ubuntu-latest
|
7
|
+
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v1
|
10
|
+
- name: Setup Ruby
|
11
|
+
uses: actions/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 2.6.x
|
14
|
+
- name: Run test suite with COVERAGE=true
|
15
|
+
run: |
|
16
|
+
gem install bundler
|
17
|
+
bundle install --jobs 4 --retry 3
|
18
|
+
COVERAGE=true bundle exec rake test
|
19
|
+
- name: Run Skunk on Project
|
20
|
+
run: |
|
21
|
+
gem install skunk
|
22
|
+
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
23
|
+
if [[ "$CURRENT_BRANCH" != "main" ]]; then
|
24
|
+
echo "Executing within branch: $CURRENT_BRANCH"
|
25
|
+
skunk lib/ -b master
|
26
|
+
else
|
27
|
+
echo "Executing within master branch"
|
28
|
+
skunk lib/
|
29
|
+
fi
|
data/.gitignore
CHANGED
data/.reek.yml
CHANGED
@@ -9,14 +9,10 @@ detectors:
|
|
9
9
|
- Skunk::Command::StatusReporter#table
|
10
10
|
InstanceVariableAssumption:
|
11
11
|
exclude:
|
12
|
-
- Skunk::Cli::Command::Default
|
13
12
|
- Skunk::Cli::Options::Argv
|
14
13
|
- RubyCritic::AnalysedModulesCollection
|
15
14
|
IrresponsibleModule:
|
16
15
|
exclude:
|
17
|
-
- Skunk::Cli::Command::Help
|
18
|
-
- Skunk::Cli::Options::Argv
|
19
|
-
- Skunk::Cli::Options
|
20
16
|
- RubyCritic::AnalysedModulesCollection
|
21
17
|
NestedIterators:
|
22
18
|
exclude:
|
@@ -28,6 +24,5 @@ detectors:
|
|
28
24
|
- Skunk::Cli::Options::Argv#parse
|
29
25
|
UtilityFunction:
|
30
26
|
exclude:
|
31
|
-
-
|
32
|
-
- Skunk::Command::Compare#
|
33
|
-
- Skunk::Command::Compare#build_details_path
|
27
|
+
- Skunk::Cli::Command::Compare#analyse_modified_files
|
28
|
+
- Skunk::Cli::Command::Compare#build_details_path
|
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2021-02-12 01:27:25 UTC using RuboCop version 1.9.1.
|
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: 2
|
10
|
+
# Configuration parameters: Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'gemfiles/skunk.gemspec'
|
15
|
+
- 'skunk.gemspec'
|
16
|
+
|
9
17
|
# Offense count: 1
|
10
18
|
# Cop supports --auto-correct.
|
11
19
|
Layout/ClosingHeredocIndentation:
|
@@ -14,28 +22,43 @@ Layout/ClosingHeredocIndentation:
|
|
14
22
|
|
15
23
|
# Offense count: 1
|
16
24
|
# Cop supports --auto-correct.
|
17
|
-
|
18
|
-
# SupportedStyles: squiggly, active_support, powerpack, unindent
|
19
|
-
Layout/IndentHeredoc:
|
25
|
+
Layout/HeredocIndentation:
|
20
26
|
Exclude:
|
21
27
|
- 'lib/skunk/cli/commands/status_reporter.rb'
|
22
28
|
|
23
|
-
# Offense count: 2
|
24
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
25
|
-
# ExcludedMethods: refine
|
26
|
-
Metrics/BlockLength:
|
27
|
-
Max: 40
|
28
|
-
|
29
29
|
# Offense count: 1
|
30
|
-
#
|
31
|
-
#
|
32
|
-
|
30
|
+
# Configuration parameters: AllowedMethods.
|
31
|
+
# AllowedMethods: enums
|
32
|
+
Lint/ConstantDefinitionInBlock:
|
33
|
+
Exclude:
|
34
|
+
- 'test/lib/skunk/cli/commands/help_test.rb'
|
35
|
+
|
36
|
+
# Offense count: 2
|
37
|
+
Lint/MissingSuper:
|
33
38
|
Exclude:
|
34
39
|
- 'lib/skunk/cli/application.rb'
|
40
|
+
- 'lib/skunk/cli/commands/base.rb'
|
41
|
+
|
42
|
+
# Offense count: 1
|
43
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
44
|
+
Metrics/AbcSize:
|
45
|
+
Max: 18
|
35
46
|
|
36
47
|
# Offense count: 7
|
37
|
-
#
|
38
|
-
#
|
39
|
-
|
40
|
-
|
41
|
-
|
48
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
49
|
+
# IgnoredMethods: refine
|
50
|
+
Metrics/BlockLength:
|
51
|
+
Max: 72
|
52
|
+
|
53
|
+
# Offense count: 2
|
54
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
55
|
+
Metrics/MethodLength:
|
56
|
+
Max: 13
|
57
|
+
|
58
|
+
# Offense count: 1
|
59
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
|
60
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
61
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
|
62
|
+
Naming/VariableNumber:
|
63
|
+
Exclude:
|
64
|
+
- 'lib/skunk/cli/commands/status_sharer.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,56 @@
|
|
1
1
|
# Changelog
|
2
|
+
|
2
3
|
All notable changes to this project will be documented in this file.
|
3
4
|
|
4
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
7
|
|
7
|
-
## [Unreleased]
|
8
|
+
## [Unreleased] [(commits)](https://github.com/fastruby/skunk/compare/v0.5.1...HEAD)
|
9
|
+
|
10
|
+
## [0.5.1] [(commits)](https://github.com/fastruby/skunk/compare/v0.5.0...v0.5.1)
|
11
|
+
|
12
|
+
* [BUGFIX] Fix bug related to compare plus share code (by [@etagwerker]())
|
13
|
+
|
14
|
+
## [0.5.0] [(commits)](https://github.com/fastruby/skunk/compare/v0.4.2...v0.5.0)
|
15
|
+
|
16
|
+
* [FEATURE] Share your results using an environment variable (by [@rahulpuroht]() and [@etagwerker]())
|
17
|
+
* [FEATURE] Rename the tech debt metric: StinkScore => SkunkScore. It's a little friendlier.
|
18
|
+
* [FEATURE] Add `--out=file.txt` support to the command line (by [@manuca]())
|
19
|
+
* [BUGFIX] Skip both nested and top level spec and test folders
|
20
|
+
|
21
|
+
## [0.4.2] [(commits)](https://github.com/fastruby/skunk/compare/v0.4.1...v0.4.2)
|
22
|
+
* [BUGFIX] Fixes table width issues by rounding values (by [@etagwerker]())
|
23
|
+
|
24
|
+
## [0.4.1] [(commits)](https://github.com/fastruby/skunk/compare/v0.4.0...v0.4.1)
|
25
|
+
* [BUGFIX] Fixes table width issues (by [@etagwerker]())
|
26
|
+
|
27
|
+
## [0.4.0] [(commits)](https://github.com/fastruby/skunk/compare/v0.3.2...v0.4.0)
|
28
|
+
* [FEATURE] Add `--version` support to the command line. (by [@bronzdoc]())
|
29
|
+
* [FEATURE] Stop accepting `-p <path>` in the command line. It's redundant and it's not working anyway. (by [@etagwerker]())
|
30
|
+
* [BUGFIX] Change "StinkScore" formula to skip `churn_times_cost` (by [@etagwerker]())
|
31
|
+
* [BUGFIX] Fixes #12 (by [@sebastian-palma]())
|
32
|
+
|
33
|
+
## [0.3.2] - 2019-11-23 [(commits)](https://github.com/fastruby/skunk/compare/v0.3.1...v0.3.2)
|
34
|
+
### Changed
|
35
|
+
* [BUGFIX] Change "StinkScore" formula to skip `churn_times_cost` (by [@etagwerker]())
|
36
|
+
|
37
|
+
## [0.3.1] - 2019-11-19 [(commits)](https://github.com/fastruby/skunk/compare/v0.3.0...v0.3.1)
|
38
|
+
### Changed
|
39
|
+
* [BUGFIX] Change "StinkScore" formula to skip `churn_times_cost` (by [@etagwerker]())
|
40
|
+
|
41
|
+
## [0.3.0] - 2019-11-19 [(commits)](https://github.com/fastruby/skunk/compare/v0.2.0...v0.3.0)
|
42
|
+
### Changed
|
43
|
+
* [FEATURE] Added Travis CI badge to README (by [@themayurkumbhar]())
|
44
|
+
* [FEATURE] Now you can compare "StinkScore" between branches (by [@etagwerker]())
|
45
|
+
* [BUGFIX] Add contributor covenant doc (by [@etagwerker]())
|
46
|
+
* [BUGFIX] Make sure tests work even you don't have a `coverage/.resultset.json` file (by [@etagwerker]())
|
47
|
+
* [BUGFIX] Make tests easier to maintain (by [@etagwerker]())
|
8
48
|
|
9
|
-
## [0.2.0] - 2019-10-
|
49
|
+
## [0.2.0] - 2019-10-16 [(commits)](https://github.com/fastruby/skunk/compare/v0.1.0...v0.2.0)
|
10
50
|
### Changed
|
11
|
-
- Now `skunk` will not report status for files that start with `test/` or `spec/`
|
51
|
+
- [FEATURE] Now `skunk` will not report status for files that start with `test/` or `spec/` (by [@etagwerker]())
|
12
52
|
|
13
|
-
## [0.1.0] - 2019-10-
|
53
|
+
## [0.1.0] - 2019-10-16
|
14
54
|
### Added
|
15
|
-
- Now `skunk` uses `rubycritic-simplecov` to generate a console report with a list
|
16
|
-
of files and their "StinkScore"
|
55
|
+
- [FEATURE] Now `skunk` uses `rubycritic-simplecov` to generate a console report with a list
|
56
|
+
of files and their "StinkScore" (by [@etagwerker]())
|
data/CODEOWNERS
ADDED
data/Gemfile-Ruby-2-4
ADDED
data/README.md
CHANGED
@@ -1,25 +1,27 @@
|
|
1
1
|
# Skunk
|
2
2
|
|
3
|
-
|
3
|
+

|
4
4
|
|
5
|
-
|
5
|
+
[](CODE_OF_CONDUCT.md) [](https://travis-ci.org/fastruby/skunk) [](https://codeclimate.com/github/fastruby/skunk/maintainability) [](http://rubydoc.info/gems/skunk) [](https://codecov.io/gh/fastruby/skunk)
|
6
6
|
|
7
|
-
|
7
|
+
A RubyCritic extension to calculate SkunkScore for a file or project.
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
## What is the SkunkScore?
|
10
|
+
|
11
|
+
The SkunkScore is a value that assesses the technical debt of a module. It takes
|
12
|
+
into account:
|
11
13
|
|
12
14
|
- Code Complexity
|
13
15
|
- Code Smells
|
14
16
|
- Code Coverage
|
15
17
|
|
16
|
-
The main goal of the
|
18
|
+
The main goal of the SkunkScore is to serve as a compass in your next
|
17
19
|
refactoring adventure. It will help you answer these questions:
|
18
20
|
|
19
21
|
- What can I do to pay off technical debt?
|
20
22
|
- What are the most complicated files with the least code coverage?
|
21
23
|
- What are good candidates for your next test-writing efforts?
|
22
|
-
- What are good candidates for your
|
24
|
+
- What are good candidates for your next refactoring efforts?
|
23
25
|
|
24
26
|
The formula is not perfect and it is certainly controversial, so any feedback is
|
25
27
|
welcome as a new issue!
|
@@ -42,7 +44,20 @@ Or install it yourself as:
|
|
42
44
|
|
43
45
|
## Usage
|
44
46
|
|
45
|
-
###
|
47
|
+
### Help details
|
48
|
+
|
49
|
+
There are not that many options but here they are:
|
50
|
+
|
51
|
+
```
|
52
|
+
skunk -h
|
53
|
+
Usage: skunk [options] [paths]
|
54
|
+
-b, --branch BRANCH Set branch to compare
|
55
|
+
-o, --out FILE Output report to file
|
56
|
+
-v, --version Show gem's version
|
57
|
+
-h, --help Show this message
|
58
|
+
```
|
59
|
+
|
60
|
+
### Getting a sorted list of smelly files
|
46
61
|
|
47
62
|
To get the best results, make sure that you have `coverage/.resultset.json` in
|
48
63
|
your application directory. That way `skunk` knows what's the status of your
|
@@ -54,13 +69,10 @@ Then simply run:
|
|
54
69
|
skunk
|
55
70
|
```
|
56
71
|
|
57
|
-
Then get a list of
|
72
|
+
Then get a list of smelly files:
|
58
73
|
|
59
74
|
```
|
60
75
|
$ skunk
|
61
|
-
warning: parser/current is loading parser/ruby26, which recognizes
|
62
|
-
warning: 2.6.5-compliant syntax, but you are running 2.6.2.
|
63
|
-
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
|
64
76
|
running flay smells
|
65
77
|
|
66
78
|
running flog smells
|
@@ -77,7 +89,7 @@ running simple_cov
|
|
77
89
|
.............
|
78
90
|
New critique at file:////Users/etagwerker/Projects/fastruby/skunk/tmp/rubycritic/overview.html
|
79
91
|
+-----------------------------------------------------+----------------------------+----------------------------+----------------------------+----------------------------+----------------------------+
|
80
|
-
| file |
|
92
|
+
| file | skunk_score | churn_times_cost | churn | cost | coverage |
|
81
93
|
+-----------------------------------------------------+----------------------------+----------------------------+----------------------------+----------------------------+----------------------------+
|
82
94
|
| lib/skunk/cli/commands/default.rb | 166.44 | 1.6643999999999999 | 3 | 0.5548 | 0 |
|
83
95
|
| lib/skunk/cli/application.rb | 139.2 | 1.392 | 3 | 0.46399999999999997 | 0 |
|
@@ -94,14 +106,14 @@ New critique at file:////Users/etagwerker/Projects/fastruby/skunk/tmp/rubycritic
|
|
94
106
|
| lib/skunk/cli/commands/help.rb | 0.0 | 0.0 | 2 | 0.0 | 0 |
|
95
107
|
+-----------------------------------------------------+----------------------------+----------------------------+----------------------------+----------------------------+----------------------------+
|
96
108
|
|
97
|
-
|
109
|
+
SkunkScore Total: 612.31
|
98
110
|
Modules Analysed: 13
|
99
|
-
|
100
|
-
Worst
|
111
|
+
SkunkScore Average: 0.47100769230769230769230769231e2
|
112
|
+
Worst SkunkScore: 166.44 (lib/skunk/cli/commands/default.rb)
|
101
113
|
```
|
102
114
|
|
103
115
|
The command will run `rubycritic` and it will try to load code coverage data
|
104
|
-
from your
|
116
|
+
from your `coverage/.resultset.json` file.
|
105
117
|
|
106
118
|
Skunk's report will be in the console. Use it wisely. :)
|
107
119
|
|
@@ -113,7 +125,7 @@ Simply run:
|
|
113
125
|
skunk -b <target-branch-name>
|
114
126
|
```
|
115
127
|
|
116
|
-
Then get a
|
128
|
+
Then get a SkunkScore average comparison:
|
117
129
|
|
118
130
|
```
|
119
131
|
$ skunk -b master
|
@@ -147,28 +159,63 @@ running churn
|
|
147
159
|
.................
|
148
160
|
running simple_cov
|
149
161
|
.................
|
150
|
-
Base branch (master) average
|
151
|
-
Feature branch (feature/compare) average
|
162
|
+
Base branch (master) average skunk score: 290.53999999999996
|
163
|
+
Feature branch (feature/compare) average skunk score: 340.3005882352941
|
152
164
|
Score: 340.3
|
153
165
|
```
|
154
166
|
|
155
167
|
This should give you an idea if you're moving in the right direction or not.
|
156
168
|
|
169
|
+
### Sharing results
|
170
|
+
|
171
|
+
If you want to quickly share the results of your report, you can use an
|
172
|
+
environment variable:
|
173
|
+
|
174
|
+
```
|
175
|
+
SHARE=true skunk app/
|
176
|
+
...
|
177
|
+
SkunkScore Total: 126.99
|
178
|
+
Modules Analysed: 17
|
179
|
+
SkunkScore Average: 7.47
|
180
|
+
Worst SkunkScore: 41.92 (lib/skunk/cli/commands/status_sharer.rb)
|
181
|
+
|
182
|
+
Generated with Skunk v0.5.0
|
183
|
+
Shared at: https://skunk.fastruby.io/k
|
184
|
+
```
|
185
|
+
|
186
|
+
Results will be posted by default to https://skunk.fastruby.io which is a free
|
187
|
+
and open source Ruby on Rails application sponsored by
|
188
|
+
[OmbuLabs](https://www.ombulabs.com) ([source code](https://github.com/fastruby/skunk.fyi)).
|
189
|
+
|
190
|
+
If you prefer to post results to your own server, you can do so:
|
191
|
+
|
192
|
+
```
|
193
|
+
SHARE_URL=https://path.to.your.skunk-fyi-server.example.com skunk app/
|
194
|
+
...
|
195
|
+
SkunkScore Total: 126.99
|
196
|
+
Modules Analysed: 17
|
197
|
+
SkunkScore Average: 7.47
|
198
|
+
Worst SkunkScore: 41.92 (lib/skunk/cli/commands/status_sharer.rb)
|
199
|
+
|
200
|
+
Generated with Skunk v0.5.0
|
201
|
+
Shared at: https://path.to.your.skunk-fyi-server.example.com/k
|
202
|
+
```
|
203
|
+
|
157
204
|
## Known Issues
|
158
205
|
|
159
|
-
The
|
160
|
-
representation of the average
|
206
|
+
The SkunkScore should be calculated per method. This would provide a more accurate
|
207
|
+
representation of the average SkunkScore in a module.
|
161
208
|
|
162
|
-
I think that the
|
209
|
+
I think that the SkunkScore of a module should be the average of the SkunkScores of
|
163
210
|
all of its methods.
|
164
211
|
|
165
|
-
Right now the
|
212
|
+
Right now the SkunkScore is calculated using the totals for a module:
|
166
213
|
|
167
214
|
- Total Code Coverage Percentage per Module
|
168
215
|
- Total Churn per Module
|
169
216
|
- Total Cost per Module
|
170
217
|
|
171
|
-
For more details, feel free to review and improve this method: [RubyCritic::AnalysedModule#
|
218
|
+
For more details, feel free to review and improve this method: [RubyCritic::AnalysedModule#skunk_score]
|
172
219
|
|
173
220
|
## Development
|
174
221
|
|
@@ -179,3 +226,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
179
226
|
## Contributing
|
180
227
|
|
181
228
|
Bug reports and pull requests are welcome on GitHub at https://github.com/fastruby/skunk/issues.
|
229
|
+
|
230
|
+
## Sponsorship
|
231
|
+
|
232
|
+

|
233
|
+
|
234
|
+
`skunk` is maintained and funded by [FastRuby.io](https://fastruby.io). The names and logos for FastRuby.io are trademarks of The Lean Software Boutique LLC.
|