From fd8511d9ed913258d05d4d08f2b9988da2878313 Mon Sep 17 00:00:00 2001 From: Juan Vasquez Date: Fri, 9 Sep 2022 14:32:58 -0500 Subject: [PATCH 1/4] Fix analyzed module test --- lib/skunk/cli/commands/status_reporter.rb | 2 +- lib/skunk/cli/commands/status_sharer.rb | 2 -- lib/skunk/cli/options/argv.rb | 2 +- lib/skunk/rubycritic/analysed_module.rb | 2 -- test/lib/skunk/rubycritic/analysed_module_test.rb | 4 ++-- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/skunk/cli/commands/status_reporter.rb b/lib/skunk/cli/commands/status_reporter.rb index 2bb2364..be43eef 100644 --- a/lib/skunk/cli/commands/status_reporter.rb +++ b/lib/skunk/cli/commands/status_reporter.rb @@ -75,7 +75,7 @@ def table_options width = max.pathname.to_s.length + HEADINGS_WITHOUT_FILE_WIDTH { style: { - width: width # rubocop:disable Style/HashSyntax + width: width } } end diff --git a/lib/skunk/cli/commands/status_sharer.rb b/lib/skunk/cli/commands/status_sharer.rb index f496a05..af480d0 100644 --- a/lib/skunk/cli/commands/status_sharer.rb +++ b/lib/skunk/cli/commands/status_sharer.rb @@ -38,7 +38,6 @@ def base_url ENV["SHARE_URL"] || DEFAULT_URL end - # rubocop:disable Style/HashSyntax def json_summary result = { total_skunk_score: total_skunk_score, @@ -56,7 +55,6 @@ def json_summary result end - # rubocop:enable Style/HashSyntax def json_results sorted_modules.map(&:to_hash) diff --git a/lib/skunk/cli/options/argv.rb b/lib/skunk/cli/options/argv.rb index f04823e..7b8baa8 100644 --- a/lib/skunk/cli/options/argv.rb +++ b/lib/skunk/cli/options/argv.rb @@ -37,7 +37,7 @@ def parse # rubocop:disable Metrics/MethodLength end def to_h - super.merge(output_filename: output_filename) # rubocop:disable Style/HashSyntax + super.merge(output_filename: output_filename) end end end diff --git a/lib/skunk/rubycritic/analysed_module.rb b/lib/skunk/rubycritic/analysed_module.rb index 6c903ad..696e89a 100644 --- a/lib/skunk/rubycritic/analysed_module.rb +++ b/lib/skunk/rubycritic/analysed_module.rb @@ -53,7 +53,6 @@ def churn_times_cost # - coverage # # @return [Hash] - # rubocop:disable Style/HashSyntax def to_hash { file: pathname.to_s, @@ -64,6 +63,5 @@ def to_hash coverage: coverage.round(2) } end - # rubocop:enable Style/HashSyntax end end diff --git a/test/lib/skunk/rubycritic/analysed_module_test.rb b/test/lib/skunk/rubycritic/analysed_module_test.rb index fd133ec..98ba1bf 100644 --- a/test/lib/skunk/rubycritic/analysed_module_test.rb +++ b/test/lib/skunk/rubycritic/analysed_module_test.rb @@ -60,8 +60,8 @@ { file: "samples/rubycritic/analysed_module.rb", skunk_score: 58.88, - churn_times_cost: 2.94, - churn: 5, + churn_times_cost: 2.36, + churn: 4, cost: 0.59, coverage: 0.0 } From e37cd1ab0622e917db52f18261f9479ba8918357 Mon Sep 17 00:00:00 2001 From: Juan Vasquez Date: Fri, 9 Sep 2022 14:34:24 -0500 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44602a7..a30b33d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## main [(unreleased)](https://github.com/fastruby/skunk/compare/v0.5.2...HEAD) * +* [BUGFIX: Fix analized module test](https://github.com/fastruby/skunk/pull/98) + ## v0.5.2 / 2022-04-27 [(commits)](https://github.com/fastruby/skunk/compare/v0.5.1...v0.5.2) * [FEATURE: Support more rubies](https://github.com/fastruby/skunk/pull/92) From c5ca1b66cfc1cac2b2c1c39afd6e5e32f5d5e644 Mon Sep 17 00:00:00 2001 From: Juan Vasquez Date: Fri, 9 Sep 2022 14:43:13 -0500 Subject: [PATCH 3/4] Update checkout to v2 --- .github/workflows/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e44fa1..eeba4d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -61,7 +61,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -76,7 +76,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -91,7 +91,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -101,4 +101,4 @@ jobs: run: | gem install bundler bundle install --jobs 4 --retry 3 - bundle exec rake \ No newline at end of file + bundle exec rake From 1e052af3c1c9ae13c9166f09105771b9b10e70a0 Mon Sep 17 00:00:00 2001 From: Juan Vasquez Date: Fri, 9 Sep 2022 16:19:01 -0500 Subject: [PATCH 4/4] Stub churn --- test/lib/skunk/rubycritic/analysed_module_test.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/lib/skunk/rubycritic/analysed_module_test.rb b/test/lib/skunk/rubycritic/analysed_module_test.rb index 98ba1bf..3c108fb 100644 --- a/test/lib/skunk/rubycritic/analysed_module_test.rb +++ b/test/lib/skunk/rubycritic/analysed_module_test.rb @@ -60,15 +60,17 @@ { file: "samples/rubycritic/analysed_module.rb", skunk_score: 58.88, - churn_times_cost: 2.36, - churn: 4, + churn_times_cost: 2.94, + churn: 5, cost: 0.59, coverage: 0.0 } end it "returns a hash with all the attributes and values" do - _(@analysed_module.to_hash).must_equal result + @analysed_module.stub(:churn, 5) do + _(@analysed_module.to_hash).must_equal result + end end end end