Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .codeclimate.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 7 additions & 0 deletions .qlty/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*
!configs
!configs/**
!hooks
!hooks/**
!qlty.toml
!.gitignore
21 changes: 21 additions & 0 deletions .qlty/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -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
89 changes: 89 additions & 0 deletions .qlty/qlty.toml
Original file line number Diff line number Diff line change
@@ -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-modern.yml"
path = ".rubocop-modern.yml"
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

7 changes: 6 additions & 1 deletion test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ 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/").
with(
body: /esindus_v1/,
headers: { 'Soapaction' => '"esindus_v1"' }).
to_return(status: 200, body: response_body)

client = CompanyRegister::Client.new
companies = client.representation_rights(citizen_personal_code: '1234',
Expand Down
19 changes: 19 additions & 0 deletions upload_coverage.sh
Original file line number Diff line number Diff line change
@@ -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