From f1f906ee28e0f7ee6f47977334ae34d3298ef68b Mon Sep 17 00:00:00 2001 From: mmeest Date: Wed, 13 Aug 2025 13:26:16 +0300 Subject: [PATCH 1/7] initial --- .qlty/.gitignore | 7 +++ .qlty/configs/.yamllint.yaml | 21 +++++++++ .qlty/qlty.toml | 89 ++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 .qlty/.gitignore create mode 100644 .qlty/configs/.yamllint.yaml create mode 100644 .qlty/qlty.toml diff --git a/.qlty/.gitignore b/.qlty/.gitignore new file mode 100644 index 0000000..3036618 --- /dev/null +++ b/.qlty/.gitignore @@ -0,0 +1,7 @@ +* +!configs +!configs/** +!hooks +!hooks/** +!qlty.toml +!.gitignore diff --git a/.qlty/configs/.yamllint.yaml b/.qlty/configs/.yamllint.yaml new file mode 100644 index 0000000..7440066 --- /dev/null +++ b/.qlty/configs/.yamllint.yaml @@ -0,0 +1,21 @@ +extends: default + +rules: + document-start: disable + quoted-strings: + required: only-when-needed + extra-allowed: ["{|}"] + key-duplicates: {} + octal-values: + forbid-implicit-octal: true + line-length: disable + indentation: disable + new-line-at-end-of-file: disable + trailing-spaces: disable + brackets: disable + colons: disable + empty-lines: disable + comments: disable + braces: disable + comments-indentation: disable + commas: disable diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml new file mode 100644 index 0000000..cb56c28 --- /dev/null +++ b/.qlty/qlty.toml @@ -0,0 +1,89 @@ +# This file was automatically generated by `qlty init`. +# You can modify it to suit your needs. +# We recommend you to commit this file to your repository. +# +# This configuration is used by both Qlty CLI and Qlty Cloud. +# +# Qlty CLI -- Code quality toolkit for developers +# Qlty Cloud -- Fully automated Code Health Platform +# +# Try Qlty Cloud: https://qlty.sh +# +# For a guide to configuration, visit https://qlty.sh/d/config +# Or for a full reference, visit https://qlty.sh/d/qlty-toml +config_version = "0" + +exclude_patterns = [ + "*_min.*", + "*-min.*", + "*.min.*", + "**/.yarn/**", + "**/*.d.ts", + "**/assets/**", + "**/bower_components/**", + "**/build/**", + "**/cache/**", + "**/config/**", + "**/db/**", + "**/deps/**", + "**/dist/**", + "**/extern/**", + "**/external/**", + "**/generated/**", + "**/Godeps/**", + "**/gradlew/**", + "**/mvnw/**", + "**/node_modules/**", + "**/protos/**", + "**/seed/**", + "**/target/**", + "**/templates/**", + "**/testdata/**", + "**/vendor/**", "bin/", "test/", +] + +test_patterns = [ + "**/test/**", + "**/spec/**", + "**/*.test.*", + "**/*.spec.*", + "**/*_test.*", + "**/*_spec.*", + "**/test_*.*", + "**/spec_*.*", +] + +[smells] +mode = "comment" + +[smells.boolean_logic] +threshold = 4 + +[smells.file_complexity] +threshold = 55 + +[smells.return_statements] +threshold = 4 + +[smells.nested_control_flow] +threshold = 4 + +[smells.function_parameters] +threshold = 4 + +[smells.function_complexity] +threshold = 5 + +[smells.duplication] +threshold = 22 + +[[source]] +name = "default" +default = true + +[[plugin]] +name = "rubocop" + +[[plugin.fetch]] +url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop.yml" +path = ".rubocop.yml" From 928ce017c0e7585fd69d220c95f52aa5d4821caa Mon Sep 17 00:00:00 2001 From: mmeest Date: Wed, 13 Aug 2025 14:42:57 +0300 Subject: [PATCH 2/7] added up to date rubocop naming --- .qlty/qlty.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml index cb56c28..16c309e 100644 --- a/.qlty/qlty.toml +++ b/.qlty/qlty.toml @@ -85,5 +85,5 @@ default = true name = "rubocop" [[plugin.fetch]] -url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop.yml" +url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop-modern.yml" path = ".rubocop.yml" From 9b94ee800908c3d721b7c2ffda50a7fe9341ea5b Mon Sep 17 00:00:00 2001 From: mmeest Date: Thu, 14 Aug 2025 14:46:22 +0300 Subject: [PATCH 3/7] rubocop-modern --- .qlty/qlty.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.qlty/qlty.toml b/.qlty/qlty.toml index 16c309e..80084ce 100644 --- a/.qlty/qlty.toml +++ b/.qlty/qlty.toml @@ -86,4 +86,4 @@ name = "rubocop" [[plugin.fetch]] url = "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop-modern.yml" -path = ".rubocop.yml" +path = ".rubocop-modern.yml" From dde735666178b2fdb3a337d61f474ceba53ba8b9 Mon Sep 17 00:00:00 2001 From: mmeest Date: Thu, 11 Sep 2025 15:13:17 +0300 Subject: [PATCH 4/7] update coverage --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 7 ------- upload_coverage.sh | 19 +++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml create mode 100644 upload_coverage.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..33ac066 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: [ master, main ] + pull_request: + branches: [ master, main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0 + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Run tests with coverage + run: bundle exec rake test + env: + COVERAGE: true + SIMPLECOV: true + + - name: Install Qlty CLI + run: curl https://qlty.sh | sh + + - name: Upload coverage to Qlty + if: success() && github.event_name == 'push' + run: | + if [ -f coverage/coverage.json ]; then + QLTY_COVERAGE_TOKEN=${{ secrets.QLTY_COVERAGE_TOKEN }} qlty coverage publish coverage/coverage.json + echo "Coverage uploaded to Qlty successfully!" + else + echo "No coverage file found at coverage/coverage.json" + ls -la coverage/ || echo "Coverage directory does not exist" + fi + env: + QLTY_COVERAGE_TOKEN: ${{ secrets.QLTY_COVERAGE_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 08614d2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: ruby -before_script: - - "curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter" - - "chmod +x ./cc-test-reporter" - - "./cc-test-reporter before-build" -after_script: - - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT" \ No newline at end of file diff --git a/upload_coverage.sh b/upload_coverage.sh new file mode 100644 index 0000000..f7432a8 --- /dev/null +++ b/upload_coverage.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Qlty coverage upload script +# Usage: ./upload_coverage.sh + +echo "Installing Qlty CLI..." +curl https://qlty.sh | sh + +echo "Running tests with coverage..." +bundle exec rake test + +echo "Uploading coverage to Qlty..." +if [ -f coverage/coverage.json ]; then + QLTY_COVERAGE_TOKEN=$QLTY_COVERAGE_TOKEN qlty coverage publish coverage/coverage.json + echo "Coverage uploaded successfully!" +else + echo "No coverage file found. Make sure SimpleCov is configured correctly." + exit 1 +fi From a2ed2b6f9da7905ee8413d6e2c9c90d408d551f7 Mon Sep 17 00:00:00 2001 From: mmeest Date: Thu, 11 Sep 2025 15:28:39 +0300 Subject: [PATCH 5/7] update failing test --- test/client_test.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/client_test.rb b/test/client_test.rb index 94f5a52..d73b674 100644 --- a/test/client_test.rb +++ b/test/client_test.rb @@ -63,7 +63,9 @@ def test_does_not_make_a_request_when_response_is_cached end def test_parses_response_with_payload - stub_request_with_payload + response_body = File.read('test/fixtures/representation_rights_response_with_payload.xml') + stub_request(:post, 'https://ariregxmlv6.rik.ee/'). + to_return(status: 200, body: response_body) client = CompanyRegister::Client.new companies = client.representation_rights(citizen_personal_code: '1234', From e3069caa0c8eba197e3a4f27776abb4046ab57b3 Mon Sep 17 00:00:00 2001 From: mmeest Date: Thu, 11 Sep 2025 15:33:29 +0300 Subject: [PATCH 6/7] test update --- test/client_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/client_test.rb b/test/client_test.rb index d73b674..dfd2718 100644 --- a/test/client_test.rb +++ b/test/client_test.rb @@ -64,7 +64,10 @@ def test_does_not_make_a_request_when_response_is_cached def test_parses_response_with_payload response_body = File.read('test/fixtures/representation_rights_response_with_payload.xml') - stub_request(:post, 'https://ariregxmlv6.rik.ee/'). + stub_request(:post, "https://ariregxmlv6.rik.ee/"). + with( + body: /esindus_v1/, + headers: { 'Soapaction' => '"esindus_v1"' }). to_return(status: 200, body: response_body) client = CompanyRegister::Client.new From 5c1916946b359699c82a97f3299978be2aa354c6 Mon Sep 17 00:00:00 2001 From: mmeest Date: Sun, 21 Sep 2025 14:20:31 +0300 Subject: [PATCH 7/7] removed codeclimate yml --- .codeclimate.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 983bf3e..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "2" -prepare: - fetch: - - "https://raw.githubusercontent.com/internetee/style-guide/master/ruby/.rubocop.yml" -plugins: - duplication: - enabled: true - config: - languages: - - ruby - rubocop: - enabled: true - channel: rubocop-0-62 -exclude_patterns: - - "bin/" - - "test/" \ No newline at end of file