Skip to content

Commit 1396c7c

Browse files
authored
Merge pull request #26 from fastruby/fixes/skunk-action
Run compare only when we are running action within a PR (branch != "master")
2 parents 39f3ea6 + 0315f34 commit 1396c7c

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

.github/workflows/skunk.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Skunk
2-
on: [push, pull_request]
2+
on: [push]
33

44
jobs:
55
skunk:
@@ -11,14 +11,19 @@ jobs:
1111
uses: actions/setup-ruby@v1
1212
with:
1313
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
1419
- name: Run Skunk on Project
1520
run: |
1621
gem install skunk
1722
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
18-
if [[ "$CURRENT_BRANCH" -ne "master" ]]; then
23+
if [[ "$CURRENT_BRANCH" != "master" ]]; then
1924
echo "Executing within branch: $CURRENT_BRANCH"
20-
skunk lib/
25+
skunk lib/ -b master
2126
else
2227
echo "Executing within master branch"
23-
skunk lib/ -b master
28+
skunk lib/
2429
fi

Gemfile.lock

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ GEM
3737
sexp_processor (~> 4.8)
3838
ice_nine (0.11.2)
3939
jaro_winkler (1.5.4)
40-
json (2.2.0)
4140
kwalify (0.7.2)
4241
launchy (2.4.3)
4342
addressable (~> 2.3)
@@ -80,15 +79,14 @@ GEM
8079
tty-which (~> 0.4.0)
8180
virtus (~> 1.0)
8281
sexp_processor (4.14.0)
83-
simplecov (0.17.1)
82+
simplecov (0.18.1)
8483
docile (~> 1.1)
85-
json (>= 1.8, < 3)
86-
simplecov-html (~> 0.10.0)
84+
simplecov-html (~> 0.11.0)
8785
simplecov-console (0.5.0)
8886
ansi
8987
simplecov
9088
terminal-table
91-
simplecov-html (0.10.2)
89+
simplecov-html (0.11.0)
9290
terminal-table (1.8.0)
9391
unicode-display_width (~> 1.1, >= 1.1.1)
9492
thread_safe (0.3.6)
@@ -111,7 +109,7 @@ DEPENDENCIES
111109
rake (~> 10.0)
112110
reek (~> 5.4.0)
113111
rubocop (< 1.0)
114-
simplecov (~> 0.17.1)
112+
simplecov (~> 0.18.1)
115113
simplecov-console (= 0.5.0)
116114
skunk!
117115

lib/skunk/cli/commands/compare.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def analyse_modified_files
3030
# create a txt file with the branch score details
3131
def build_details
3232
details = "Base branch (#{::RubyCritic::Config.base_branch}) "\
33-
"average stink score: #{::RubyCritic::Config.base_branch_score} \n"\
33+
"average stink score: #{::RubyCritic::Config.base_branch_score.to_f.round(2)} \n"\
3434
"Feature branch (#{::RubyCritic::Config.feature_branch}) "\
35-
"average stink score: #{::RubyCritic::Config.feature_branch_score} \n"
35+
"average stink score: #{::RubyCritic::Config.feature_branch_score.to_f.round(2)} \n"
3636
Skunk::Command::Output.create_directory(::RubyCritic::Config.compare_root_directory)
3737
File.open(build_details_path, "w") { |file| file.write(details) }
3838
puts details

lib/skunk/cli/commands/status_reporter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def total_churn_times_cost
6464
def stink_score_average
6565
return 0 if analysed_modules_count.zero?
6666

67-
(total_stink_score.to_d / analysed_modules_count).to_f
67+
(total_stink_score.to_d / analysed_modules_count).to_f.round(2)
6868
end
6969

7070
def table_options

skunk.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ Gem::Specification.new do |spec|
4646
spec.add_development_dependency "rake", "~> 10.0"
4747
spec.add_development_dependency "reek", "~> 5.4.0"
4848
spec.add_development_dependency "rubocop", "< 1.0"
49-
spec.add_development_dependency "simplecov", "~> 0.17.1"
49+
spec.add_development_dependency "simplecov", "~> 0.18.1"
5050
spec.add_development_dependency "simplecov-console", "0.5.0"
5151
end

test/test_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
]
1111

1212
SimpleCov.start do
13-
track_files "/lib/"
13+
track_files "lib/**/*.rb"
1414
end
1515
end
1616

0 commit comments

Comments
 (0)